Add debian/squeeze
[git-tools-moved-to-github.git] / update-archive / update-archive.sh
index 03d3fe8..e60a9a1 100755 (executable)
@@ -1,5 +1,5 @@
 #!/bin/sh
-# $Id: update-archive.sh,v 1.12 2007-11-11 19:47:15 adam Exp $
+# $Id: update-archive.sh,v 1.13 2008-10-20 10:24:15 adam Exp $
 if test ! -f apt-ftparchive.conf.in; then
        echo "$0: apt-ftparchive.conf.in must be located in current directory"
        exit 1
@@ -10,46 +10,61 @@ if test ! -x /usr/bin/apt-ftparchive; then
        exit 1
 fi
 
-if test -z "$1"; then
-       debiandir=/home/ftp/pub/debian
-else
-       debiandir=$1
-fi
-
-if test ! -d "$debiandir"; then
-       echo "$0: The specified '$debiandir' is not a directory"
-       exit 1
-fi
-
-
 # gpg -a -d -o Release.gpg Release
 
 confdir=`pwd`
-cd $debiandir
 
-for dist in lenny etch sarge woody; do
+architectures="i386 amd64"
+
+for vdist in ubuntu/gutsy ubuntu/hardy ubuntu/intrepid ubuntu/jaunty debian/squeeze debian/lenny debian/etch debian/sarge debian/woody; 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/*
+
        # Make symlinks from the regular FTP archive
-       d=pool/$dist
+       d=pool/dists/$dist
        if test ! -d $d; then mkdir -p $d; fi
+       # Remove invalid symlinks
        for l in $d/*; do
                if test -L $l; then
-                       if test -f $l; then
-                               :
-                       else
+                       if test ! -f $l; then
                                rm $l
                        fi
                fi
        done
-       ln -sf /home/ftp/pub/*/debian/$dist/* $d
+       mkdir -p $d/source
+       ln -sf /home/ftp/pub/*/$vendor/$dist/* $d/source
+       rm $d/source/*.deb
+       for arch in $architectures; do
+               mkdir -p $d/${arch}
+               for f in /home/ftp/pub/*/$vendor/$dist/*_${arch}.* \
+                        /home/ftp/pub/*/$vendor/$dist/*_all.*; do
+                       if test -f $f; then
+                               ln -sf $f $d/${arch}
+                       fi
+               done
+               #ln -sf /home/ftp/pub/*/$vendor/$dist/*_${arch}.* $d/${arch}
+               #ln -sf /home/ftp/pub/*/$vendor/$dist/*_all.* $d/${arch}
+       done
 
        # ${confdir}/symclean.sh $d
 
-       d=dists/$dist/main/binary-i386
-       if test ! -d $d; then mkdir -p $d; fi
-        echo "Archive: $dist" >$d/Release
-        echo 'Component: main' >>$d/Release
-        echo 'Origin: Indexdata' >>$d/Release
-        echo 'Architecture: i386' >>$d/Release
+       for arch in $architectures; do
+               d=dists/$dist/main/binary-$arch
+               if test ! -d $d; then mkdir -p $d; fi
+               echo "Archive: $dist" >$d/Release
+               echo 'Component: main' >>$d/Release
+               echo 'Origin: Indexdata' >>$d/Release
+               echo "Architecture: $arch" >>$d/Release
+       done
 
        d=dists/$dist/main/source
        if test ! -d $d; then mkdir -p $d; fi
@@ -59,34 +74,28 @@ for dist in lenny etch sarge woody; do
         echo 'Architecture: source' >>$d/Release
 
        # generate
+       echo "Begin Generate $dist"
        F=apt-ftparchive.conf
-       sed "s/@dist@/$dist/g" <${confdir}/${F}.in >$F
+       sed "s/@dist@/$dist/g" <${confdir}/${F}.in |sed "s/@architectures@/${architectures}/g" > $F
        # Don't know if clean is needed!
        # apt-ftparchive clean apt-ftparchive.conf
        apt-ftparchive generate apt-ftparchive.conf
+       echo "Done generate $dist"
 
        # release
        r=dists/$dist/Release
        F=apt-release.conf
-       sed "s/@dist@/$dist/g" <${confdir}/${F}.in >$F
+       sed "s/@dist@/$dist/g" <${confdir}/${F}.in | sed "s/@architectures@/${architectures}/g" >$F
        # Move Release file away while calling using release 
        rm $r
        apt-ftparchive -c $F release dists/$dist >tmp_Release
        mv tmp_Release $r
 
        # sign
-       r=dists/$dist/Release
-       rm -f ${r}.gpg
-       gpg --sign -u "Index Data" -ba -o ${r}.gpg dists/$dist/Release
-
-       # Make symlinks to make old sources list work (makedeb.sh compat)
-       F=dists/indexdata/$dist
-       if test ! -d $F; then
-               mkdir -p $F
-       fi
-       F=dists/indexdata/$dist/released
-       if test ! -d $F; then
-               ln -s /home/ftp/pub/debian/dists/$dist/main $F 
+       if true; then
+               r=dists/$dist/Release
+               rm -f ${r}.gpg
+               gpg --sign -u "Index Data" -ba -o ${r}.gpg dists/$dist/Release
        fi
 done
 # Local Variables: