[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] Really fix locking behaviour of dinstall.



Signed-off-by: Torsten Werner <twerner@debian.org>
---
 config/debian/cron.dinstall      |    6 ++++--
 config/debian/dinstall.functions |   12 ++++++------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/config/debian/cron.dinstall b/config/debian/cron.dinstall
index d66e234..6f7cf0d 100755
--- a/config/debian/cron.dinstall
+++ b/config/debian/cron.dinstall
@@ -159,7 +159,7 @@ state "Startup"
 
 lockfile -l 3600 "${LOCK_DAILY}"
 trap onerror ERR
-trap cleanup EXIT TERM HUP INT QUIT
+trap remove_daily_lock EXIT TERM HUP INT QUIT
 
 touch "${LOCK_BRITNEY}"
 
@@ -205,6 +205,7 @@ stage $GO
 
 lockfile "$LOCK_ACCEPTED"
 lockfile "$LOCK_NEW"
+trap remove_all_locks EXIT TERM HUP INT QUIT
 
 GO=(
     FUNC="punew"
@@ -381,7 +382,8 @@ GO=(
 )
 stage $GO
 
-remove_locks
+remove_all_locks
+trap - EXIT TERM HUP INT QUIT
 
 ts "locked part finished"
 state "postlock"
diff --git a/config/debian/dinstall.functions b/config/debian/dinstall.functions
index 1834841..be4ed57 100644
--- a/config/debian/dinstall.functions
+++ b/config/debian/dinstall.functions
@@ -4,14 +4,14 @@ function ts() {
         echo "Archive maintenance timestamp ($1): $(date +%H:%M:%S)"
 }
 
-# Remove all locks
-function remove_locks() {
-    rm -f $LOCK_DAILY $LOCK_ACCEPTED $LOCK_NEW
+# Remove daily lock
+function remove_daily_lock() {
+    rm -f $LOCK_DAILY
 }
 
-# trap handler for cleaning up on signal / error
-function cleanup() {
-    remove_locks
+# Remove all locks
+function remove_all_locks() {
+    rm -f $LOCK_DAILY $LOCK_ACCEPTED $LOCK_NEW
 }
 
 # If we error out this one is called, *FOLLOWED* by cleanup above
-- 
1.5.6.5


Reply to: