]> git.decadent.org.uk Git - dak.git/blob - config/debian-security/cron.daily
Remove old (and slow) code
[dak.git] / config / debian-security / cron.daily
1 #!/bin/bash
2 #
3 # Executed daily via cron, out of dak's crontab.
4
5 set -e
6 set -o pipefail
7 export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars
8 . $SCRIPTVARS
9
10 LOCKFILE="$lockdir/unchecked.lock"
11
12 ################################################################################
13
14 # Fix overrides
15
16 rsync --delete -r --include=override\* --exclude=\* --password-file /srv/security-master.debian.org/s3kr1t/rsync-password -ql security-master@ftp-master::indices/ $overridedir
17
18 cd $overridedir
19 for file in override*.gz; do
20     zcat $file > $(basename $file .gz)
21 done
22 find . -maxdepth 1 -mindepth 1 -type l | xargs --no-run-if-empty rm
23
24 for suite in stable testing; do
25     case $suite in
26         oldstable) override_suite=squeeze;;
27         stable) override_suite=wheezy;;
28         testing) override_suite=jessie;;
29         *) echo "Unknown suite type ($suite)"; exit 1;;
30     esac
31     for component in $components; do
32         for override_type in $override_types; do
33             case $override_type in
34                 deb) type="" ;;
35                 dsc) type=".src" ;;
36                 udeb) type=".debian-installer" ;;
37             esac
38
39             if [ "$override_type" = "udeb" ]; then
40                 if [ ! "$component" = "main" ]; then
41                     continue
42                 fi
43             fi
44
45             OFILE="override.$override_suite.$component$type.gz"
46             if [ -r "$OFILE" ]; then
47                 zcat "$OFILE" | dak control-overrides -q -a -t $override_type -s $suite -c updates/$component
48             fi
49         done
50     done
51 done
52
53 # Generate .all3 overides for the buildd support
54 for dist in squeeze wheezy jessie; do
55     rm -f override.$dist.all3
56     components="main contrib non-free";
57     if [ -f override.$dist.main.debian-installer.gz ]; then
58         components="$components main.debian-installer"
59     fi
60     for component in $components; do
61         zcat override.$dist.$component.gz >> override.$dist.all3
62         if [ -e "override.$dist.$component.src.gz" ]; then
63             zcat override.$dist.$component.src.gz >> override.$dist.all3.src
64         fi
65     done
66 done
67
68 ################################################################################
69
70 cd $configdir
71 dak import-keyring -L /srv/keyring.debian.org/keyrings/debian-keyring.gpg
72
73 cleanup() {
74     rm -f "$LOCKFILE"
75 }
76
77 if ! lockfile -r100 "$LOCKFILE"; then
78     echo "Could not lock $LOCKFILE." >&2
79     exit 1
80 fi
81 trap cleanup EXIT
82
83 dak clean-queues -i ${unchecked}
84 dak clean-queues -i $disembargo
85 dak clean-suites
86
87 cleanup
88 trap - EXIT
89
90 symlinks -d -r $ftpdir
91
92 pg_file="${base}/dak-backup/dump_$(date +%Y.%m.%d-%H:%M:%S)"
93 pg_dump obscurity > "${pg_file}"
94 nice xz -9 "${pg_file}"
95
96 find "${base}/dak-backup" -mtime +30 \! -name '.nobackup' -delete
97
98 ################################################################################