This commit is contained in:
Steve McIntyre 2011-03-24 12:59:18 +00:00
parent f4ec575c08
commit 68740e244d
1 changed files with 103 additions and 102 deletions

205
update-cd
View File

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