2004-10-31 00:10:42 -01:00
|
|
|
#!/bin/bash
|
2000-12-05 19:53:24 -01:00
|
|
|
#
|
2017-08-04 20:12:57 +00:00
|
|
|
# (c) Steve McIntyre <steve@einval.com> 2001-2017
|
|
|
|
# GNU GPL v2
|
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?
|
2017-06-22 16:25:02 +00:00
|
|
|
MIRROR_NORM=/srv/cdbuilder.debian.org/src/ftp/debian
|
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?
|
2017-08-04 20:12:57 +00:00
|
|
|
VER=9.1.0
|
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
|
2018-07-14 12:07:10 +00:00
|
|
|
MKISOFS="genisoimage -jigdo-template-compress bzip2 -r -checksum_algorithm_iso md5,sha1,sha256,sha512"
|
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
|
|
|
|
2015-02-07 22:15:57 -01:00
|
|
|
# Set up torrents too?
|
|
|
|
BT=1
|
|
|
|
|
2000-12-05 19:53:24 -01:00
|
|
|
# The working directory to use. MUST be on the same partition as the mirror.
|
2017-08-04 20:12:57 +00:00
|
|
|
TDIR=/srv/cdbuilder.debian.org/src/deb-cd/tmp/stretch-update/cd-work
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2017-08-04 20:12:57 +00:00
|
|
|
# Building stretch cd set ...
|
|
|
|
CODENAME=stretch
|
2000-12-05 19:53:24 -01:00
|
|
|
|
|
|
|
# Path where the images will be written
|
2017-08-04 20:12:57 +00:00
|
|
|
OUT=/srv/cdbuilder.debian.org/src/deb-cd/tmp/stretch-update/cd-out
|
2005-12-19 21:39:10 -01:00
|
|
|
|
|
|
|
# Location(s) for the snapshot(s)
|
2019-07-05 17:26:43 +00:00
|
|
|
SNAPSHOT='Debian=https://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)
|
2011-03-24 11:59:18 -01:00
|
|
|
TYPE=cd
|
|
|
|
TYPEUP=CD;;
|
2007-02-20 22:05:34 -01:00
|
|
|
dvd|DVD)
|
2011-03-24 11:59:18 -01:00
|
|
|
TYPE=dvd
|
|
|
|
TYPEUP=DVD;;
|
2007-02-20 22:05:34 -01:00
|
|
|
*)
|
2011-03-24 11:59:18 -01:00
|
|
|
echo "Specify a disk type..."
|
|
|
|
exit 1;;
|
2007-02-20 22:05:34 -01:00
|
|
|
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.
|
2017-08-04 20:12:57 +00:00
|
|
|
DIFF=/home/debian-cd/lists/stretch/r0-r2.diff
|
2007-02-20 22:05:34 -01:00
|
|
|
|
|
|
|
if [ "$TYPE" = "cd" ] ; then
|
2011-03-23 16:19:49 -01:00
|
|
|
CDSIZE=644 # megabytes, leaving space for metadata
|
2007-02-20 22:05:34 -01:00
|
|
|
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
|
|
|
|
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
|
|
|
|
2011-03-19 20:53:28 -01:00
|
|
|
FIRSTVER=`echo $VER | cut -c 1-4`0
|
2005-12-19 21:39:10 -01:00
|
|
|
CAPCODE=`perl -e "print ucfirst("$CODENAME")"`
|
|
|
|
|
2011-03-19 20:53:28 -01:00
|
|
|
export FIRSTVER CAPCODE
|
2005-12-19 21:39:10 -01:00
|
|
|
|
2007-02-20 22:05:34 -01:00
|
|
|
if [ "$ARCHLIST"x = ""x ] ; then
|
2018-07-14 12:26:23 +00:00
|
|
|
ARCHLIST="arm64 armel armhf amd64 i386 mips mipsel mips64el ppc64el s390x source" # amd64 # -all dealt with specially
|
2007-02-20 22:05:34 -01:00
|
|
|
fi
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2011-03-23 16:19:49 -01:00
|
|
|
export TDIR NONFREE VER MIRROR CODENAME OUT BASEDIR
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2004-10-31 00:10:42 -01:00
|
|
|
CDSIZE=$(($CDSIZE * 1024))
|
|
|
|
|
2011-03-23 16:19:49 -01:00
|
|
|
create_control=$BASEDIR/tools/create_control
|
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
|
|
|
|
2004-10-31 00:10:42 -01:00
|
|
|
copy_file () {
|
|
|
|
ROOTDIR=$1
|
2011-03-19 20:53:28 -01:00
|
|
|
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
|
2011-03-19 20:53:28 -01:00
|
|
|
if [ -e $MIRROR/$FILE ] ; then
|
2011-03-24 11:59:18 -01:00
|
|
|
cp -l $MIRROR/$FILE $ROOTDIR/$FILE
|
2011-03-19 20:53:28 -01:00
|
|
|
else
|
2011-03-24 11:59:18 -01:00
|
|
|
echo
|
|
|
|
echo "File $FILE not found!"
|
|
|
|
exit 1
|
2011-03-19 20:53:28 -01:00
|
|
|
fi
|
2004-10-31 00:10:42 -01:00
|
|
|
}
|
|
|
|
|
|
|
|
make_cd () {
|
2011-03-19 20:53:28 -01:00
|
|
|
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
|
2011-03-23 16:19:49 -01:00
|
|
|
$create_control CD$CDNUM $THISARCH
|
2011-03-19 20:53:28 -01:00
|
|
|
echo " Creating image for CD$CDNUM ($SRCFILES source files, $ARCHFILES $ARCH debs, $ALLFILES all debs)"
|
|
|
|
echo -n " "
|
2011-03-24 11:11:01 -01:00
|
|
|
|
|
|
|
BASENAME="debian-update-$VER-$THISARCH-$TYPEUP-$THISNUM"
|
|
|
|
ISODIR=$OUT/$THISARCH/iso-$TYPE
|
|
|
|
JIGDODIR=$OUT/$THISARCH/jigdo-$TYPE
|
|
|
|
LISTDIR=$OUT/$THISARCH/list-$TYPE
|
2015-02-07 22:15:57 -01:00
|
|
|
BTDIR=$OUT/$THISARCH/bt-$TYPE
|
2011-03-24 11:11:01 -01:00
|
|
|
|
|
|
|
if [ ! -d ${ISODIR} ] ; then
|
2011-03-24 11:59:18 -01:00
|
|
|
mkdir -p ${ISODIR}
|
2011-03-19 20:53:28 -01:00
|
|
|
fi
|
2011-03-24 11:11:01 -01:00
|
|
|
if [ $JTE = 1 ] && [ ! -d ${JIGDODIR} ] ; then
|
2011-03-24 11:59:18 -01:00
|
|
|
mkdir -p ${JIGDODIR}
|
|
|
|
fi
|
2011-03-24 11:11:01 -01:00
|
|
|
if [ ! -d ${LISTDIR} ] ; then
|
2011-03-24 11:59:18 -01:00
|
|
|
mkdir -p ${LISTDIR}
|
2011-03-24 10:52:58 -01:00
|
|
|
fi
|
2015-02-07 22:15:57 -01:00
|
|
|
if [ $BT = 1 ] && [ ! -d ${BTDIR} ] ; then
|
|
|
|
mkdir -p ${BTDIR}
|
|
|
|
fi
|
2011-03-24 10:52:58 -01:00
|
|
|
|
2011-03-24 12:03:51 -01:00
|
|
|
if [ $JTE = 1 ] ; then
|
2011-07-05 10:46:43 +00:00
|
|
|
set +e
|
2018-02-10 11:11:05 -01:00
|
|
|
${MKISOFS} -J -joliet-long -r -V "Debian $VER update $TYPEUP" -o \
|
2011-03-24 11:59:18 -01:00
|
|
|
${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"
|
2018-07-14 12:05:06 +00:00
|
|
|
# $UPD/CD$CDNUM
|
2011-07-05 10:46:43 +00:00
|
|
|
if [ $? -ne 0 ] ; then
|
|
|
|
echo "${MKISOFS} failed, error $?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set -e
|
2011-03-24 11:59:18 -01:00
|
|
|
$BASEDIR/tools/jigdo_cleanup \
|
|
|
|
${JIGDODIR}/${BASENAME}.jigdo \
|
|
|
|
${BASENAME}.iso \
|
|
|
|
$OUT ${BASENAME}.template \
|
2012-05-30 07:35:23 +00:00
|
|
|
"Debian ${DEBIAN_KERNEL} $VER - $OFFICIAL $THISARCH $FIRSTVER->$VER update $TYPEUP #$THISNUM"
|
2011-03-24 11:59:18 -01:00
|
|
|
echo $SNAPSHOT >> ${JIGDODIR}/${BASENAME}.jigdo
|
2011-03-19 20:53:28 -01:00
|
|
|
|
2019-01-26 20:36:57 -01:00
|
|
|
# Make sure we compres the jigdo file *before* we checksum it
|
|
|
|
gzip -9 ${JIGDODIR}/${BASENAME}.jigdo
|
|
|
|
mv ${JIGDODIR}/${BASENAME}.jigdo.gz ${JIGDODIR}/${BASENAME}.jigdo
|
|
|
|
|
|
|
|
MD5=`zcat ${JIGDODIR}/${BASENAME}.jigdo | \
|
2011-03-24 11:59:18 -01:00
|
|
|
awk '/Image Hex MD5Sum/ {print $5}'`
|
2011-03-24 11:11:01 -01:00
|
|
|
echo "$MD5 ${BASENAME}.iso" >> ${JIGDODIR}/MD5SUMS.update
|
|
|
|
echo "$MD5 ${BASENAME}.iso" >> ${ISODIR}/MD5SUMS.update
|
2018-07-14 12:05:06 +00:00
|
|
|
(cd ${JIGDODIR} && md5sum ${BASENAME}.jigdo ${BASENAME}.template >> MD5SUMS.update)
|
|
|
|
if [ $BT = 1 ]; then
|
|
|
|
~/build.${CODENAME}/mktorrent ${ISODIR}/${BASENAME}.iso
|
|
|
|
echo "$MD5 ${BASENAME}.iso" >> ${BTDIR}/MD5SUMS.update
|
|
|
|
(cd ${BTDIR} && md5sum ${BASENAME}.iso.torrent >> MD5SUMS.update)
|
|
|
|
fi
|
2011-03-24 11:59:18 -01:00
|
|
|
for SHA_SIZE in 1 256 512; do
|
2019-01-26 20:36:57 -01:00
|
|
|
SHA=`zcat ${JIGDODIR}/${BASENAME}.jigdo | \
|
2011-03-24 11:59:18 -01:00
|
|
|
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
|
2018-07-14 12:05:06 +00:00
|
|
|
(cd ${JIGDODIR} && sha${SHA_SIZE}sum ${BASENAME}.jigdo ${BASENAME}.template >> SHA${SHA_SIZE}SUMS.update)
|
|
|
|
if [ $BT = 1 ]; then
|
|
|
|
echo "$SHA ${BASENAME}.iso" >> ${BTDIR}/SHA${SHA_SIZE}SUMS.update
|
|
|
|
(cd ${BTDIR} && sha${SHA_SIZE}sum ${BASENAME}.iso.torrent >> SHA${SHA_SIZE}SUMS.update)
|
|
|
|
fi
|
2011-03-24 11:59:18 -01:00
|
|
|
done
|
2019-01-26 20:36:57 -01:00
|
|
|
|
|
|
|
# Make sure that the ISO is as new/newer than the jigdo file; #587774
|
|
|
|
touch ${ISODIR}/${BASENAME}.iso
|
2011-03-19 20:53:28 -01:00
|
|
|
else
|
2011-07-05 10:46:43 +00:00
|
|
|
set +e
|
2018-02-10 11:11:05 -01:00
|
|
|
${MKISOFS} -J -joliet-long -r -V "Debian $VER update $TYPEUP" -o \
|
2011-03-24 11:59:18 -01:00
|
|
|
$OUT/iso-$TYPE/${BASENAME}.iso \
|
|
|
|
$UPD/CD$CDNUM 2>&1 | grep "extents written"
|
2011-07-05 10:46:43 +00:00
|
|
|
if [ $? -ne 0 ] ; then
|
|
|
|
echo "${MKISOFS} failed, error $?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set -e
|
2011-03-19 20:53:28 -01:00
|
|
|
fi
|
2011-03-24 11:11:01 -01:00
|
|
|
find $UPD/CD$CDNUM/pool -type f | sed 's?^.*/??g' | gzip -9 > ${LISTDIR}/${BASENAME}.list.gz
|
2004-10-31 00:10:42 -01:00
|
|
|
}
|
|
|
|
|
2011-03-19 20:53:28 -01:00
|
|
|
add_file () {
|
|
|
|
file=$1
|
|
|
|
case "$THISARCH" in
|
2011-03-24 11:59:18 -01:00
|
|
|
source)
|
|
|
|
case "$file" in
|
2015-09-07 17:07:23 +00:00
|
|
|
*.xz|*.lzma|*.gz|*.bz2|*.dsc)
|
2011-03-24 11:59:18 -01:00
|
|
|
copy_file $UPD/CD$CDNUM $file
|
|
|
|
SRCFILES=$(($SRCFILES + 1))
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo -en "\r$SRCFILES copied"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
case "$file" in
|
|
|
|
*_$THISARCH.deb)
|
2011-03-19 20:53:28 -01:00
|
|
|
copy_file $UPD/CD$CDNUM $file
|
2011-03-24 11:59:18 -01:00
|
|
|
ARCHFILES=$(($ARCHFILES + 1))
|
|
|
|
;;
|
2011-03-19 20:53:28 -01:00
|
|
|
*_all.deb)
|
2011-03-24 11:59:18 -01:00
|
|
|
copy_file $UPD/CD$CDNUM $file
|
|
|
|
ALLFILES=$(($ALLFILES + 1))
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo -en "\r$THISARCH:$ARCHFILES all:$ALLFILES copied"
|
|
|
|
;;
|
2011-03-19 20:53:28 -01:00
|
|
|
esac
|
|
|
|
}
|
2004-10-31 00:10:42 -01:00
|
|
|
|
2011-07-05 10:46:43 +00:00
|
|
|
start_new_disc () {
|
|
|
|
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
|
2012-05-30 07:35:23 +00:00
|
|
|
INFO="Debian ${DEBIAN_KERNEL} $VER Update $TYPEUP $DATE: $THISARCH $TYPEUP $THISNUM"
|
2011-07-05 10:46:43 +00:00
|
|
|
echo $INFO > $UPD/CD$CDNUM/.disk/info
|
|
|
|
SIZE_USED=0
|
|
|
|
SRCFILES=0
|
|
|
|
ARCHFILES=0
|
|
|
|
ALLFILES=0
|
|
|
|
}
|
|
|
|
|
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
|
2011-03-19 20:53:28 -01:00
|
|
|
echo "NO DIFF FOUND. ABORT!"
|
|
|
|
exit 1
|
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
|
|
|
cp $DIFF $UPD/list
|
|
|
|
if [ "$NONFREE"x != "1"x ] ; then
|
2011-03-19 20:53:28 -01:00
|
|
|
echo "Removing non-free files from the list"
|
|
|
|
grep -v non-free $UPD/list > $UPD/list1
|
|
|
|
mv -f $UPD/list1 $UPD/list
|
|
|
|
fi
|
|
|
|
|
2018-07-14 12:05:06 +00:00
|
|
|
$GRAB_MD5 $MIRROR_NORM "$ARCHLIST all" $CODENAME $CODENAME $UPD/md5-check
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2002-12-23 09:03:45 -01:00
|
|
|
for THISARCH in $ARCHLIST
|
|
|
|
do
|
2011-03-19 20:53:28 -01:00
|
|
|
THISNUM=0
|
2000-12-05 19:53:24 -01:00
|
|
|
|
2011-03-19 20:53:28 -01:00
|
|
|
MIRROR=$MIRROR_NORM
|
2005-12-19 18:05:23 -01:00
|
|
|
|
2012-05-30 07:35:23 +00:00
|
|
|
case "$THISARCH" in
|
|
|
|
kfreebsd) DEBIAN_KERNEL="GNU/kFreeBSD";;
|
|
|
|
hurd) DEBIAN_KERNEL="GNU/Hurd";;
|
|
|
|
source) DEBIAN_KERNEL="";;
|
|
|
|
*) DEBIAN_KERNEL="GNU/Linux";;
|
|
|
|
esac
|
|
|
|
export DEBIAN_KERNEL
|
|
|
|
|
2011-03-24 11:11:01 -01:00
|
|
|
rm -rf $OUT/$THISARCH/*-$TYPE
|
2011-03-19 20:53:28 -01:00
|
|
|
|
|
|
|
for file in `cat $UPD/list`
|
|
|
|
do
|
2011-03-24 11:59:18 -01:00
|
|
|
if [ ! -d $UPD/CD$CDNUM ] ; then
|
2011-07-05 10:46:43 +00:00
|
|
|
start_new_disc
|
2011-03-24 11:59:18 -01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$BACKOUT_FILE"x != ""x ] ; then
|
|
|
|
echo "Starting with backed-out file $BACKOUT_FILE"
|
|
|
|
add_file $BACKOUT_FILE
|
|
|
|
BACKOUT_FILE=""
|
|
|
|
fi
|
|
|
|
|
2015-09-07 14:53:45 +00:00
|
|
|
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
|
|
|
|
fi
|
2011-03-24 11:59:18 -01:00
|
|
|
fi
|
2011-03-19 20:53:28 -01:00
|
|
|
done
|
|
|
|
|
2011-07-05 10:46:43 +00:00
|
|
|
echo
|
|
|
|
echo "Making last disc in set for $THISARCH: size $SIZE_USED, BACKOUT_FILE \"$BACKOUT_FILE\""
|
|
|
|
# Catch the case where we still have a backout file at the very
|
|
|
|
# end of the set
|
|
|
|
if [ "$BACKOUT_FILE"x != ""x ] ; then
|
|
|
|
if [ ! -d $UPD/CD$CDNUM ] ; then
|
|
|
|
start_new_disc
|
|
|
|
fi
|
|
|
|
echo "Starting last disc with backed-out file $BACKOUT_FILE"
|
|
|
|
add_file $BACKOUT_FILE
|
|
|
|
BACKOUT_FILE=""
|
|
|
|
fi
|
|
|
|
|
2011-03-19 20:53:28 -01:00
|
|
|
make_cd $CDNUM $THISNUM $THISARCH $SRCFILES $ARCHFILES $ALLFILES
|
|
|
|
CDNUM=$(($CDNUM + 1))
|
2004-10-31 00:10:42 -01:00
|
|
|
done
|
2000-12-05 19:53:24 -01:00
|
|
|
|