X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=update-archive%2Fupdate-archive.sh;h=2939f222b68ce67baa78ae72a8019b60d4184c2c;hb=6e4ef255ce662c160dcd89aa26d2f3a933b7c843;hp=c8da2edc4815d8a7a53513eb3a107536593d108b;hpb=99b863e0ed22ba5bd63ca0b0fdcbc657c4163a8c;p=git-tools-moved-to-github.git diff --git a/update-archive/update-archive.sh b/update-archive/update-archive.sh index c8da2ed..2939f22 100755 --- a/update-archive/update-archive.sh +++ b/update-archive/update-archive.sh @@ -1,9 +1,61 @@ #!/bin/sh -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 ! -f ${confdir}/apt-ftparchive.conf.in; then + echo "$0: ${condir}/apt-ftparchive.conf.in not found" + exit 1 +fi if test ! -x /usr/bin/apt-ftparchive; then echo "$0: /usr/bin/apt-ftparchive missing. Install apt-utils" exit 1 @@ -11,12 +63,46 @@ fi # gpg -a -d -o Release.gpg Release -confdir=`pwd` - architectures="i386 amd64" -for vdist in ubuntu/gutsy ubuntu/hardy ubuntu/intrepid ubuntu/jaunty ubuntu/karmic debian/squeeze debian/lenny debian/etch; do +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 + +# All distributions we know of +ALLD="ubuntu/lucid ubuntu/natty ubuntu/oneiric ubuntu/precise ubuntu/quantal ubuntu/raring ubuntu/saucy ubuntu/trusty ubuntu/utopic ubuntu/vivid ubuntu/wily ubuntu/xenial 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 +fi + +echo "DISTRIBUTIONS=$DISTRIBUTIONS" +for vdist in $DISTRIBUTIONS ; do dist=`basename $vdist` + fdist=${dist} + if test -n "${suffix}"; then + fdist="${fdist}-${suffix}" + fi vendor=`dirname $vdist` ftpdir=/home/ftp/pub/$vendor if test ! -d $ftpdir; then @@ -24,15 +110,17 @@ for vdist in ubuntu/gutsy ubuntu/hardy ubuntu/intrepid ubuntu/jaunty ubuntu/karm exit 1 fi cd $ftpdir - test -d tmp || mkdir tmp + mkdir -p tmp # Uncomment to clean the .db (cache) - # rm tmp/* + if $clear; then + rm tmp/* + fi sections="" for section in main restricted; do # Prepare pool - d=pool/dists/$dist/$section - if test ! -d $d; then mkdir -p $d; fi + d=pool/dists/$fdist/$section + mkdir -p $d mkdir -p $d/source # Remove invalid symlinks (source, i386, amd64,..) for l in $d/*/*; do @@ -55,8 +143,9 @@ for vdist in ubuntu/gutsy ubuntu/hardy ubuntu/intrepid ubuntu/jaunty ubuntu/karm if $use; then distdir=$pdir/$vendor/$dist if test -d $distdir; then - ln -sf $distdir/*.dsc $d/source - ln -sf $distdir/*.gz $d/source + 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 \ @@ -71,7 +160,6 @@ for vdist in ubuntu/gutsy ubuntu/hardy ubuntu/intrepid ubuntu/jaunty ubuntu/karm fi fi done - # ${confdir}/symclean.sh $d rm -f $d/Release if $has_packages; then @@ -81,53 +169,42 @@ for vdist in ubuntu/gutsy ubuntu/hardy ubuntu/intrepid ubuntu/jaunty ubuntu/karm 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 + d=dists/$fdist/$section/binary-$arch + mkdir -p $d + echo "Archive: $fdist" >$d/Release echo "Component: $section" >>$d/Release - echo 'Origin: Indexdata' >>$d/Release + echo 'Origin: Index Data' >>$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 + d=dists/$fdist/$section/source + mkdir -p $d + echo "Archive: $fdist" >$d/Release echo "Component: $section" >>$d/Release - echo 'Origin: Indexdata' >>$d/Release + echo 'Origin: Index Data' >>$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 | \ - 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 - echo "Done generate $dist: $sections" - - # release - r=dists/$dist/Release - F=apt-release.conf - 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 - if true; then - r=dists/$dist/Release + if test -n "$sections"; then + F=apt-ftparchive.conf + sed "s/@dist@/$fdist/g" <${confdir}/${F}.in | \ + sed "s/@architectures@/${architectures}/g" | \ + sed "s/@sections@/${sections}/g" > $F + apt-ftparchive generate apt-ftparchive.conf 2>&1 + r=dists/$fdist/Release + rm -f $r # Move Release file away while calling using release + apt-ftparchive -c $F release dists/$fdist >tmp_Release + if $noauto; then + sed -e 's/^Suite:/NotAutomatic: yes\nButAutomaticUpgrades: yes\nSuite:/g' $r + else + mv tmp_Release $r + fi rm -f ${r}.gpg - gpg --sign -u "Index Data" -ba -o ${r}.gpg dists/$dist/Release + gpg --sign -u "Index Data" -ba -o ${r}.gpg $r fi done # Local Variables: # mode:shell-script -# sh-indentation: 2 +# sh-indentation: 8 # sh-basic-offset: 8 # End: