diff options
-rwxr-xr-x | db-move | 26 | ||||
-rwxr-xr-x | db-remove | 25 | ||||
-rwxr-xr-x | db-update | 24 | ||||
-rwxr-xr-x | testing2x | 11 |
4 files changed, 26 insertions, 60 deletions
@@ -6,13 +6,9 @@ if [ $# -ne 4 ]; 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 packagename="$1" repofrom="$2" @@ -32,11 +28,11 @@ svnrepo_to="$repoto-$arch" [ "$UID" = "" ] && UID=$(uid) WORKDIR="/tmp/db-move.$svnrepo_from.$svnrepo_to.$UID" -LOCKFILE="/tmp/.repolck.$arch.$reponame" cleanup() { # unlock - rm -f "$LOCKFILE" + repo_unlock $repoto $arch + repo_unlock $repofrom $arch rm -rf "$WORKDIR" [ "$1" ] && exit $1 } @@ -51,16 +47,12 @@ die() { cleanup 1 } -# check for locks -if [ -f "$LOCKFILE" ]; then - owner="$(/usr/bin/stat -c %U $LOCKFILE)" - die "error: db generation is already in progress (started by $owner)" -fi - trap ctrl_c 2 -trap cleanup 0 +trap cleanup 0 1 + +repo_lock $repoto $arch +repo_lock $repofrom $arch -/bin/touch "$LOCKFILE" /bin/mkdir -p "$WORKDIR" cd "$WORKDIR" @@ -5,13 +5,9 @@ if [ $# -ne 3 ]; 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 packagename="$1" reponame="$2" @@ -28,11 +24,10 @@ svnrepo="$reponame-$arch" [ "$UID" = "" ] && UID=$(uid) WORKDIR="/tmp/db-remove.$svnrepo.$UID" -LOCKFILE="/tmp/.repolck.$arch.$reponame" cleanup() { # unlock - rm -f "$LOCKFILE" + repo_unlock $reponame $arch rm -rf "$WORKDIR" [ "$1" ] && exit $1 } @@ -47,17 +42,11 @@ 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 + +repo_lock $reponame $arch -/bin/touch "$LOCKFILE" /bin/mkdir -p "$WORKDIR" @@ -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" @@ -1,11 +1,8 @@ #!/bin/bash -if [ -f "/etc/makepkg.conf" ]; then - . /etc/makepkg.conf -else - echo "/etc/makepkg.conf does not exist!" - exit 1 -fi +. "$(dirname $0)/db-functions" + +source_makepkg case "$0" in *64) @@ -29,7 +26,7 @@ ctrl_c() { } trap ctrl_c 2 -trap cleanup 0 +trap cleanup 0 1 cd "${WORKDIR}" /usr/bin/svn checkout -N ${svnpath} checkout |