]> git.decadent.org.uk Git - dak.git/blob - config/debian-security/cron.buildd
remove lenny
[dak.git] / config / debian-security / cron.buildd
1 #! /bin/bash
2 #
3 # Executed after cron.unchecked
4
5 set -e
6 set -u
7
8 export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars
9 . $SCRIPTVARS
10 SSH_SOCKET=~/.ssh/buildd.debian.org.socket
11 DISTS=$(dak admin s list)
12
13 if [ -e $ftpdir/Archive_Maintenance_In_Progress ]; then
14     exit 0
15 fi
16
17 dists=
18 now=$(date +%s)
19 check=$(( now - 3*60 ))
20
21 for dist in $DISTS; do
22     smodtime=$(stat -c "%Y" $base/buildd/$dist/Sources.gz)
23     pmodtime=$(stat -c "%Y" $base/buildd/$dist/Packages.gz)
24
25     if [ ${smodtime} -gt ${check} ] || [ ${pmodtime} -gt ${check} ]; then
26         # Packages/Sources changed in the last minutes
27         dists="${dists} ${dist}"
28     else
29         continue
30     fi
31 done
32
33 if [ ! -z "${dists}" ]; then
34     # setup ssh master process
35     ssh wbadm@buildd -S $SSH_SOCKET -MN 2> /dev/null &
36     SSH_PID=$!
37     while [ ! -S $SSH_SOCKET ]; do
38         sleep 1
39     done
40     trap 'kill -TERM $SSH_PID' 0
41     for d in ${dists}; do
42         case ${d} in
43             stable)
44                 send=squeeze
45                 ;;
46             testing)
47                 send=wheezy
48                 ;;
49             *)
50                 send=unknown
51                 ;;
52         esac
53
54         ssh wbadm@buildd -S $SSH_SOCKET trigger.security $send
55     done
56 fi