X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=config%2Fdebian-security%2Fcron.daily;h=9417a8569e8495a778582637e5cc20e8cf0bc9e9;hb=773f4286615587294d6e6acfb850df53a661bbc5;hp=02e917959674259c5cc1bab2c9a103ebe2777280;hpb=0c37032fedf7fc2fdf348950483781da6095b2ca;p=dak.git diff --git a/config/debian-security/cron.daily b/config/debian-security/cron.daily index 02e91795..9417a856 100755 --- a/config/debian-security/cron.daily +++ b/config/debian-security/cron.daily @@ -1,80 +1,83 @@ -#!/bin/sh +#!/bin/bash # # Executed daily via cron, out of dak's crontab. set -e -export SCRIPTVARS=/org/security.debian.org/dak/config/debian-security/vars +set -o pipefail +export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars . $SCRIPTVARS +LOCKFILE="$lockdir/unchecked.lock" + ################################################################################ # Fix overrides -rsync --delete -r --include=override\* --exclude=\* --password-file /srv/non-us.debian.org/s3kr1t/rsync-password -ql security-master@ftp-master::indices/ $overridedir +rsync --delete -r --include=override\* --exclude=\* --password-file /srv/security-master.debian.org/s3kr1t/rsync-password -ql security-master@ftp-master::indices/ $overridedir cd $overridedir -find . -maxdepth 1 -mindepth 1 -type l | xargs --no-run-if-empty rm +for file in override*.gz; do + zcat -- "$file" > "${file%.gz}" +done +find . -maxdepth 1 -mindepth 1 -type l -delete -for suite in $suites; do +for suite in oldstable stable testing; do case $suite in - oldstable) override_suite=sarge;; - stable) override_suite=etch;; - testing) override_suite=lenny;; - *) echo "Unknown suite type ($suite)"; exit 1;; + oldstable) override_suite=wheezy ;; + stable) override_suite=jessie ;; + testing) override_suite=stretch ;; + *) echo "Unknown suite type ($suite)"; exit 1;; esac for component in $components; do - for override_type in $override_types; do - case $override_type in - deb) type="" ;; - dsc) type=".src" ;; - udeb) type=".debian-installer" ;; - esac - - if [ "$override_type" = "udeb" ]; then - if [ ! "$component" = "main" ]; then - continue - fi - fi - zcat override.$override_suite.$component$type.gz | dak control-overrides -q -a -t $override_type -s $suite -c updates/$component - done - done -done - -# Generate .all3 overides for the buildd support -for dist in etch lenny; do - rm -f override.$dist.all3 - components="main contrib non-free"; - if [ -f override.$dist.main.debian-installer.gz ]; then - components="$components main.debian-installer" - fi - for component in $components; do - zcat override.$dist.$component.gz >> override.$dist.all3 - if [ -e "override.$dist.$component.src.gz" ]; then - zcat override.$dist.$component.src.gz >> override.$dist.all3.src - fi + for override_type in $override_types; do + case $override_type in + deb) type="" ;; + dsc) type=".src" ;; + udeb) type=".debian-installer" ;; + esac + + if [ "$override_type" = "udeb" ]; then + if [ ! "$component" = "main" ]; then + continue + fi + fi + + OFILE="override.$override_suite.$component$type.gz" + if [ -r "$OFILE" ]; then + zcat "$OFILE" | dak control-overrides -q -a -t $override_type -s $suite -c updates/$component + fi + done done done ################################################################################ -# Freshen Packages-Arch-Specific -wget -qN http://buildd.debian.org/quinn-diff/Packages-arch-specific -O $base/buildd/Packages-arch-specific +cd $configdir +dak import-keyring -L /srv/keyring.debian.org/keyrings/debian-keyring.gpg -################################################################################ +cleanup() { + rm -f "$LOCKFILE" +} + +if ! lockfile -r100 "$LOCKFILE"; then + echo "Could not lock $LOCKFILE." >&2 + exit 1 +fi +trap cleanup EXIT -cd $masterdir -dak clean-queues +dak clean-queues -i ${unchecked} +dak clean-queues -i $disembargo dak clean-suites -apt-ftparchive -q clean apt.conf -apt-ftparchive -q clean apt.conf.buildd + +cleanup +trap - EXIT symlinks -d -r $ftpdir -pg_dump obscurity > /org/security.debian.org/dak-backup/dump_$(date +%Y.%m.%d-%H:%M:%S) +pg_file="${base}/dak-backup/dump_$(date +%Y.%m.%d-%H:%M:%S)" +pg_dump obscurity > "${pg_file}" +nice xz -9 "${pg_file}" -# Vacuum the database -set +e -echo "VACUUM; VACUUM ANALYZE;" | psql obscurity 2>&1 | egrep -v "^NOTICE: Skipping \"pg_.*only table or database owner can VACUUM it$|^VACUUM$" -set -e +find "${base}/dak-backup" -mtime +30 \! -name '.nobackup' -delete ################################################################################