summaryrefslogtreecommitdiffstats
path: root/db-extra
diff options
context:
space:
mode:
Diffstat (limited to 'db-extra')
-rwxr-xr-xdb-extra17
1 files changed, 12 insertions, 5 deletions
diff --git a/db-extra b/db-extra
index 506aea6..b50c7a6 100755
--- a/db-extra
+++ b/db-extra
@@ -1,10 +1,17 @@
#!/bin/bash
-# $Id: db-extra,v 1.3 2003/12/21 03:24:09 judd Exp $
+# $Id: db-extra,v 1.4 2004/01/06 02:50:53 judd Exp $
uid=`id -u`
TMPDIR="/tmp/archpkg.$uid"
repoid=2
+cleanup() {
+ rm -rf $TMPDIR
+ # unlock
+ rm -f /tmp/.repolck.$repoid
+ exit 0
+}
+
# check for locks
if [ -f /tmp/.repolck.$repoid ]; then
owner=`/bin/ls -l /tmp/.repolck.$repoid | awk '{print $3}'`
@@ -16,6 +23,8 @@ if [ -d /tmp/.gensync ]; then
exit 1
fi
+# catch ^C breaks
+trap cleanup SIGINT
# lock
touch /tmp/.repolck.$repoid
@@ -32,11 +41,9 @@ CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:/home/cvs-extra cvs -q export -r CURR
/usr/bin/gensync $TMPDIR/extra $TMPDIR/extra.db.tar.gz /home/ftp/extra
[ -f $TMPDIR/extra.db.tar.gz ] && mv -f $TMPDIR/extra.db.tar.gz /home/ftp/extra
-cd $TMPDIR/extra && /arch/pkgdb 2
+cd $TMPDIR/extra && /arch/pkgdb $repoid
echo "==> Scanning for missing packages..." >&2
/arch/genpkglist extra
-rm -rf $TMPDIR
-# unlock
-rm -f /tmp/.repolck.$repoid
+cleanup