summaryrefslogtreecommitdiffstats
path: root/db-remove
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-remove
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-remove')
-rwxr-xr-xdb-remove23
1 files changed, 2 insertions, 21 deletions
diff --git a/db-remove b/db-remove
index 0da9e75..5d61c97 100755
--- a/db-remove
+++ b/db-remove
@@ -15,27 +15,6 @@ _arch="$3"
ftppath="$FTP_BASE/$reponame/os"
svnrepo="$reponame-$_arch"
-cleanup() {
- trap '' 0 2
- # unlock
- repo_unlock $reponame $_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 $reponame $_arch || exit 1
echo -n "Removing $packagebase from $reponame..."
@@ -71,4 +50,6 @@ done
echo 'done'
+repo_unlock $reponame $_arch || exit 1
+
# vim: set ts=4 sw=4 noet ft=sh: