2005-12-10 23:39:10 -01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# add_debs
|
|
|
|
#
|
|
|
|
# Simple helper script for debian-cd
|
|
|
|
#
|
|
|
|
# Split out of the top-level Makefile by SAM 2005/12/10
|
|
|
|
#
|
|
|
|
# 1. Check that the lists of packages look valid (e.g. installer
|
|
|
|
# packages are on CD#1
|
|
|
|
#
|
|
|
|
# 2. Add deb files into each CD root
|
|
|
|
#
|
|
|
|
# 3. Create Packages files within each CD root
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
BDIR=$1
|
|
|
|
TDIR=$2
|
|
|
|
FIRSTDISKS=$3
|
|
|
|
ARCH=$4
|
|
|
|
BASE_INCLUDE=$5
|
|
|
|
BASE_EXCLUDE=$6
|
|
|
|
UDEB_INCLUDE=$7
|
|
|
|
UDEB_EXCLUDE=$8
|
|
|
|
ADDPACKAGES=$9
|
|
|
|
shift
|
|
|
|
SCANPACKAGES=$9
|
|
|
|
|
|
|
|
echo "Current disk usage on the binary CDs (before the debs are added):"
|
|
|
|
cd $BDIR && du -sm CD[0123456789]*
|
|
|
|
echo "Adding the selected packages to each CD:"
|
|
|
|
|
|
|
|
# Check that all packages required by debootstrap are included
|
|
|
|
# and create .disk/base_installable if yes
|
|
|
|
# Also create .disk/base_components
|
|
|
|
mkdir -p $TDIR
|
|
|
|
|
|
|
|
for DISK in $FIRSTDISKS
|
|
|
|
do
|
|
|
|
DISK=${DISK##CD}
|
|
|
|
ok=yes
|
2006-09-18 12:29:57 +00:00
|
|
|
for p in `debootstrap --arch $ARCH --print-debs $CODENAME $TDIR/debootstrap.tmp file:$MIRROR $DEBOOTSTRAP_SCRIPT`
|
2005-12-10 23:39:10 -01:00
|
|
|
do
|
|
|
|
if ! grep -q ^$p$ $BDIR/$DISK.packages ; then
|
|
|
|
if [ -n "$BASE_EXCLUDE" ] && grep -q ^$p$ $BASE_EXCLUDE ; then
|
|
|
|
echo "Missing debootstrap-required $p but included in $BASE_EXCLUDE"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
ok=no
|
|
|
|
echo "Missing debootstrap-required $p"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
rm -rf $TDIR/debootstrap.tmp
|
|
|
|
|
|
|
|
if [ "$ok" = "yes" ] ; then
|
|
|
|
echo "CD$DISK contains all packages needed by debootstrap"
|
|
|
|
touch $BDIR/CD$DISK/.disk/base_installable
|
|
|
|
else
|
|
|
|
echo "CD$DISK missing some packages needed by debootstrap"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo 'main' > $BDIR/CD$DISK/.disk/base_components
|
|
|
|
if [ -n "$LOCAL" ] ; then
|
|
|
|
echo 'local' >> $BDIR/CD$DISK/.disk/base_components
|
|
|
|
fi
|
|
|
|
|
2006-11-27 02:19:31 -01:00
|
|
|
if [ $COMPLETE = 1 ]; then
|
|
|
|
if [ $DISKTYPE = DVD ]; then
|
2006-11-27 02:22:34 -01:00
|
|
|
echo "dvd" > $BDIR/CD$DISK/.disk/cd_type
|
2006-11-27 02:19:31 -01:00
|
|
|
else
|
2006-11-27 02:22:34 -01:00
|
|
|
echo "full_cd" > $BDIR/CD$DISK/.disk/cd_type
|
2006-11-27 02:19:31 -01:00
|
|
|
fi
|
|
|
|
else
|
2006-11-27 02:22:34 -01:00
|
|
|
echo "not_complete" > $BDIR/CD$DISK/.disk/cd_type
|
2006-11-27 02:19:31 -01:00
|
|
|
fi
|
|
|
|
|
2005-12-10 23:39:10 -01:00
|
|
|
# Sort out the udeb include and exclude files
|
|
|
|
if [ -n "$UDEB_INCLUDE" ] ; then
|
|
|
|
if [ -r "$UDEB_INCLUDE" ] ; then
|
|
|
|
cp -af "$UDEB_INCLUDE" "$BDIR/CD$DISK/.disk/udeb_include"
|
|
|
|
else
|
|
|
|
echo "ERROR: Unable to read UDEB_INCLUDE file $UDEB_INCLUDE"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -n "$UDEB_EXCLUDE" ] ; then
|
|
|
|
if [ -r "$UDEB_EXCLUDE" ] ; then
|
|
|
|
cp -af "$UDEB_EXCLUDE" "$BDIR/CD$DISK/.disk/udeb_exclude"
|
|
|
|
else
|
|
|
|
echo "ERROR: Unable to read UDEB_EXCLUDE file $UDEB_EXCLUDE"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Ditto the base include and exclude
|
|
|
|
if [ -n "$BASE_INCLUDE" ] ; then
|
|
|
|
if [ -r "$BASE_INCLUDE" ] ; then
|
|
|
|
cp -af "$BASE_INCLUDE" "$BDIR/CD$DISK/.disk/base_include"
|
|
|
|
else
|
|
|
|
echo "ERROR: Unable to read BASE_INCLUDE file $BASE_INCLUDE"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if [ -n "$BASE_EXCLUDE" ] ; then
|
|
|
|
if [ -r "$BASE_EXCLUDE" ] ; then
|
2005-12-13 01:04:33 -01:00
|
|
|
cp -af "$BASE_EXCLUDE" "$BDIR/CD$DISK/.disk/base_exclude"
|
2005-12-10 23:39:10 -01:00
|
|
|
else
|
|
|
|
echo "ERROR: Unable to read BASE_EXCLUDE file $BASE_EXCLUDE"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2005-12-13 01:04:33 -01:00
|
|
|
# Copy the debs in place, and generate Packages files as we go
|
2005-12-10 23:39:10 -01:00
|
|
|
for i in $BDIR/*.packages
|
|
|
|
do
|
|
|
|
dir=${i%%.packages}
|
|
|
|
n=${dir##$BDIR/}
|
|
|
|
dir=$BDIR/CD$n
|
|
|
|
echo "$n ... "
|
2005-12-13 01:04:33 -01:00
|
|
|
|
|
|
|
# Copy the deb files in; addpackages also creates the Packages
|
|
|
|
# files as it runs
|
|
|
|
sort $i | xargs -n 200 -r $ADDPACKAGES $dir
|
2005-12-10 23:39:10 -01:00
|
|
|
if [ -x "$HOOK" ] ; then
|
|
|
|
cd $BDIR && $HOOK $n before-scanpackages
|
|
|
|
fi
|
|
|
|
|
2005-12-13 01:04:33 -01:00
|
|
|
# Create the Packages.gz files. Should we also make Packages.bz2?
|
|
|
|
for file in `find $dir -name Packages`
|
|
|
|
do
|
|
|
|
echo " $file.gz"
|
|
|
|
gzip -9 < $file > $file.gz
|
|
|
|
done
|
|
|
|
|
|
|
|
# Now the Release files; has to be done last, as they contain the
|
|
|
|
# md5sums of the Packages and Packages.gz files
|
|
|
|
$SCANPACKAGES $dir
|
|
|
|
|
|
|
|
echo "done."
|
2005-12-10 23:39:10 -01:00
|
|
|
done
|