]> git.decadent.org.uk Git - dak.git/blob - config/debian-security/cron.unchecked
ba1e5751ae197880879c5e47bf0b653457576097
[dak.git] / config / debian-security / cron.unchecked
1 #! /bin/bash
2
3 set -e
4 set -o pipefail
5 set -u
6
7 export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars
8 . $SCRIPTVARS
9
10 # And use one locale, no matter what the caller has set
11 export LANG=C
12 export LC_ALL=C
13
14 report=$queuedir/REPORT
15 reportdis=$queuedir/REPORT.disembargo
16 timestamp=$(date "+%Y-%m-%d %H:%M")
17 doanything=false
18 dopolicy=false
19 LOCKFILE="$lockdir/unchecked.lock"
20
21 # So first we should go and see if any process-policy action is done
22 dak process-policy embargoed | mail -a "X-Debian: DAK" -e -s "Automatically accepted from embargoed" team@security.debian.org -- -F "Debian FTP Masters" -f ftpmaster@ftp-master.debian.org
23 dak process-policy unembargoed | mail -a "X-Debian: DAK" -e -s "Automatically accepted from unembargoed" team@security.debian.org -- -F "Debian FTP Masters" -f ftpmaster@ftp-master.debian.org
24
25 # Now, if this really did anything, we can then sync it over. Files
26 # in newstage mean they are (late) accepts of security stuff, need
27 # to sync to ftp-master
28
29 cleanup() {
30     rm -f "$LOCKFILE"
31 }
32
33 if ! lockfile -r8 "$LOCKFILE"; then
34     echo "aborting cron.unchecked because $LOCKFILE has already been locked"
35     exit 0
36 fi
37 trap cleanup EXIT
38
39 for queue in embargoed; do
40     cd ${queuedir}/${queue}/COMMENTS
41     comments=$(find . -maxdepth 1 -mindepth 1 -type f '(' -name "ACCEPT.*.changes" -o -name "REJECT.*.changes" ')' | sed -e "s,./,," | xargs)
42     if [ -n "$comments" ]; then
43         dopolicy=true
44         echo "$timestamp": ${comments:-"Nothing to do for ${queue}"}  >> $report
45         dak process-policy ${queue} >> ${report}
46         find /srv/security-master.debian.org/queue/accepted -type f -exec mv -t /srv/queued/ftpmaster '{}' +
47     fi
48 done
49
50 cd $unchecked
51 changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
52 if [ -n "$changes" ]; then
53     doanything=true
54     echo "$timestamp": ${changes:-"Nothing to do in unchecked"}  >> $report
55     dak process-upload -a -d "$unchecked" >> $report
56 fi
57
58 cd $disembargo
59 changes=$(find . -maxdepth 1 -mindepth 1 -type f -name \*.changes | sed -e "s,./,," | xargs)
60
61 if [ -n "$changes" ]; then
62     doanything=true
63     echo "$timestamp": ${changes:-"Nothing to do in disembargo"}  >> $reportdis
64     dak process-upload -a -d "$disembargo" >> $reportdis
65 fi
66
67 if [ "${doanything}" = "false" ] && [ "${dopolicy}" = "false" ]; then
68     echo "$timestamp": Nothing to do >> $report
69     exit 0
70 fi
71
72 dak manage-build-queues -a
73
74 if [ "x${dopolicy}x" = "xtruex" ]; then
75     # We had something approved from a policy queue, push out new archive
76     dak dominate
77     #dak generate-filelist
78     cd $configdir
79     $configdir/map.sh
80     #apt-ftparchive generate apt.conf
81     dak generate-packages-sources2 -a security
82     dak generate-releases -a security
83     /srv/security-master.debian.org/dak/config/debian-security/make-mirror.sh
84     sudo -u archvsync -H /home/archvsync/signal_security
85 fi
86
87 cleanup
88 trap - EXIT
89
90 $configdir/cron.buildd