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