diff options
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2008-04-08 13:07:18 -0400 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2008-04-08 13:16:57 -0400 |
commit | 662fb163936fbe55b67159496ab86c5b34ff6351 (patch) | |
tree | 4953c84b0f60b33e37bacb382a723ad23361d73e /db-inc | |
parent | d2fa8ca9ef201b25d0a7af2c8ac5dc8ae8051162 (diff) |
Correct lockfile usage
We want a lock per repo not per user.
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
Diffstat (limited to 'db-inc')
-rw-r--r-- | db-inc | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -19,7 +19,7 @@ fi WORKDIR="~/.dbscripts" CHECKOUTDIR="$WORKDIR/checkout" -LOCKFILE="$WORKDIR/lock" +LOCKFILE="/tmp/.repolck.$arch.$repoid" DBFILE="$WORKDIR/$reponame.db.tar.gz" if [ ! `type -p fakeroot` ]; then @@ -46,7 +46,7 @@ getpkgname() { cleanup() { # unlock - rm -f "~/.dbscripts/lock" + rm -f "$LOCKFILE" [ "$1" ] && exit $1 } @@ -61,15 +61,16 @@ die() { } # check for locks -if [ -f ~/.dbscripts/lock ]; then - echo "error: db generation is already in progress" - exit 1 +if [ -f "$LOCKFILE" ]; then + owner=$(/bin/ls -l $LOCKFILE | /bin/awk '{print $3}') + echo "error: db generation is already in progress (started by $owner)" + exit 1 fi # catch ^C breaks trap ctrl_c SIGINT # lock -touch ~/.dbscripts/lock +touch "$LOCKFILE" if [ -d $CHECKOUTDIR ]; then cd $CHECKOUTDIR |