Check for file size on update CD/DVD generation

This commit is contained in:
Steve McIntyre 2015-09-07 15:53:45 +01:00
parent cea7b3cd42
commit 4dcc8bd94c
1 changed files with 20 additions and 14 deletions

View File

@ -310,21 +310,27 @@ do
BACKOUT_FILE="" BACKOUT_FILE=""
fi 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}'` 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 fi
done done