From: Torsten Werner <twerner@debian.org>
Date: Tue, 4 Jan 2011 10:34:52 +0000 (+0100)
Subject: fix lock removal in dinstall
X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=3d8fa539bcd54aa937d68dd29ff6d12e04588e25;p=dak.git

fix lock removal in dinstall

Signed-off-by: Torsten Werner <twerner@debian.org>
---

diff --git a/config/debian/cron.dinstall b/config/debian/cron.dinstall
index e2dfe7c8..d275354c 100755
--- a/config/debian/cron.dinstall
+++ b/config/debian/cron.dinstall
@@ -381,9 +381,7 @@ GO=(
 )
 stage $GO
 
-rm -f "$LOCK_ACCEPTED"
-rm -f "$LOCK_NEW"
-rm -f "${LOCK_DAILY}"
+remove_locks
 
 ts "locked part finished"
 state "postlock"
diff --git a/config/debian/dinstall.functions b/config/debian/dinstall.functions
index 98972e6d..605dd2b9 100644
--- a/config/debian/dinstall.functions
+++ b/config/debian/dinstall.functions
@@ -4,10 +4,14 @@ function ts() {
         echo "Archive maintenance timestamp ($1): $(date +%H:%M:%S)"
 }
 
-# Cleanup actions
+# Remove all locks
+function remove_locks() {
+    rm -f $LOCK_DAILY $LOCK_ACCEPTED $LOCK_NEW
+}
+
+# trap handler for cleaning up on signal / error
 function cleanup() {
-	rm -f ${LOCK_DAILY}
-	rm -f ${LOCK_ACCEPTED}
+    remove_locks
 }
 
 # If we error out this one is called, *FOLLOWED* by cleanup above