]> git.decadent.org.uk Git - dak.git/blobdiff - config/debian-security/cron.weekly
use "set -o pipefail" for shell scripts
[dak.git] / config / debian-security / cron.weekly
index 80a835381620f525cddb75ed74cf2e52f1f9208a..8843ac1c043be612cda3a2dcf5b7f750cc46a606 100755 (executable)
@@ -3,16 +3,34 @@
 # Executed weekly via cron, out of dak's crontab.
 
 set -e
+set -o pipefail
 export SCRIPTVARS=/srv/security-master.debian.org/dak/config/debian-security/vars
 . $SCRIPTVARS
 
+LOCKFILE="$lockdir/unchecked.lock"
+
 ################################################################################
 
 # Weekly generation of release files, then pushing mirrors.
 # Used as we have a "Valid-until" field in our release files of 10 days. In case
 # we dont have a security update in that time...
 cd $configdir
+
+cleanup() {
+    rm -f "$LOCKFILE"
+}
+
+if ! lockfile -r100 "$LOCKFILE"; then
+    echo "Could not lock $LOCKFILE. Assuming resigning is not needed."
+    exit 0
+fi
+trap cleanup EXIT
+
 dak generate-releases
+
+cleanup
+trap - EXIT
+
 /srv/security-master.debian.org/dak/config/debian-security/make-mirror.sh
 sudo -u archvsync -H /home/archvsync/signal_security