#!/bin/sh # # $Id$ # # (c) Steve McIntyre Released under # GNU GPL v2 1st January 2001 # # Quick and dirty script to create update CDs for people to upgrade # from potato (2.2r0) to the latest release level # # Configuration goes here. # Where is your mirror? MIRROR=${MIRROR:-/mirror/debian} # If you have a non-US mirror, where is it? Leave blank if you don't have one. NONUS=${NONUS:-$MIRROR/non-US} # Do you want non-free? 1 for yes, 0 for no NONFREE=1 # What release version is this? VER=3.0r1 # Path to use with mkisofs/mkhybrid MKISOFS=${MKISOFS:-"mkhybrid"} # The working directory to use. MUST be on the same partition as the mirror. TDIR=/mirror/debian-cd # Building woody cd set ... CODENAME=woody # Path where the images will be written OUT=/mirror/debian-cd # Location of the diff file to use to determine the changes. If you leave # this blank, we'll try to determine the changes from the ChangeLog files, # which is probably less accurate. DIFF=/mirror/lists/$CODENAME/r0-r1.diff #~/r2.diff REL=Debian"$VER" CLOG=dists/$CODENAME/ChangeLog NUCLOG=dists/$CODENAME/non-US/ChangeLog UPD=$TDIR/$CODENAME-update DATE=`date +%Y%m%d` BASEDIR=`pwd` SECTS="main non-free contrib" VERBOSE=2 export VERBOSE BASEDIR SECTS # The full update will not fit on a single CD, so split it arbitrarily # CD 1 gets arm/i386/source # CD 2 gets alpha/m68k/powerpc # CD 3 gets sparc # binary-all goes on all 3 INFO1="Debian GNU/Linux $VER Update CD $DATE: Alpha, Arm, HPPA, I386, IA64, M68k and Source" INFO2="Debian GNU/Linux $VER Update CD $DATE: Mips, Mipsel, Powerpc, S390, Sparc and Source" ARCH1="alpha arm hppa i386 ia64 m68k src all" ARCH2="mips mipsel powerpc s390 sparc src all" export TDIR NONFREE NONUS VER MIRROR CODENAME OUT BASEDIR scanpackages=$BASEDIR/tools/scanpackages.old scansources=$BASEDIR/tools/scansources.old set_mkisofs_opts=$BASEDIR/tools/set_mkisofs_opts addfiles=$BASEDIR/tools/add_files adddirs () { ROOTDIR=$1 shift FILELIST=$1 for FILE in `cat $FILELIST` do DIR=`echo $FILE | sed 's?/[-_\.A-Za-z0-9\+]*$??'` if [ ! -d $ROOTDIR/$DIR ] ; then mkdir -p $ROOTDIR/$DIR fi done } copy_trees () { CDDIR=$1 shift SRCLIST=$1 shift BINLIST=$1 shift ARCHES=$* echo " Copying \"$ARCHES\" files into $UPD/$CDDIR" for ARCH in $ARCHES do case "$ARCH" in src) NUM=`cat $SRCLIST | wc -l` if [ $NUM -gt 0 ] ; then echo " $ARCH into $UPD/$CDDIR" adddirs $UPD/$CDDIR $SRCLIST cat $SRCLIST | xargs $addfiles $UPD/$CDDIR $MIRROR else echo " No updates needed for $ARCH" fi ;; *) NUM=`cat $BINLIST | grep _$ARCH.deb | wc -l` if [ $NUM -gt 0 ] ; then echo " $ARCH into $UPD/$CDDIR" adddirs $UPD/$CDDIR $BINLIST cat $BINLIST | grep _$ARCH.deb | xargs $addfiles $UPD/$CDDIR $MIRROR else echo " No updates needed for $ARCH" fi ;; esac done } create_control_files () { CDDIR=$1 shift ARCHES=$* echo " Creating control files for \"$ARCHES\" on $CDDIR" for ARCH in $ARCHES do case "$ARCH" in src) echo " src" for SECT in $SECTS do mkdir -p $CDDIR/dists/$CODENAME/$SECT/source mkdir -p $CDDIR/dists/$CODENAME/non-US/$SECT/source done cd $CDDIR $scansources $CDDIR >/dev/null 2>&1 ;; all) ;; *) echo " $ARCH" for SECT in $SECTS do mkdir -p $CDDIR/dists/$CODENAME/$SECT/binary-$ARCH mkdir -p $CDDIR/dists/$CODENAME/non-US/$SECT/binary-$ARCH done ARCH=$ARCH $scanpackages scan $CDDIR >/dev/null 2>&1 ARCH=$ARCH $scanpackages -noPackages.cd install $CDDIR >/dev/null 2>&1 rm -f $CDDIR/*.Packages* #>/dev/null 2>&1 ;; esac done } echo Cleaning up rm -rf $UPD mkdir $UPD $UPD/CD1 $UPD/CD2 cd $MIRROR echo Creating main-section list if [ -e $DIFF ] ; then grep -v non-US $DIFF >$UPD/list egrep -e \\.deb$ $UPD/list >$UPD/bin-list egrep -e \\.gz$ -e \\.dsc$ $UPD/list >$UPD/src-list else egrep -e ^dists.*\\.deb$ $CLOG >$UPD/bin-list egrep -e \\.gz$ -e \\.dsc$ $CLOG >$UPD/src-list fi if [ "$NONFREE"x != "1"x ] ; then echo Removing non-free grep -v non-free $UPD/bin-list > $UPD/bin-list1 mv -f $UPD/bin-list1 $UPD/bin-list grep -v non-free $UPD/src-list > $UPD/src-list1 mv -f $UPD/src-list1 $UPD/src-list fi echo Creating trees copy_trees CD1 $UPD/src-list $UPD/bin-list $ARCH1 copy_trees CD2 $UPD/src-list $UPD/bin-list $ARCH2 if [ "$NONUS"x != ""x ] ; then echo Creating non-US list cd $NONUS if [ -e $DIFF ] ; then grep non-US $DIFF >$UPD/nu-list egrep -e \\.deb$ $UPD/nu-list >$UPD/bin-nu-list egrep -e ^dists.*\\.gz$ -e ^dists.*\\.dsc$ $UPD/nu-list >$UPD/src-nu-list else egrep -e ^dists.*\\.deb$ $NUCLOG | sed 's?^stable?dists/potato?g' > $UPD/bin-nu-list egrep -e ^dists.*\\.gz$ -e ^dists.*\\.dsc$ $NUCLOG | sed 's?^stable?dists/potato?g' > $UPD/src-nu-list fi if [ "$NONFREE"x != "1"x ] ; then echo Removing non-free grep -v non-free $UPD/bin-nu-list > $UPD/bin-nu-list1 mv -f $UPD/bin-nu-list1 $UPD/bin-nu-list grep -v non-free $UPD/src-nu-list > $UPD/src-nu-list1 mv -f $UPD/src-nu-list1 $UPD/src-nu-list fi echo Creating non-US trees copy_trees CD1 $UPD/src-nu-list $UPD/bin-nu-list $ARCH1 copy_trees CD2 $UPD/src-nu-list $UPD/bin-nu-list $ARCH2 fi echo Creating .disk/info files mkdir $UPD/CD1/.disk $UPD/CD2/.disk echo $INFO1 > $UPD/CD1/.disk/info echo $INFO2 > $UPD/CD2/.disk/info cd $UPD echo Creating Packages and Sources files create_control_files CD1 $ARCH1 create_control_files CD2 $ARCH2 echo Creating images echo " CD1:" ${MKISOFS} -J -r -V "Debian $VER update CD" -o $OUT/$CODENAME-update-1.raw $UPD/CD1 2>&1 | grep "extents written" echo " CD2:" ${MKISOFS} -J -r -V "Debian $VER update CD" -o $OUT/$CODENAME-update-2.raw $UPD/CD2 2>&1 | grep "extents written" #echo " CD3:" #${MKISOFS} -J -r -V "Debian $VER update CD" -o $OUT/$CODENAME-update-3.raw $UPD/CD3 2>&1 | grep "extents written"