From 9eb1cd7b9403533c4b60ecfbbbf00a08c211059a Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Aug 2010 15:03:27 +0200 Subject: Move common function to db-functions db-functions now sets an individual $WORKDIR and implements trap functinos that remove locks on exit or error. There are new functions to lock and unlock the running script. misc-scripts/ftpdir-cleanup was renamed to ftpdir-cleanup-repo as the cron-job had the same name. Script names have to be unique when using db-functions. --- db-move | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'db-move') diff --git a/db-move b/db-move index 8b15831..b846e79 100755 --- a/db-move +++ b/db-move @@ -23,28 +23,6 @@ ftppath_to="$FTP_BASE/$repoto/os/" svnrepo_from="$repofrom-$_arch" svnrepo_to="$repoto-$_arch" -cleanup() { - trap '' 0 2 - # unlock - repo_unlock $repoto $_arch - repo_unlock $repofrom $_arch - rm -rf "$WORKDIR" - [ "$1" ] && exit $1 -} - -ctrl_c() { - echo "Interrupted" >&2 - cleanup 0 -} - -die() { - echo "$*" >&2 - cleanup 1 -} - -trap ctrl_c 2 -trap cleanup 0 - repo_lock $repoto $_arch || exit 1 repo_lock $repofrom $_arch || exit 1 @@ -91,3 +69,6 @@ if [ -d "$packagebase/repos/$svnrepo_from" ]; then else die "Error: $packagebase is not in repo $repofrom" fi + +repo_unlock $repoto $_arch || exit 1 +repo_unlock $repofrom $_arch || exit 1 -- cgit v1.2.3