summaryrefslogtreecommitdiffstats
path: root/db-arch
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2003-08-17 01:56:46 +0200
committerJudd Vinet <judd@archlinux.org>2003-08-17 01:56:46 +0200
commitcd3590946ac66b7adcfa95f51f00f917327bf20a (patch)
treea08dd50987c50c79ea498488a79279f2834d2538 /db-arch
parent401e01f8411179d8aa9598a07e4621b2fb19e986 (diff)
downloaddbscripts-cd3590946ac66b7adcfa95f51f00f917327bf20a.tar.gz
dbscripts-cd3590946ac66b7adcfa95f51f00f917327bf20a.tar.xz
added locking
Diffstat (limited to 'db-arch')
-rwxr-xr-xdb-arch15
1 files changed, 14 insertions, 1 deletions
diff --git a/db-arch b/db-arch
index 0310555..74fa5ed 100755
--- a/db-arch
+++ b/db-arch
@@ -1,8 +1,19 @@
#!/bin/bash
-# $Id: db-arch,v 1.9 2003/06/05 00:01:24 judd Exp $
+# $Id: db-arch,v 1.10 2003/08/16 23:56:46 judd Exp $
uid=`id -u`
TMPDIR="/tmp/archpkg.$uid"
+repoid=1
+
+# 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 /tmp/archpkg.$uid ]; then
@@ -24,3 +35,5 @@ echo "==> Generating Text Package List..." >&2
mv packages.txt /home/ftp/current/setup/packages.txt
rm -rf $TMPDIR
+# unlock
+rm -f /tmp/.repolck.$repoid