diff options
author | Judd Vinet <judd@archlinux.org> | 2005-06-21 05:44:57 +0200 |
---|---|---|
committer | Judd Vinet <judd@archlinux.org> | 2005-06-21 05:44:57 +0200 |
commit | bdcdf586bdb095e833084c092d1cb79d3ed63523 (patch) | |
tree | 1815a860e1f8deb27db465c784c44ac5d5daad18 | |
parent | abccc814a02f7be0e97bade0892f80eb4c71f0de (diff) | |
download | dbscripts-bdcdf586bdb095e833084c092d1cb79d3ed63523.tar.gz dbscripts-bdcdf586bdb095e833084c092d1cb79d3ed63523.tar.xz |
nixed all the redundant code in the db- scripts
-rwxr-xr-x | db-arch | 65 | ||||
-rwxr-xr-x | db-extra | 65 | ||||
-rw-r--r-- | db-inc | 59 | ||||
-rwxr-xr-x | db-unstable | 65 |
4 files changed, 80 insertions, 174 deletions
@@ -1,65 +1,14 @@ #!/bin/bash -# $Id: db-arch,v 1.21 2005/02/25 21:27:44 judd Exp $ +# $Id: db-arch,v 1.22 2005/06/21 03:44:57 judd Exp $ -uid=`id -u` repoid=1 -ftppath="/home/ftp/current/os/i686" - -TMPDIR="/tmp/archpkg.$repoid.$uid" - -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 +reponame="current" -# 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 CURRENT..." >&2 -cd $TMPDIR -CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:/home/cvs-arch cvs -q export -r CURRENT arch/build -if [ $? -gt 0 ]; then - echo "==> CVS export failed!" - cleanup - exit 1 -fi -# check again -if [ -d /tmp/.gensync ]; then - echo "error: someone else is currently running gensync!" - cleanup - exit 1 -fi -/usr/bin/gensync $TMPDIR/arch/build $TMPDIR/current.db.tar.gz $ftppath -[ -f $TMPDIR/current.db.tar.gz ] && mv -f $TMPDIR/current.db.tar.gz $ftppath +ftppath="/home/ftp/current/os/i686" -echo "==> Scanning for New/Updated/Deleted packages..." >&2 -cd $TMPDIR/arch/build -/arch/pkgdb1 $repoid | /arch/pkgdb2 $repoid $ftppath +cvspath="/home/cvs-arch" +cvsmod="arch/build" -echo "==> Generating Text Package List..." >&2 -/arch/genpkglist current -mv packages.txt $ftppath/setup/packages.txt +# call the real script +. `dirname $0`/db-inc -cleanup @@ -1,65 +1,14 @@ #!/bin/bash -# $Id: db-extra,v 1.10 2005/02/25 21:27:44 judd Exp $ +# $Id: db-extra,v 1.11 2005/06/21 03:44:57 judd Exp $ -uid=`id -u` repoid=2 -ftppath="/home/ftp/extra/os/i686" - -TMPDIR="/tmp/archpkg.$repoid.$uid" - -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 +reponame="extra" -# 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 EXTRA..." >&2 -cd $TMPDIR -CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:/home/cvs-extra cvs -q export -r CURRENT extra -if [ $? -gt 0 ]; then - echo "==> CVS export failed!" - cleanup - exit 1 -fi -# check again -if [ -d /tmp/.gensync ]; then - echo "error: someone else is currently running gensync!" - cleanup - exit 1 -fi -/usr/bin/gensync $TMPDIR/extra $TMPDIR/extra.db.tar.gz $ftppath -[ -f $TMPDIR/extra.db.tar.gz ] && mv -f $TMPDIR/extra.db.tar.gz $ftppath +ftppath="/home/ftp/extra/os/i686" -echo "==> Scanning for New/Updated/Deleted packages..." >&2 -cd $TMPDIR/extra -/arch/pkgdb1 $repoid | /arch/pkgdb2 $repoid $ftppath +cvspath="/home/cvs-extra" +cvsmod="extra" -echo "==> Scanning for missing packages..." >&2 -/arch/genpkglist extra -mv packages.txt $ftppath/packages.txt +# call the real script +. `dirname $0`/db-inc -cleanup @@ -0,0 +1,59 @@ +# $Id: db-inc,v 1.1 2005/06/21 03:44:57 judd Exp $ + +UID=`id -u` +TMPDIR="/tmp/archpkg.$repoid.$UID" + +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 + +# 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 repository '$reponame'..." >&2 +cd $TMPDIR +CVS_RSH=ssh CVSROOT=:ext:cvs.archlinux.org:$cvspath cvs -q export -r CURRENT $cvsmod +if [ $? -gt 0 ]; then + echo "==> CVS export failed!" + cleanup + exit 1 +fi +/usr/bin/gensync $TMPDIR/$cvsmod $TMPDIR/$reponame.db.tar.gz $ftppath +[ -f $TMPDIR/$reponame.db.tar.gz ] && mv -f $TMPDIR/$reponame.db.tar.gz $ftppath + +echo "==> Scanning for New/Updated/Deleted packages..." >&2 +cd $TMPDIR/$cvsmod +/arch/pkgdb1 $repoid | /arch/pkgdb2 $repoid $ftppath + +echo "==> Generating Text Package List..." >&2 +/arch/genpkglist $reponame + +# hack -- only Current's packages.txt goes in a "setup" subdir +if [ "$reponame" = "current" ]; then + mv packages.txt $ftppath/setup/packages.txt +else + mv packages.txt $ftppath/packages.txt +fi + +cleanup + +# vim: set ft=sh: diff --git a/db-unstable b/db-unstable index 5b5edad..a22188b 100755 --- a/db-unstable +++ b/db-unstable @@ -1,65 +1,14 @@ #!/bin/bash -# $Id: db-unstable,v 1.15 2005/02/25 21:27:44 judd Exp $ +# $Id: db-unstable,v 1.16 2005/06/21 03:44:57 judd Exp $ -uid=`id -u` repoid=3 -ftppath="/home/ftp/unstable/os/i686" - -TMPDIR="/tmp/archpkg.$repoid.$uid" - -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 +reponame="unstable" -# 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 -if [ $? -gt 0 ]; then - echo "==> CVS export failed!" - cleanup - exit 1 -fi -# check again -if [ -d /tmp/.gensync ]; then - echo "error: someone else is currently running gensync!" - cleanup - exit 1 -fi -/usr/bin/gensync $TMPDIR/unstable $TMPDIR/unstable.db.tar.gz $ftppath -[ -f $TMPDIR/unstable.db.tar.gz ] && mv -f $TMPDIR/unstable.db.tar.gz $ftppath +ftppath="/home/ftp/unstable/os/i686" -echo "==> Scanning for New/Updated/Deleted packages..." >&2 -cd $TMPDIR/unstable -/arch/pkgdb1 $repoid | /arch/pkgdb2 $repoid $ftppath +cvspath="/home/cvs-unstable" +cvsmod="unstable" -echo "==> Scanning for missing packages..." >&2 -/arch/genpkglist unstable -mv packages.txt $ftppath/packages.txt +# call the real script +. `dirname $0`/db-inc -cleanup |