From a9071be19ea09e62c94cd5c3f2acf6ecf8e76aa1 Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Thu, 10 Feb 2011 13:49:02 +0100 Subject: [PATCH] Really fix locking behaviour of dinstall. Signed-off-by: Torsten Werner --- 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 d66e2348..6f7cf0d8 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 1834841b..be4ed572 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 -- 2.39.2