1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
|
#!/bin/bash
#
# Do install stuff for amd64, including making bootable CDs
# Works with debian-installer
#
# $1 is the CD number
# $2 is the temporary CD build dir
. $BASEDIR/tools/boot/$DI_CODENAME/common.sh
set -e
#set -x
N=$1
CDDIR=$2
BOOTDIR=
#echo "DI_WWW_HOME is $DI_WWW_HOME"
#echo "DI_DIR is $DI_DIR"
if [ "$DI_WWW_HOME" = "default" ];then
DI_WWW_HOME="http://people.debian.org/~aba/d-i/images/daily"
if [ -n "$DI_DIR" ];then
DI_DIR="$DI_DIR/~${DI_WWW_HOME#*~}"
DI_WWW_HOME=""
echo "Using images from $DI_DIR"
fi
fi
if [ ! "$DI_DIST" ]; then
DI_DIST="$DI_CODENAME"
fi
cd $CDDIR/..
# This script is called with $1 (now $N) as the CD to
# make bootable. N may be in the form "n" or "n_NONUS"
# There may be more than 4 disks...support extras.
# Strip NONUS part of disk number
# NN will be 1...N so it can be used as an index
NN=`echo $N | sed -e 's/_NONUS//'`
if [ "$NN" != "1" ]; then
echo "CD$NN is not bootable"
exit 0
fi
BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"
# Download boot images.
for image in $BOOT_IMAGES; do
if [ ! -e "$image" ]; then
dir=$(dirname $image)
mkdir -p $dir
if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
elif [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
# echo "Copying images from $DI_DIR"
cp "$DI_DIR/$image" "$image"
else
wget "$DI_WWW_HOME/$image" -O "$image"
fi
fi
done
echo " Using ISOLINUX boot-disks image on CD$N"
mkdir -p boot$N/isolinux boot$N/isolinux-amd64 $CDDIR/install.amd
cp -lf cdrom/vmlinuz $CDDIR/install.amd/
cp -lf cdrom/initrd.gz $CDDIR/install.amd/
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-b isolinux/isolinux.bin"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-c isolinux/boot.cat"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-no-emul-boot"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-boot-load-size 4"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-boot-info-table"
syslinux_files () {
type=$1
mv boot$N/isolinux-amd64/f3.txt.$type boot$N/isolinux-amd64/f3.txt
mv boot$N/isolinux-amd64/f4.txt.$type boot$N/isolinux-amd64/f4.txt
mv boot$N/isolinux-amd64/isolinux.cfg.$type boot$N/isolinux-amd64/isolinux.cfg
}
extra_image () {
image=$1
dir=$(dirname "$image")
mkdir -p $CDDIR/install.amd/$dir
if [ ! -e $CDDIR/install.amd/"$image" ] ; then
if [ ! "$DI_WWW_HOME" ] ; then
if [ ! "$DI_DIR" ] ; then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
cp "$DI_DIR/cdrom/$image" $CDDIR/install.amd/"$image"
else
wget "$DI_WWW_HOME/cdrom/$image" -O $CDDIR/install.amd/"$image"
fi
fi
}
# Isolinux setup including config and help files comes from d-i.
cat cdrom/debian-cd_info.tar.gz | (cd boot$N/isolinux-amd64/; tar zx)
if [ -e boot$N/isolinux-amd64/f3.txt.withgtk ]; then
extra_image gtk/initrd.gz
syslinux_files withgtk
fi
rm -f boot$N/isolinux-amd64/isolinux.cfg.with* 2>/dev/null || true
sed -i "s|/install/|/install.amd/|" boot$N/isolinux-amd64/isolinux.cfg
mkdir -p $CDDIR/../syslinux
SYSLINUXDEB=`$BASEDIR/tools/which_deb $MIRROR $DI_CODENAME syslinux`
ar p "$MIRROR/${SYSLINUXDEB}" data.tar.gz | tar zxf - -C $CDDIR/../syslinux ./usr/lib
cp -f $CDDIR/../syslinux/usr/lib/syslinux/isolinux.bin boot$N/isolinux/
echo $SYSLINUXDEB >> $CDDIR/../$N.pkgs_extracted
$BASEDIR/tools/which_deb $MIRROR $DI_CODENAME syslinux source >> $CDDIR/../$N.pkgs_extracted
if [ -n "$KERNEL_PARAMS" ]; then
# Substitute custom kernel params into the isolinux config
# file.
sed -i "s|append |append $KERNEL_PARAMS |" boot$N/isolinux-amd64/isolinux.cfg
fi
if [ -n "$ISOLINUX_DEFAULT" ]; then
sed -i "s/^DEFAULT .*$/DEFAULT $ISOLINUX_DEFAULT/" boot$N/isolinux-amd64/isolinux.cfg
fi
# If the isolinux dir already exists, then we also have i386 and
# should merge. Otherwise, simply rename isolinux-amd64 into place
if [ -e boot$N/isolinux/isolinux.cfg ] ; then
for file in boot$N/isolinux/f3.txt* boot$N/isolinux/f4.txt*
do
cat $file | awk '
NR==3 { next }
NR==5 { printf " (i386 is default; prepend 'amd64-' to use an amd64 kernel instead)\n" }
/.*/ { print $0 }' > $file.tmp
mv $file.tmp $file
done
cat boot$N/isolinux-amd64/isolinux.cfg | awk '
/^LABEL/ { printf("LABEL amd64-%s\n", $2) }
/^DEFAULT/ { printf("DEFAULT64 amd64-%s\n", $2) }
/kernel/ { print $0 }
/append/ { print $0 }' >> boot$N/isolinux/isolinux.cfg
else
mv -f boot$N/isolinux-amd64/* boot$N/isolinux
fi
rm -rf boot$N/isolinux-amd64
if [ "$SPLASHPNG" ] ; then
# Insert our own splash screen. Color index 0 is
# background, and index 7 is foreground. Set to black and
# white respecively
pngtopnm < $SPLASHPNG | ppmquant 16 | \
ppmtolss16 "#ffffff=7" "#000000=0" > boot$N/isolinux/splash.rle
fi
rm -rf cdrom
sed -i "s|built on|built $BUILD_DATE; d-i|" boot$N/isolinux/f1.txt
# Add autorun if we have README.html
if [ -f $CDDIR/README.html ]; then
todos > $CDDIR/autorun.inf <<EOF
[autorun]
open=autorun.bat
EOF
todos > $CDDIR/autorun.bat <<EOF
@echo Starting "README.html"...
@start README.html
@exit
EOF
fi
add_mkisofs_opt $CDDIR/../$N.mkisofs_dirs "boot$N"
# th,th, thats all
|