]> git.decadent.org.uk Git - dak.git/blob - config/debian-security/cron.daily
Merge remote-tracking branch 'nthykier/auto-decruft' into merge
[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 oldstable stable testing; do
25     case $suite in
26         oldstable) override_suite=wheezy  ;;
27         stable)    override_suite=jessie  ;;
28         testing)   override_suite=stretch ;;
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 ################################################################################
54
55 cd $configdir
56 dak import-keyring -L /srv/keyring.debian.org/keyrings/debian-keyring.gpg
57
58 cleanup() {
59     rm -f "$LOCKFILE"
60 }
61
62 if ! lockfile -r100 "$LOCKFILE"; then
63     echo "Could not lock $LOCKFILE." >&2
64     exit 1
65 fi
66 trap cleanup EXIT
67
68 dak clean-queues -i ${unchecked}
69 dak clean-queues -i $disembargo
70 dak clean-suites
71
72 cleanup
73 trap - EXIT
74
75 symlinks -d -r $ftpdir
76
77 pg_file="${base}/dak-backup/dump_$(date +%Y.%m.%d-%H:%M:%S)"
78 pg_dump obscurity > "${pg_file}"
79 nice xz -9 "${pg_file}"
80
81 find "${base}/dak-backup" -mtime +30 \! -name '.nobackup' -delete
82
83 ################################################################################