#!/bin/bash
#
# boot-ia64
#
# $1 is the CD number
# $2 is the temporary CD build dir

set -e

N=$1
CDDIR=$2
BOOTDIR=

cd $CDDIR/..

# Only disc 1 bootable
if [ $N != 1 -a $N != 1_NONUS ]; then 
	echo "-J" > $N.mkisofs_opts
	exit 0; 
fi

mkdir -p boot$N/boot
cp -f CD1/dists/$CODENAME/main/disks-$ARCH/current/images-1.44/rescue.bin boot$N/boot/
echo -n "-no-emul-boot -J -b boot/rescue.bin -c boot/boot.catalog boot$N"  > $N.mkisofs_opts

# populate the install directory as well, with symlinks to save space
# rescue.bin is 10MB on ia64
(cd CD1/install; \
	ln -s ../dists/$CODENAME/main/disks-$ARCH/current/images-1.44/rescue.bin . ; \
	ln -s ../dists/$CODENAME/main/disks-$ARCH/current/linux . ; \
	ln -s ../dists/$CODENAME/main/disks-$ARCH/current/root.bin . )

# th,th, thats all
