summaryrefslogtreecommitdiff
path: root/db-unstable
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2003-08-16 23:56:46 +0000
committerJudd Vinet <judd@archlinux.org>2003-08-16 23:56:46 +0000
commitcd3590946ac66b7adcfa95f51f00f917327bf20a (patch)
treea08dd50987c50c79ea498488a79279f2834d2538 /db-unstable
parent401e01f8411179d8aa9598a07e4621b2fb19e986 (diff)
added locking
Diffstat (limited to 'db-unstable')
-rwxr-xr-xdb-unstable15
1 files changed, 14 insertions, 1 deletions
diff --git a/db-unstable b/db-unstable
index 18554c0..93ea565 100755
--- a/db-unstable
+++ b/db-unstable
@@ -1,8 +1,19 @@
#!/bin/bash
-# $Id: db-unstable,v 1.5 2003/05/25 23:50:02 judd Exp $
+# $Id: db-unstable,v 1.6 2003/08/16 23:56:46 judd Exp $
uid=`id -u`
TMPDIR="/tmp/archpkg.$uid"
+repoid=3
+
+# check for locks
+if [ -f /tmp/.repolck.$repoid ]; then
+ owner=`/bin/ls -l /tmp/.repolck.$repoid | awk '{print $3}'`
+ echo "error: db generation is already in progress (started by $owner)"
+ exit 1
+fi
+
+# lock
+touch /tmp/.repolck.$repoid
# RedHat's mktemp is broken...
if [ -d $TMPDIR ]; then
@@ -20,4 +31,6 @@ CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:/home/cvs-unstable cvs -q export -r C
cd $TMPDIR/unstable && /arch/pkgdb 3
rm -rf $TMPDIR
+# unlock
+rm -f /tmp/.repolck.$repoid