+for vdist in ubuntu/karmic ubuntu/lucid ubuntu/maverick \
+ ubuntu/natty ubuntu/oneiric ubuntu/precise \
+ debian/wheezy debian/squeeze debian/lenny \
+ debian/etch; do
+ dist=`basename $vdist`
+ vendor=`dirname $vdist`
+ ftpdir=/home/ftp/pub/$vendor
+ if test ! -d $ftpdir; then
+ echo "$ftpdir does not exist"
+ exit 1
+ fi
+ cd $ftpdir
+ test -d tmp || mkdir tmp
+ # Uncomment to clean the .db (cache)
+ # rm tmp/*
+
+ sections=""
+ for section in main restricted; do
+ # Prepare pool
+ d=pool/dists/$dist/$section
+ if test ! -d $d; then mkdir -p $d; fi
+ mkdir -p $d/source
+ # Remove invalid symlinks (source, i386, amd64,..)
+ for l in $d/*/*; do
+ if test -L "$l"; then
+ if test ! -f "$l"; then
+ rm $l
+ fi
+ fi
+ done
+ # Make symlinks from the regular FTP archive
+ has_packages=false
+ for pdir in /home/ftp/pub/*; do
+ use=false
+ if test -f $pdir/.htaccess -a $section != "main"; then
+ use=true
+ fi
+ if test ! -f $pdir/.htaccess -a $section = "main"; then
+ use=true
+ fi
+ if $use; then
+ distdir=$pdir/$vendor/$dist
+ if test -d $distdir; then
+ for f in $distdir/*.dsc $distdir/*.gz; do
+ test -f $f && ln -sf $f $d/source
+ done
+ for arch in $architectures; do
+ mkdir -p $d/${arch}
+ for f in $pdir/.htaccess \
+ $distdir/*_${arch}.* \
+ $distdir/*_all.*; do
+ if test -f $f; then
+ ln -sf $f $d/${arch}
+ has_packages=true
+ fi
+ done
+ done
+ fi
+ fi
+ done
+ # ${confdir}/symclean.sh $d
+
+ rm -f $d/Release
+ if $has_packages; then
+ if test -z "$sections"; then
+ sections="$section"