summaryrefslogtreecommitdiffstats
path: root/db-move
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2010-08-08 15:03:27 +0200
committerPierre Schmitz <pierre@archlinux.de>2010-08-08 15:03:27 +0200
commit9eb1cd7b9403533c4b60ecfbbbf00a08c211059a (patch)
tree024459abc4017b4c574bf6e5cd9d2f4df2b95f26 /db-move
parent388d629327d97e8d15a7a67cc87ae36edfe2f385 (diff)
downloaddbscripts-9eb1cd7b9403533c4b60ecfbbbf00a08c211059a.tar.gz
dbscripts-9eb1cd7b9403533c4b60ecfbbbf00a08c211059a.tar.xz
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.
Diffstat (limited to 'db-move')
-rwxr-xr-xdb-move25
1 files changed, 3 insertions, 22 deletions
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