#!/bin/bash # $Id: db-unstable,v 1.9 2004/01/06 02:50:53 judd Exp $ uid=`id -u` TMPDIR="/tmp/archpkg.$uid" repoid=3 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}'` echo "error: db generation is already in progress (started by $owner)" exit 1 fi if [ -d /tmp/.gensync ]; then echo "error: someone else is currently running gensync!" exit 1 fi # catch ^C breaks trap cleanup SIGINT # lock touch /tmp/.repolck.$repoid # RedHat's mktemp is broken... if [ -d $TMPDIR ]; then echo "==> Removing old temp dir..." >&2 rm -rf $TMPDIR || exit 1 fi mkdir $TMPDIR; [ $? -gt 0 ] && exit 1 echo "==> Generating Pacman Database for UNSTABLE..." >&2 cd $TMPDIR CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:/home/cvs-unstable cvs -q export -r CURRENT unstable /usr/bin/gensync $TMPDIR/unstable $TMPDIR/unstable.db.tar.gz /home/ftp/unstable [ -f $TMPDIR/unstable.db.tar.gz ] && mv -f $TMPDIR/unstable.db.tar.gz /home/ftp/unstable cd $TMPDIR/unstable && /arch/pkgdb $repoid echo "==> Scanning for missing packages..." >&2 /arch/genpkglist unstable cleanup