D0=`dirname $0`
confdir=`cd $D0; pwd`
+usage()
+{
+ cat <<EOF
+Usage: update-archive.sh [OPTIONS]
+Options:
+ [--debian=distros]
+ [--ubuntu=distros]
+ [--clear]
+EOF
+ exit $1
+}
+
+do_help=false
+clear=false
+while test $# -gt 0; do
+ case "$1" in
+ -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+ case $1 in
+ --clear)
+ clear=true
+ ;;
+ --debian=*)
+ DEBIAN_DIST=$optarg
+ ;;
+ --ubuntu=*)
+ UBUNTU_DIST=$optarg
+ ;;
+ -*)
+ do_help=true
+ ;;
+ esac
+ shift
+done
+
+if $do_help; then
+ usage 1>&1
+fi
+
if test ! -f ${confdir}/apt-ftparchive.conf.in; then
echo "$0: ${condir}/apt-ftparchive.conf.in not found"
exit 1
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`
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