. locations.include
#check that /dev/console is not a serial console.  There is a bug that 
#causes anaconda-runtime/readmap to fail if /dev/console is serial
#If readmap fails then the installer cannot find keyboard files
console=`consoletype </dev/console`
if [ $console == "serial" ]; then
   echo "There is a bug that causes anaconda-runtime/getmap to fail if"
   echo "/dev/console is a serial device.  So exiting "
    exit 1
fi
#Lets customize the isolinux files.  Need to do this now so that they make
#it on the boot.iso which is build in buildinstall .
sed -e "s/__ARCH__/$ARCH/ ; s/__VERSION__/$VERSIONIMAGE/" $TREE/$DEFAULT/build/isolinux/boot.msg.SL > /$TREE/$DEFAULT/build/isolinux/boot.msg
sed -e "s/__ARCH__/$ARCH/ ; s/__VERSION__/$VERSIONIMAGE/" $TREE/$DEFAULT/build/isolinux/syslinux.cfg.SL > $TREE/$DEFAULT/build/isolinux/syslinux.cfg
sed -e "s/__ARCH__/$ARCH/ ; s/__VERSION__/$VERSIONIMAGE/" $TREE/$DEFAULT/build/isolinux/isolinux.cfg.SL > $TREE/$DEFAULT/build/isolinux/isolinux.cfg
#
sh -x $ANACONDADIR/buildinstall --debug --pkgorder ../../base/pkgorder --version $VERSION --product "Scientific Linux" --release $RELEASE --default $DEFAULT $TREE
echo "Now fixing up images"
if [ ! -d /mnt/sltmp ] ; then
	mkdir /mnt/sltmp
fi

if [ $ARCH == "ia64" ]; then

   echo "no customized boot images for $ARCH for now..."

else 
   if [ $ARCH == "x86_64" ]; then

     echo "no customized boot images for $ARCH for now..."
 
   else
#commented out because cannot change contents of a .iso image by just mounting
#and writing
#  mount -o loop $TREE/images/$DEFAULT/boot.iso /mnt/sltmp
     if [ $ARCH == "i386" ]; then
       mount -o loop $TREE/images/$DEFAULT/bootdisk.img /mnt/sltmp
       cp $TREE/$DEFAULT/build/isolinux/boot.msg /mnt/sltmp/
       cp $TREE/$DEFAULT/build/isolinux/syslinux.cfg /mnt/sltmp/
#This is a binary file.  Nothing to replace
       cp $TREE/$DEFAULT/build/isolinux/splash.lss /mnt/sltmp/
     fi 
   fi
fi 
umount /mnt/sltmp
rmdir /mnt/sltmp
