2004-10-31 00:10:42 -01:00
|
|
|
#!/bin/bash
|
2000-12-05 19:53:24 -01:00
|
|
|
#
|
2001-05-25 00:02:55 +00:00
|
|
|
# $Id$
|
2000-12-05 19:53:24 -01:00
|
|
|
#
|
|
|
|
# (c) Steve McIntyre <stevem@chiark.greenend.org.uk> Released under
|
2001-02-07 10:08:22 -01:00
|
|
|
# GNU GPL v2 1st January 2001
|
2000-12-05 19:53:24 -01:00
|
|
|
#
|
|
|
|
# Quick and dirty script to create update CDs for people to upgrade
|
2007-04-10 23:46:26 +00:00
|
|
|
# from an initial stable release (r0) to the latest point release level
|
2001-02-07 10:08:22 -01:00
|
|
|
#
|
2004-10-31 00:10:42 -01:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2000-12-05 19:53:24 -01:00
|
|
|
# Configuration goes here.
|
2004-10-31 00:10:42 -01:00
|
|
|
|
2000-12-05 19:53:24 -01:00
|
|
|
# Where is your mirror?
|
2007-02-20 22:05:34 -01:00
|
|
|
MIRROR_NORM=/org/cdbuilder.debian.org/src/ftp/debian
|
|
|
|
MIRROR_AMD64=/org/cdbuilder.debian.org/src/ftp/debian-amd64/debian
|
2000-12-05 19:53:24 -01:00
|
|
|
|
|
|
|
# If you have a non-US mirror, where is it? Leave blank if you don't have one.
|
2005-12-19 18:05:23 -01:00
|
|
|
# NONUS=${NONUS:-/mirror/debian-non-US}
|
2000-12-05 19:53:24 -01:00
|
|
|
|
|
|
|
# Do you want non-free? 1 for yes, 0 for no
|
2006-10-05 23:12:22 +00:00
|
|
|
NONFREE=0
|
2000-12-05 19:53:24 -01:00
|
|
|
|
|
|
|
# What release version is this?
|
2007-09-01 22:58:48 +00:00
|
|
|
VER=4.0r1
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2005-12-19 21:39:10 -01:00
|
|
|
# Is this an official CD?
|
|
|
|
OFFICIAL=Official
|
|
|
|
# OFFICIAL="Unofficial snapshot"
|
|
|
|
|
2000-12-05 19:53:24 -01:00
|
|
|
# Path to use with mkisofs/mkhybrid
|
2005-12-19 18:05:23 -01:00
|
|
|
#MKISOFS=${MKISOFS:-"mkhybrid"}
|
2007-02-20 22:05:34 -01:00
|
|
|
MKISOFS=$PWD/../mkisofs/usr/bin/mkisofs
|
2004-10-31 00:10:42 -01:00
|
|
|
|
|
|
|
# Use JTE extensions to mkisofs to make jigdo files?
|
|
|
|
JTE=1
|
2000-12-05 19:53:24 -01:00
|
|
|
|
|
|
|
# The working directory to use. MUST be on the same partition as the mirror.
|
2007-09-01 22:58:48 +00:00
|
|
|
TDIR=/org/cdbuilder.debian.org/src/deb-cd/tmp/etch-update/cd-work
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2007-09-01 22:58:48 +00:00
|
|
|
# Building etch cd set ...
|
|
|
|
CODENAME=etch
|
2000-12-05 19:53:24 -01:00
|
|
|
|
|
|
|
# Path where the images will be written
|
2007-09-01 22:58:48 +00:00
|
|
|
OUT=/org/cdbuilder.debian.org/src/deb-cd/tmp/etch-update/cd-out
|
2005-12-19 21:39:10 -01:00
|
|
|
|
|
|
|
# Location(s) for the snapshot(s)
|
|
|
|
SNAPSHOT='Debian=http://us.cdimage.debian.org/cdimage/snapshot/Debian/ --try-last'
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2007-02-20 22:05:34 -01:00
|
|
|
# Type of disc image, cd or dvd (lower case)
|
|
|
|
if [ "$1"x = ""x ] ; then
|
|
|
|
TYPE=cd
|
|
|
|
else
|
|
|
|
TYPE=$1
|
|
|
|
fi
|
|
|
|
case $TYPE in
|
|
|
|
cd|CD)
|
|
|
|
TYPE=cd
|
|
|
|
TYPEUP=CD;;
|
|
|
|
dvd|DVD)
|
|
|
|
TYPE=dvd
|
|
|
|
TYPEUP=DVD;;
|
|
|
|
*)
|
|
|
|
echo "Specify a disk type..."
|
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
|
2001-02-07 10:08:22 -01:00
|
|
|
# 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.
|
2007-09-01 22:58:48 +00:00
|
|
|
DIFF=/home/deb-cd/r0-r1.diff
|
2007-02-20 22:05:34 -01:00
|
|
|
|
|
|
|
if [ "$TYPE" = "cd" ] ; then
|
|
|
|
CDSIZE=610 # megabytes, leaving space for metadata
|
|
|
|
else
|
|
|
|
CDSIZE=4300 # megabytes, leaving space for metadata
|
|
|
|
fi
|
2001-02-07 10:08:22 -01:00
|
|
|
|
2000-12-05 19:53:24 -01:00
|
|
|
REL=Debian"$VER"
|
2002-12-21 11:13:08 -01:00
|
|
|
CLOG=dists/$CODENAME/ChangeLog
|
|
|
|
NUCLOG=dists/$CODENAME/non-US/ChangeLog
|
|
|
|
UPD=$TDIR/$CODENAME-update
|
2000-12-05 19:53:24 -01:00
|
|
|
DATE=`date +%Y%m%d`
|
|
|
|
BASEDIR=`pwd`
|
2002-12-21 11:13:08 -01:00
|
|
|
SECTS="main non-free contrib"
|
|
|
|
VERBOSE=2
|
2004-10-31 00:10:42 -01:00
|
|
|
GRAB_MD5=$BASEDIR/tools/grab_md5
|
2002-12-21 11:13:08 -01:00
|
|
|
export VERBOSE BASEDIR SECTS
|
2002-04-16 00:25:46 +00:00
|
|
|
|
2005-12-19 21:39:10 -01:00
|
|
|
FIRSTVER=`echo $VER | sed 's?r.*$?r0?g'`
|
|
|
|
VERSPACE=`echo $VER | sed 's?r? r?g'`
|
|
|
|
CAPCODE=`perl -e "print ucfirst("$CODENAME")"`
|
|
|
|
|
|
|
|
export FIRSTVER VERSPACE CAPCODE
|
|
|
|
|
2007-02-20 22:05:34 -01:00
|
|
|
if [ "$ARCHLIST"x = ""x ] ; then
|
2007-09-01 22:58:48 +00:00
|
|
|
ARCHLIST="alpha amd64 arm hppa i386 ia64 mips mipsel powerpc s390 sparc source" # amd64 # all dealt with specially
|
2007-02-20 22:05:34 -01:00
|
|
|
fi
|
2000-12-05 19:53:24 -01:00
|
|
|
|
|
|
|
export TDIR NONFREE NONUS VER MIRROR CODENAME OUT BASEDIR
|
|
|
|
|
2004-10-31 00:10:42 -01:00
|
|
|
CDSIZE=$(($CDSIZE * 1024))
|
|
|
|
|
2001-12-16 22:22:11 -01:00
|
|
|
scanpackages=$BASEDIR/tools/scanpackages.old
|
|
|
|
scansources=$BASEDIR/tools/scansources.old
|
2000-12-05 19:53:24 -01:00
|
|
|
set_mkisofs_opts=$BASEDIR/tools/set_mkisofs_opts
|
2001-02-07 10:08:22 -01:00
|
|
|
addfiles=$BASEDIR/tools/add_files
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2002-04-16 00:25:46 +00:00
|
|
|
create_control_files () {
|
|
|
|
CDDIR=$1
|
|
|
|
shift
|
|
|
|
ARCHES=$*
|
|
|
|
echo " Creating control files for \"$ARCHES\" on $CDDIR"
|
|
|
|
for ARCH in $ARCHES
|
|
|
|
do
|
|
|
|
case "$ARCH" in
|
2005-12-19 18:05:23 -01:00
|
|
|
source)
|
|
|
|
echo " source"
|
2002-12-21 11:13:08 -01:00
|
|
|
for SECT in $SECTS
|
|
|
|
do
|
|
|
|
mkdir -p $CDDIR/dists/$CODENAME/$SECT/source
|
|
|
|
mkdir -p $CDDIR/dists/$CODENAME/non-US/$SECT/source
|
|
|
|
done
|
2002-12-21 11:34:10 -01:00
|
|
|
cd $UPD
|
2002-04-16 00:25:46 +00:00
|
|
|
$scansources $CDDIR >/dev/null 2>&1
|
|
|
|
;;
|
|
|
|
all)
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo " $ARCH"
|
2002-12-21 11:13:08 -01:00
|
|
|
for SECT in $SECTS
|
|
|
|
do
|
|
|
|
mkdir -p $CDDIR/dists/$CODENAME/$SECT/binary-$ARCH
|
|
|
|
mkdir -p $CDDIR/dists/$CODENAME/non-US/$SECT/binary-$ARCH
|
|
|
|
done
|
2007-02-20 22:05:34 -01:00
|
|
|
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
|
2002-04-16 00:25:46 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2004-10-31 00:10:42 -01:00
|
|
|
copy_file () {
|
|
|
|
ROOTDIR=$1
|
|
|
|
shift
|
|
|
|
FILE=$1
|
2008-11-02 01:55:34 -01:00
|
|
|
DIR=`dirname $FILE`
|
2004-10-31 00:10:42 -01:00
|
|
|
if [ ! -d $ROOTDIR/$DIR ] ; then
|
|
|
|
mkdir -p $ROOTDIR/$DIR
|
|
|
|
fi
|
|
|
|
if [ -e $MIRROR/$FILE ] ; then
|
|
|
|
cp -l $MIRROR/$FILE $ROOTDIR/$FILE
|
|
|
|
elif [ -e $NONUS/$FILE ] ; then
|
|
|
|
cp -l $NONUS/$FILE $ROOTDIR/$FILE
|
|
|
|
else
|
|
|
|
echo
|
|
|
|
echo "File $FILE not found!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
make_cd () {
|
|
|
|
CDNUM=$1
|
|
|
|
shift
|
|
|
|
THISNUM=$1
|
|
|
|
shift
|
|
|
|
THISARCH=$1
|
|
|
|
shift
|
|
|
|
SRCFILES=$1
|
|
|
|
shift
|
|
|
|
ARCHFILES=$1
|
|
|
|
shift
|
|
|
|
ALLFILES=$1
|
|
|
|
echo
|
|
|
|
echo " Creating Packages and Sources files for CD$CDNUM"
|
|
|
|
cd $UPD
|
|
|
|
create_control_files CD$CDNUM $THISARCH
|
|
|
|
echo " Creating image for CD$CDNUM ($SRCFILES source files, $ARCHFILES $ARCH debs, $ALLFILES all debs)"
|
|
|
|
echo -n " "
|
2007-02-20 22:05:34 -01:00
|
|
|
if [ ! -d $OUT/$THISARCH/iso-$TYPE ] ; then
|
|
|
|
mkdir -p $OUT/$THISARCH/iso-$TYPE
|
|
|
|
fi
|
2004-10-31 00:10:42 -01:00
|
|
|
if [ $JTE = 1 ] ; then
|
2007-02-20 22:05:34 -01:00
|
|
|
if [ ! -d $OUT/$THISARCH/jigdo-$TYPE ] ; then
|
|
|
|
mkdir -p $OUT/$THISARCH/jigdo-$TYPE
|
|
|
|
fi
|
2007-09-01 22:58:48 +00:00
|
|
|
${MKISOFS} -J -r -V "Debian $VER update $TYPEUP" -o \
|
|
|
|
$OUT/$THISARCH/iso-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.iso \
|
|
|
|
-jigdo-jigdo $OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.jigdo \
|
|
|
|
-jigdo-template $OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.template \
|
2004-10-31 00:10:42 -01:00
|
|
|
-jigdo-map Debian=$MIRROR/ \
|
|
|
|
-jigdo-map Non-US=$NONUS/ \
|
|
|
|
-jigdo-force-md5 /pool/ \
|
|
|
|
-md5-list $UPD/md5-check \
|
|
|
|
$UPD/CD$CDNUM 2>&1 | grep "extents written"
|
2005-12-19 21:39:10 -01:00
|
|
|
$BASEDIR/tools/jigdo_cleanup \
|
2007-09-01 22:58:48 +00:00
|
|
|
$OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.jigdo \
|
|
|
|
debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.iso \
|
|
|
|
$OUT debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.template \
|
2007-02-20 22:05:34 -01:00
|
|
|
"Debian GNU/Linux $VERSPACE - $OFFICIAL $THISARCH $FIRSTVER->$VER update $TYPEUP #$THISNUM"
|
2007-09-01 22:58:48 +00:00
|
|
|
echo $SNAPSHOT >> $OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.jigdo
|
2010-07-02 22:43:46 +00:00
|
|
|
# Make sure that the ISO is as new/newer than the jigdo file; #587774
|
|
|
|
touch $OUT/$THISARCH/iso-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.iso
|
2004-10-31 00:10:42 -01:00
|
|
|
else
|
2007-09-01 22:58:48 +00:00
|
|
|
${MKISOFS} -J -r -V "Debian $VER update $TYPEUP" -o \
|
2010-07-02 22:12:51 +00:00
|
|
|
$OUT/iso-$TYPE/$CODENAME-update-$THISARCH-$TYPEUP-$THISNUM.iso \
|
2004-10-31 00:10:42 -01:00
|
|
|
$UPD/CD$CDNUM 2>&1 | grep "extents written"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-12-05 19:53:24 -01:00
|
|
|
echo Cleaning up
|
|
|
|
rm -rf $UPD
|
2005-12-19 18:05:23 -01:00
|
|
|
mkdir -p $UPD
|
2002-12-23 09:03:45 -01:00
|
|
|
CDNUM=1
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2004-10-31 00:10:42 -01:00
|
|
|
echo Creating file list
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2004-10-31 00:10:42 -01:00
|
|
|
if [ ! -e $DIFF ] ; then
|
|
|
|
echo "NO DIFF FOUND. ABORT!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2004-10-31 00:10:42 -01:00
|
|
|
cp $DIFF $UPD/list
|
|
|
|
if [ "$NONUS"x == ""x ] ; then
|
|
|
|
echo "Removing non-US files from the list"
|
|
|
|
grep -v non-US $UPD/list > $UPD/list1
|
|
|
|
mv -f $UPD/list1 $UPD/list
|
|
|
|
fi
|
|
|
|
if [ "$NONFREE"x != "1"x ] ; then
|
|
|
|
echo "Removing non-free files from the list"
|
|
|
|
grep -v non-free $UPD/list > $UPD/list1
|
|
|
|
mv -f $UPD/list1 $UPD/list
|
2000-12-05 19:53:24 -01:00
|
|
|
fi
|
|
|
|
|
2002-12-23 09:03:45 -01:00
|
|
|
for THISARCH in $ARCHLIST
|
|
|
|
do
|
2004-10-31 00:10:42 -01:00
|
|
|
THISNUM=0
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2007-09-01 22:58:48 +00:00
|
|
|
MIRROR=$MIRROR_NORM
|
2005-12-19 18:05:23 -01:00
|
|
|
|
2004-10-31 00:10:42 -01:00
|
|
|
rm -f $UPD/md5-check
|
2007-09-01 22:58:48 +00:00
|
|
|
$GRAB_MD5 $MIRROR $THISARCH $CODENAME $CODENAME $UPD/md5-check
|
2004-10-31 00:10:42 -01:00
|
|
|
if [ "$NONUS"x != ""x ] ; then
|
2007-09-01 22:58:48 +00:00
|
|
|
$GRAB_MD5 $NONUS $THISARCH $CODENAME $CODENAME $UPD/md5-check
|
2004-10-31 00:10:42 -01:00
|
|
|
fi
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2004-10-31 00:10:42 -01:00
|
|
|
for file in `cat $UPD/list`
|
|
|
|
do
|
|
|
|
if [ ! -d $UPD/CD$CDNUM ] ; then
|
|
|
|
echo
|
|
|
|
cd $MIRROR
|
|
|
|
THISNUM=$((THISNUM + 1))
|
2005-12-19 18:05:23 -01:00
|
|
|
if [ $THISARCH = "source" ] ; then
|
2007-09-01 22:58:48 +00:00
|
|
|
echo "Creating $TYPEUP$CDNUM for source (part $THISNUM)"
|
2004-10-31 00:10:42 -01:00
|
|
|
else
|
2007-09-01 22:58:48 +00:00
|
|
|
echo "Creating $TYPEUP$CDNUM for binary-$THISARCH (part $THISNUM)"
|
2004-10-31 00:10:42 -01:00
|
|
|
fi
|
|
|
|
mkdir $UPD/CD$CDNUM $UPD/CD$CDNUM/.disk
|
2007-09-01 22:58:48 +00:00
|
|
|
INFO="Debian GNU/Linux $VER Update $TYPEUP $DATE: $THISARCH $TYPEUP $THISNUM"
|
2004-10-31 00:10:42 -01:00
|
|
|
echo $INFO > $UPD/CD$CDNUM/.disk/info
|
|
|
|
SIZE_USED=0
|
|
|
|
SRCFILES=0
|
|
|
|
ARCHFILES=0
|
|
|
|
ALLFILES=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
SIZE_USED=`du -sk $UPD/CD$CDNUM | awk '{print $1}'`
|
|
|
|
|
|
|
|
if [ $SIZE_USED -gt $CDSIZE ] ; then
|
|
|
|
make_cd $CDNUM $THISNUM $THISARCH $SRCFILES $ARCHFILES $ALLFILES
|
|
|
|
CDNUM=$(($CDNUM + 1))
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$THISARCH" in
|
2005-12-19 18:05:23 -01:00
|
|
|
source)
|
2004-10-31 00:10:42 -01:00
|
|
|
case "$file" in
|
|
|
|
*.gz|*.dsc)
|
|
|
|
copy_file $UPD/CD$CDNUM $file
|
|
|
|
SRCFILES=$(($SRCFILES + 1))
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo -en "\r$SRCFILES copied"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
case "$file" in
|
|
|
|
*_$THISARCH.deb)
|
|
|
|
copy_file $UPD/CD$CDNUM $file
|
|
|
|
ARCHFILES=$(($ARCHFILES + 1))
|
|
|
|
;;
|
|
|
|
*_all.deb)
|
|
|
|
copy_file $UPD/CD$CDNUM $file
|
|
|
|
ALLFILES=$(($ALLFILES + 1))
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo -en "\r$THISARCH:$ARCHFILES all:$ALLFILES copied"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
make_cd $CDNUM $THISNUM $THISARCH $SRCFILES $ARCHFILES $ALLFILES
|
|
|
|
CDNUM=$(($CDNUM + 1))
|
|
|
|
done
|
2000-12-05 19:53:24 -01:00
|
|
|
|