125 lines
3.0 KiB
Plaintext
125 lines
3.0 KiB
Plaintext
|
#!/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
|
||
|
for p in `debootstrap --arch $ARCH --print-debs $CODENAME $TDIR/debootstrap.tmp file:$MIRROR`
|
||
|
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
|
||
|
|
||
|
# 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
|
||
|
cp -af $BASE_EXCLUDE $BDIR/CD$DISK/.disk/base_exclude
|
||
|
else
|
||
|
echo "ERROR: Unable to read BASE_EXCLUDE file $BASE_EXCLUDE"
|
||
|
fi
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
# Generate the Packages files
|
||
|
for i in $BDIR/*.packages
|
||
|
do
|
||
|
dir=${i%%.packages}
|
||
|
n=${dir##$BDIR/}
|
||
|
dir=$BDIR/CD$n
|
||
|
echo "$n ... "
|
||
|
cat $i | xargs -n 200 -r $ADDPACKAGES $dir
|
||
|
if [ -x "$HOOK" ] ; then
|
||
|
cd $BDIR && $HOOK $n before-scanpackages
|
||
|
fi
|
||
|
$SCANPACKAGES scan $dir
|
||
|
echo "done."
|
||
|
done
|
||
|
|
||
|
# Now install the Packages and Packages.cd files
|
||
|
for i in $BDIR/*.packages
|
||
|
do
|
||
|
dir=${i%%.packages}
|
||
|
dir=${dir##$BDIR/}
|
||
|
dir=$BDIR/CD$dir
|
||
|
$SCANPACKAGES install $dir
|
||
|
done
|