mklive/scripts/pxe.sh

86 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
source $(dirname $0)/defaults.conf
source ${WORKDIR}/mklive.conf
source $(dirname $0)/functions.sh
source $(dirname $0)/menufunction.sh
if [ "$PXE" != "true" ]; then
einfo "Skipping PXE - not configured"
exit 0
fi
einfo "Creating PXE enviroment"
PXELINUX_MODULES="libmenu.c32 menu.c32"
PXELINUX_BIN="/usr/lib/PXELINUX/pxelinux.0"
[ "$PXE" == "true" ] || (einfo "PXE disabled" && exit 0)
checkstage live || eexit "Previous stage (live) was not finished"
startstage pxe
PXEDIR=${WORKDIR}/PXE
requiredir $PXEDIR
requiredir $PXEDIR/pxelinux
requiredir $PXEDIR/pxelinux.cfg
[ -L $PXEDIR/live ] || ln -s ../LIVE $PXEDIR/live
#copy pxelinux.bin
cp ${PXELINUX_BIN} $PXEDIR/
cp ${SYSLINUX_MODULESDIR}/ldlinux.c32 $PXEDIR/
#create pxelinux.conf
menuhead "/pxelinux" > $PXEDIR/pxelinux.cfg/default
menulivehead >> $PXEDIR/pxelinux.cfg/default
menulivepxe >> $PXEDIR/pxelinux.cfg/default
if [ "$PXE_INCLUDE_ARCH_LIVE" == "true" ]; then
menuarchlive >> $PXEDIR/pxelinux.cfg/default
fi
if [ "$PXE_INCLUDE_UBUNTU_INSTALLER" == "true" ] || [ "$PXE_INCLUDE_DEBIAN_INSTALLER" == "true" ]; then
menuinstallerhead >> $PXEDIR/pxelinux.cfg/default
fi
if [ "$PXE_INCLUDE_UBUNTU_INSTALLER" == "true" ]; then
menuinstaller ubuntu >> $PXEDIR/pxelinux.cfg/default
[ -L $PXEDIR/ubuntu-installer ] || ln -s ../INSTALLER/ubuntu-installer $PXEDIR/ubuntu-installer
fi
if [ "$PXE_INCLUDE_DEBIAN_INSTALLER" == "true" ]; then
menuinstaller debian >> $PXEDIR/pxelinux.cfg/default
[ -L $PXEDIR/debian-installer ] || ln -s ../INSTALLER/debian-installer $PXEDIR/debian-installer
fi
if [ "$PXE_INCLUDE_HDT" == "true" ] || [ "$PXE_INCLUDE_MEMTEST" == "true" ]; then
menuhwhead >> $PXEDIR/pxelinux.cfg/default
fi
if [ "$PXE_INCLUDE_HDT" == "true" ]; then
PXELINUX_MODULES="${PXELINUX_MODULES} hdt.c32 libutil.c32 libgpl.c32 libcom32.c32"
menuhwhdt >> $PXEDIR/pxelinux.cfg/default
[ -e /usr/share/misc/pci.ids ] && cp /usr/share/misc/pci.ids $PXEDIR/pxelinux/
fi
if [ "$PXE_INCLUDE_MEMTEST" == "true" ]; then
cp $MEMTEST_BIN $PXEDIR/memtest
menuhwmemtest >> $PXEDIR/pxelinux.cfg/default
fi
#copy all modules
for m in $PXELINUX_MODULES
do
cp ${SYSLINUX_MODULESDIR}/$m $PXEDIR/pxelinux/
done
#pack files
[ "$PXE_NO_TAR" == "true" ] && einfo "Skipping 'tar' step - disabled by config." || tar -hczf pxe.tar.gz -C $PXEDIR/ .
#create tarball
endstage pxe
eok "PXE build Done"