X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=update-archive%2Fupdate-archive.sh;h=ba479ff0f8789fc93144e9cc662594aa09917c22;hb=ea81219434763b72d3f80541ea081c47de6ff429;hp=03d3fe8053af96e984563f5aa77b085805043ed7;hpb=4899d5ff358df3d3a668e3439b834b8800e97ae5;p=git-tools-moved-to-github.git diff --git a/update-archive/update-archive.sh b/update-archive/update-archive.sh index 03d3fe8..ba479ff 100755 --- a/update-archive/update-archive.sh +++ b/update-archive/update-archive.sh @@ -1,92 +1,207 @@ #!/bin/sh -# $Id: update-archive.sh,v 1.12 2007-11-11 19:47: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 +D0=`dirname $0` +confdir=`cd $D0; pwd` + +usage() +{ + cat <&1 fi -if test ! -x /usr/bin/apt-ftparchive; then - echo "$0: /usr/bin/apt-ftparchive missing. Install apt-utils" +if test ! -f ${confdir}/apt-ftparchive.conf.in; then + echo "$0: ${condir}/apt-ftparchive.conf.in not found" exit 1 fi - -if test -z "$1"; then - debiandir=/home/ftp/pub/debian -else - debiandir=$1 +if test ! -f ${confdir}/apt-release.conf.in; then + echo "$0: ${condir}/apt-release.conf.in not found" + exit 1 fi -if test ! -d "$debiandir"; then - echo "$0: The specified '$debiandir' is not a directory" +if test ! -x /usr/bin/apt-ftparchive; then + echo "$0: /usr/bin/apt-ftparchive missing. Install apt-utils" exit 1 fi - # gpg -a -d -o Release.gpg Release + +architectures="i386 amd64" -confdir=`pwd` -cd $debiandir +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 -for dist in lenny etch sarge woody; do - # Make symlinks from the regular FTP archive - d=pool/$dist - if test ! -d $d; then mkdir -p $d; fi - for l in $d/*; do - if test -L $l; then - if test -f $l; then - : - else - rm $l +# All distributions we know of +ALLD="ubuntu/lucid ubuntu/natty ubuntu/oneiric ubuntu/precise ubuntu/quantal ubuntu/raring ubuntu/saucy ubuntu/trusty ubuntu/utopic debian/jessie debian/wheezy debian/squeeze debian/lenny" + +if test -z "$DISTRIBUTIONS"; then + DISTRIBUTIONS=$ALLD +else + 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 - ln -sf /home/ftp/pub/*/debian/$dist/* $d - - # ${confdir}/symclean.sh $d +fi - 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 +echo "DISTRIBUTIONS=$DISTRIBUTIONS" +for vdist in $DISTRIBUTIONS ; 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) + if $clear; then + rm tmp/* + fi - d=dists/$dist/main/source - 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: source' >>$d/Release + 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 + rm -f $d/Release + if $has_packages; then + if test -z "$sections"; then + sections="$section" + else + sections="$sections $section" + fi + for arch in $architectures; do + d=dists/$dist/$section/binary-$arch + if test ! -d $d; then mkdir -p $d; fi + echo "Archive: $dist" >$d/Release + echo "Component: $section" >>$d/Release + echo 'Origin: Indexdata' >>$d/Release + echo "Architecture: $arch" >>$d/Release + done + d=dists/$dist/$section/source + if test ! -d $d; then mkdir -p $d; fi + echo "Archive: $dist" >$d/Release + echo "Component: $section" >>$d/Release + echo 'Origin: Indexdata' >>$d/Release + echo 'Architecture: source' >>$d/Release + fi + done # generate + echo "Begin Generate $dist: $sections" 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" | \ + sed "s/@sections@/${sections}/g" > $F # Don't know if clean is needed! # apt-ftparchive clean apt-ftparchive.conf - apt-ftparchive generate apt-ftparchive.conf + apt-ftparchive generate apt-ftparchive.conf 2>&1 + echo "Done generate $dist: $sections" # 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" | \ + sed "s/@sections@/${sections}/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: