From: Adam Dickmeiss Date: Thu, 18 Jul 2013 12:10:50 +0000 (+0000) Subject: Rework options for update-archive.sh X-Git-Url: http://sru.miketaylor.org.uk/cgi-bin?a=commitdiff_plain;h=ee7eaaebe4dc7c5658f108c70bc84670431fcf23;p=git-tools-moved-to-github.git Rework options for update-archive.sh It has options: --debian, --ubuntu and --clear. With clear the cached db for an archive is cleared.. It's good for a corrupt archive but takes a long time per distro. --- diff --git a/update-archive/update-archive.sh b/update-archive/update-archive.sh index 126e727..c0a70ae 100755 --- a/update-archive/update-archive.sh +++ b/update-archive/update-archive.sh @@ -2,6 +2,46 @@ D0=`dirname $0` confdir=`cd $D0; pwd` +usage() +{ + cat <&1 +fi + if test ! -f ${confdir}/apt-ftparchive.conf.in; then echo "$0: ${condir}/apt-ftparchive.conf.in not found" exit 1 @@ -17,16 +57,41 @@ if test ! -x /usr/bin/apt-ftparchive; then fi # gpg -a -d -o Release.gpg Release + +architectures="i386 amd64" +if test "$DEBIAN_DIST"; then + for d in $DEBIAN_DIST; do + DISTRIBUTIONS="$DISTRIBUTIONS debian/$d" + done +fi +if test "$UBUNTU_DIST"; then + for d in $UBUNTU_DIST; do + DISTRIBUTIONS="$DISTRIBUTIONS ubuntu/$d" + done +fi -architectures="i386 amd64" +# All distributions we know of +ALLD="ubuntu/lucid ubuntu/natty ubuntu/oneiric ubuntu/precise ubuntu/quantal debian/wheezy debian/squeeze debian/lenny" -if [ "$1" == "" ]; then - DISTRIBUTIONS="ubuntu/lucid ubuntu/natty ubuntu/oneiric ubuntu/precise ubuntu/quantal debian/wheezy debian/squeeze debian/lenny" +if test -z "$DISTRIBUTIONS"; then + DISTRIBUTIONS=$ALLD else - DISTRIBUTIONS=$1 + for d in $DISTRIBUTIONS; do + bad=true + for y in $ALLD; do + if test "$d" = "$y"; then + bad=false + fi + done + if $bad; then + echo "No such distro $d" + exit 1 + fi + done fi +echo "DISTRIBUTIONS=$DISTRIBUTIONS" for vdist in $DISTRIBUTIONS ; do dist=`basename $vdist` vendor=`dirname $vdist` @@ -38,7 +103,9 @@ for vdist in $DISTRIBUTIONS ; do cd $ftpdir test -d tmp || mkdir tmp # Uncomment to clean the .db (cache) - # rm tmp/* + if $clean; then + rm tmp/* + fi sections="" for section in main restricted; do