summaryrefslogtreecommitdiffstats
path: root/db-update
diff options
context:
space:
mode:
Diffstat (limited to 'db-update')
-rwxr-xr-xdb-update24
1 files changed, 6 insertions, 18 deletions
diff --git a/db-update b/db-update
index 4b2571d..5060449 100755
--- a/db-update
+++ b/db-update
@@ -5,13 +5,9 @@ if [ $# -ne 2 ]; then
exit 1
fi
-if [ -f "/etc/makepkg.conf" ]; then
- #Get some config info
- . /etc/makepkg.conf
-else
- echo "/etc/makepkg.conf does not exist!"
- exit 1
-fi
+. "$(dirname $0)/db-functions"
+
+source_makepkg
reponame="$1"
arch="$2"
@@ -28,7 +24,6 @@ stagedir="$HOME/staging/$reponame"
[ "$UID" = "" ] && UID=$(uid)
WORKDIR="/tmp/db-update.$svnrepo.$UID"
-LOCKFILE="/tmp/.repolck.$arch.$reponame"
ADDPKGS=""
REMPKGS=""
@@ -56,7 +51,7 @@ getpkgname() {
cleanup() {
# unlock
- rm -f "$LOCKFILE"
+ repo_unlock $reponame $arch
rm -rf "$WORKDIR"
[ "$1" ] && exit $1
}
@@ -71,17 +66,10 @@ die() {
cleanup 1
}
-# check for locks
-if [ -f "$LOCKFILE" ]; then
- owner="$(/usr/bin/stat -c %U $LOCKFILE)"
- echo "error: db generation is already in progress (started by $owner)"
- exit 1
-fi
-
trap ctrl_c 2
-trap cleanup 0
+trap cleanup 0 1
-/bin/touch "$LOCKFILE"
+repo_lock $reponame $arch
/bin/mkdir -p "$WORKDIR/build"
cd "$WORKDIR"