From 71738b0cba9ea763d338c99fd9e5810f6bf0c64c Mon Sep 17 00:00:00 2001 From: Steve McIntyre Date: Mon, 7 Sep 2015 15:55:42 +0100 Subject: [PATCH] Backport: Check for file size on update CD/DVD generation --- debian/changelog | 1 + update-cd | 34 ++++++++++++++++++++-------------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index c504bcfa..c92dd94b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ debian-cd (3.1.17-jessie) UNRELEASED; urgency=medium + tools/start_new_disc: shorten VOLID when possible + tools/boot/jessie/boot-arm: Add kernels and other bits to armel/armhf images + + Check for file size on update CD/DVD generation -- Steve McIntyre <93sam@debian.org> Mon, 20 Apr 2015 12:36:57 +0100 diff --git a/update-cd b/update-cd index cdddd28f..f83b2b46 100755 --- a/update-cd +++ b/update-cd @@ -310,21 +310,27 @@ do BACKOUT_FILE="" fi - add_file $file + size=$(stat -c %s $MIRROR/$file) + size_kib=$(($size / 1024)) + if [ $size_kib -gt $CDSIZE ] ; then + echo "Ignoring file $file - it won't fit!" + else + 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 + 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 fi done