merge update-cd changes back from trunk again

This commit is contained in:
Steve McIntyre 2011-03-24 13:26:39 +00:00
parent b3f1215003
commit c1b1de8ce0
1 changed files with 122 additions and 113 deletions

View File

@ -53,14 +53,14 @@ else
fi
case $TYPE in
cd|CD)
TYPE=cd
TYPEUP=CD;;
TYPE=cd
TYPEUP=CD;;
dvd|DVD)
TYPE=dvd
TYPEUP=DVD;;
TYPE=dvd
TYPEUP=DVD;;
*)
echo "Specify a disk type..."
exit 1;;
echo "Specify a disk type..."
exit 1;;
esac
# Location of the diff file to use to determine the changes. If you leave
@ -110,11 +110,11 @@ copy_file () {
mkdir -p $ROOTDIR/$DIR
fi
if [ -e $MIRROR/$FILE ] ; then
cp -l $MIRROR/$FILE $ROOTDIR/$FILE
cp -l $MIRROR/$FILE $ROOTDIR/$FILE
else
echo
echo "File $FILE not found!"
exit 1
echo
echo "File $FILE not found!"
exit 1
fi
}
@ -136,80 +136,89 @@ make_cd () {
$create_control CD$CDNUM $THISARCH
echo " Creating image for CD$CDNUM ($SRCFILES source files, $ARCHFILES $ARCH debs, $ALLFILES all debs)"
echo -n " "
if [ ! -d $OUT/$THISARCH/iso-$TYPE ] ; then
mkdir -p $OUT/$THISARCH/iso-$TYPE
BASENAME="debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM"
ISODIR=$OUT/$THISARCH/iso-$TYPE
JIGDODIR=$OUT/$THISARCH/jigdo-$TYPE
LISTDIR=$OUT/$THISARCH/list-$TYPE
if [ ! -d ${ISODIR} ] ; then
mkdir -p ${ISODIR}
fi
if [ $JTE = 1 ] && [ ! -d ${JIGDODIR} ] ; then
mkdir -p ${JIGDODIR}
fi
if [ ! -d ${LISTDIR} ] ; then
mkdir -p ${LISTDIR}
fi
if [ $JTE = 1 ] ; then
if [ ! -d $OUT/$THISARCH/jigdo-$TYPE ] ; then
mkdir -p $OUT/$THISARCH/jigdo-$TYPE
fi
${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 \
-jigdo-map Debian=$MIRROR/ \
-jigdo-force-md5 /pool/ \
-md5-list $UPD/md5-check \
$UPD/CD$CDNUM 2>&1 | grep "extents written"
$BASEDIR/tools/jigdo_cleanup \
$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 \
"Debian GNU/Linux $VER - $OFFICIAL $THISARCH $FIRSTVER->$VER update $TYPEUP #$THISNUM"
echo $SNAPSHOT >> $OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.jigdo
# 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
${MKISOFS} -J -r -V "Debian $VER update $TYPEUP" -o \
${ISODIR}/${BASENAME}.iso \
-jigdo-jigdo ${JIGDODIR}/${BASENAME}.jigdo \
-jigdo-template ${JIGDODIR}/${BASENAME}.template \
-jigdo-map Debian=$MIRROR/ \
-jigdo-force-md5 /pool/ \
-md5-list $UPD/md5-check \
$UPD/CD$CDNUM 2>&1 | grep "extents written"
$BASEDIR/tools/jigdo_cleanup \
${JIGDODIR}/${BASENAME}.jigdo \
${BASENAME}.iso \
$OUT ${BASENAME}.template \
"Debian GNU/Linux $VER - $OFFICIAL $THISARCH $FIRSTVER->$VER update $TYPEUP #$THISNUM"
echo $SNAPSHOT >> ${JIGDODIR}/${BASENAME}.jigdo
# Make sure that the ISO is as new/newer than the jigdo file; #587774
touch ${ISODIR}/${BASENAME}.iso
MD5=`cat $OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.jigdo | \
awk '/Image Hex MD5Sum/ {print $5}'`
echo "$MD5 debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.iso" >> $OUT/$THISARCH/jigdo-$TYPE/MD5SUMS.update
echo "$MD5 debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.iso" >> $OUT/$THISARCH/iso-$TYPE/MD5SUMS.update
for SHA_SIZE in 1 256 512; do
SHA=`cat $OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.jigdo | \
awk "/Image Hex SHA${SHA_SIZE}Sum/ {print \\$5}"`
if [ "$SHA"x = ""x ] ; then
echo "SHA fail"
exit 1
fi
echo "$SHA debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.iso" >> $OUT/$THISARCH/jigdo-$TYPE/SHA${SHA_SIZE}SUMS.update
echo "$SHA debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.iso" >> $OUT/$THISARCH/iso-$TYPE/SHA${SHA_SIZE}SUMS.update
done
gzip -9 $OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.jigdo
mv $OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.jigdo.gz \
$OUT/$THISARCH/jigdo-$TYPE/debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM.jigdo
MD5=`cat ${JIGDODIR}/${BASENAME}.jigdo | \
awk '/Image Hex MD5Sum/ {print $5}'`
echo "$MD5 ${BASENAME}.iso" >> ${JIGDODIR}/MD5SUMS.update
echo "$MD5 ${BASENAME}.iso" >> ${ISODIR}/MD5SUMS.update
for SHA_SIZE in 1 256 512; do
SHA=`cat ${JIGDODIR}/${BASENAME}.jigdo | \
awk "/Image Hex SHA${SHA_SIZE}Sum/ {print \\$5}"`
if [ "$SHA"x = ""x ] ; then
echo "SHA fail"
exit 1
fi
echo "$SHA ${BASENAME}.iso" >> ${JIGDODIR}/SHA${SHA_SIZE}SUMS.update
echo "$SHA ${BASENAME}.iso" >> ${ISODIR}/SHA${SHA_SIZE}SUMS.update
done
gzip -9 ${JIGDODIR}/${BASENAME}.jigdo
mv ${JIGDODIR}/${BASENAME}.jigdo.gz ${JIGDODIR}/${BASENAME}.jigdo
else
${MKISOFS} -J -r -V "Debian $VER update $TYPEUP" -o \
$OUT/iso-$TYPE/$CODENAME-update-$THISARCH-$TYPEUP-$THISNUM.iso \
$UPD/CD$CDNUM 2>&1 | grep "extents written"
${MKISOFS} -J -r -V "Debian $VER update $TYPEUP" -o \
$OUT/iso-$TYPE/${BASENAME}.iso \
$UPD/CD$CDNUM 2>&1 | grep "extents written"
fi
find $UPD/CD$CDNUM/pool -type f | sed 's?^.*/??g' | gzip -9 > ${LISTDIR}/${BASENAME}.list.gz
}
add_file () {
file=$1
case "$THISARCH" in
source)
case "$file" in
*.gz|*.bz2|*.dsc)
copy_file $UPD/CD$CDNUM $file
SRCFILES=$(($SRCFILES + 1))
;;
esac
echo -en "\r$SRCFILES copied"
;;
*)
case "$file" in
*_$THISARCH.deb)
source)
case "$file" in
*.gz|*.bz2|*.dsc)
copy_file $UPD/CD$CDNUM $file
ARCHFILES=$(($ARCHFILES + 1))
;;
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"
;;
copy_file $UPD/CD$CDNUM $file
ALLFILES=$(($ALLFILES + 1))
;;
esac
echo -en "\r$THISARCH:$ARCHFILES all:$ALLFILES copied"
;;
esac
}
@ -240,50 +249,50 @@ do
MIRROR=$MIRROR_NORM
rm -rf $OUT/$THISARCH/iso-$TYPE $OUT/$THISARCH/jigdo-$TYPE
rm -rf $OUT/$THISARCH/*-$TYPE
for file in `cat $UPD/list`
do
if [ ! -d $UPD/CD$CDNUM ] ; then
echo
cd $MIRROR
THISNUM=$((THISNUM + 1))
if [ $THISARCH = "source" ] ; then
echo "Creating $TYPEUP$CDNUM for source (part $THISNUM)"
else
echo "Creating $TYPEUP$CDNUM for binary-$THISARCH (part $THISNUM)"
fi
mkdir $UPD/CD$CDNUM $UPD/CD$CDNUM/.disk
INFO="Debian GNU/Linux $VER Update $TYPEUP $DATE: $THISARCH $TYPEUP $THISNUM"
echo $INFO > $UPD/CD$CDNUM/.disk/info
SIZE_USED=0
SRCFILES=0
ARCHFILES=0
ALLFILES=0
fi
if [ ! -d $UPD/CD$CDNUM ] ; then
echo
cd $MIRROR
THISNUM=$((THISNUM + 1))
if [ $THISARCH = "source" ] ; then
echo "Creating $TYPEUP$CDNUM for source (part $THISNUM)"
else
echo "Creating $TYPEUP$CDNUM for binary-$THISARCH (part $THISNUM)"
fi
mkdir $UPD/CD$CDNUM $UPD/CD$CDNUM/.disk
INFO="Debian GNU/Linux $VER Update $TYPEUP $DATE: $THISARCH $TYPEUP $THISNUM"
echo $INFO > $UPD/CD$CDNUM/.disk/info
SIZE_USED=0
SRCFILES=0
ARCHFILES=0
ALLFILES=0
fi
if [ "$BACKOUT_FILE"x != ""x ] ; then
echo "Starting with backed-out file $BACKOUT_FILE"
add_file $BACKOUT_FILE
BACKOUT_FILE=""
fi
if [ "$BACKOUT_FILE"x != ""x ] ; then
echo "Starting with backed-out file $BACKOUT_FILE"
add_file $BACKOUT_FILE
BACKOUT_FILE=""
fi
add_file $file
add_file $file
SIZE_USED=`du -sk $UPD/CD$CDNUM | awk '{print $1}'`
if [ $SIZE_USED -gt $CDSIZE ] ; then
# Back out the last file added
size=`stat -c %s $UPD/CD$CDNUM/$file`
rm -f $UPD/CD$CDNUM/$file
echo
echo " Overfull: back out $file ($size bytes)"
DIR=`dirname $file`
rmdir $DIR > /dev/null 2>&1 || true
BACKOUT_FILE=$file
make_cd $CDNUM $THISNUM $THISARCH $SRCFILES $ARCHFILES $ALLFILES
CDNUM=$(($CDNUM + 1))
continue
fi
SIZE_USED=`du -sk $UPD/CD$CDNUM | awk '{print $1}'`
if [ $SIZE_USED -gt $CDSIZE ] ; then
# Back out the last file added
size=`stat -c %s $UPD/CD$CDNUM/$file`
rm -f $UPD/CD$CDNUM/$file
echo
echo " Overfull: back out $file ($size bytes)"
DIR=`dirname $file`
rmdir $DIR > /dev/null 2>&1 || true
BACKOUT_FILE=$file
make_cd $CDNUM $THISNUM $THISARCH $SRCFILES $ARCHFILES $ALLFILES
CDNUM=$(($CDNUM + 1))
continue
fi
done
make_cd $CDNUM $THISNUM $THISARCH $SRCFILES $ARCHFILES $ALLFILES