From 835ad6324111fc68d2196a0b39b3861592a655f9 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 23 Feb 2015 10:06:29 +0000 Subject: [PATCH] Add option --suffix and --noauto for separating archives SA-458 --- update-archive/update-archive.sh | 47 ++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/update-archive/update-archive.sh b/update-archive/update-archive.sh index ba479ff..740fefb 100755 --- a/update-archive/update-archive.sh +++ b/update-archive/update-archive.sh @@ -9,6 +9,8 @@ Usage: update-archive.sh [OPTIONS] Options: [--debian=distros] [--ubuntu=distros] + [--suffix=dist-suffix] + [--noauto] [--clear] EOF exit $1 @@ -16,6 +18,8 @@ EOF do_help=false clear=false +noauto=false +suffix="" while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; @@ -31,6 +35,12 @@ while test $# -gt 0; do --ubuntu=*) UBUNTU_DIST=$optarg ;; + --suffix=*) + suffix="$optarg" + ;; + --noauto) + noauto=true + ;; -*) do_help=true ;; @@ -94,6 +104,10 @@ 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 @@ -110,7 +124,7 @@ for vdist in $DISTRIBUTIONS ; do sections="" for section in main restricted; do # Prepare pool - d=pool/dists/$dist/$section + d=pool/dists/$fdist/$section if test ! -d $d; then mkdir -p $d; fi mkdir -p $d/source # Remove invalid symlinks (source, i386, amd64,..) @@ -160,48 +174,51 @@ for vdist in $DISTRIBUTIONS ; do sections="$sections $section" fi for arch in $architectures; do - d=dists/$dist/$section/binary-$arch + d=dists/$fdist/$section/binary-$arch if test ! -d $d; then mkdir -p $d; fi - echo "Archive: $dist" >$d/Release + echo "Archive: $fdist" >$d/Release echo "Component: $section" >>$d/Release echo 'Origin: Indexdata' >>$d/Release echo "Architecture: $arch" >>$d/Release done - d=dists/$dist/$section/source + d=dists/$fdist/$section/source if test ! -d $d; then mkdir -p $d; fi - echo "Archive: $dist" >$d/Release + echo "Archive: $fdist" >$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" + echo "Begin Generate $fdist: $sections" F=apt-ftparchive.conf - sed "s/@dist@/$dist/g" <${confdir}/${F}.in | \ + sed "s/@dist@/$fdist/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 2>&1 - echo "Done generate $dist: $sections" + echo "Done generate $fdist: $sections" # release - r=dists/$dist/Release + r=dists/$fdist/Release F=apt-release.conf - sed "s/@dist@/$dist/g" <${confdir}/${F}.in | \ + sed "s/@dist@/$fdist/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 + rm -f $r + 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 # sign if true; then - r=dists/$dist/Release 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: -- 1.7.10.4