mklive/scripts/pxe.sh

86 lines
2.3 KiB
Bash
Raw Permalink Normal View History

2018-05-21 12:41:52 +00:00
#!/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"
2018-05-21 12:41:52 +00:00
2018-11-06 22:29:48 +00:00
PXELINUX_MODULES="libmenu.c32 menu.c32"
2018-05-21 12:41:52 +00:00
PXELINUX_BIN="/usr/lib/PXELINUX/pxelinux.0"
[ "$PXE" == "true" ] || (einfo "PXE disabled" && exit 0)
checkstage live || eexit "Previous stage (live) was not finished"
2018-05-21 12:41:52 +00:00
startstage pxe
PXEDIR=${WORKDIR}/PXE
requiredir $PXEDIR
requiredir $PXEDIR/pxelinux
2018-11-06 22:29:48 +00:00
requiredir $PXEDIR/pxelinux.cfg
2018-05-21 12:41:52 +00:00
[ -L $PXEDIR/live ] || ln -s ../LIVE $PXEDIR/live
#copy pxelinux.bin
2018-11-06 22:29:48 +00:00
cp ${PXELINUX_BIN} $PXEDIR/
cp ${SYSLINUX_MODULESDIR}/ldlinux.c32 $PXEDIR/
2018-05-21 12:41:52 +00:00
#create pxelinux.conf
2018-11-06 22:29:48 +00:00
menuhead "/pxelinux" > $PXEDIR/pxelinux.cfg/default
menulivehead >> $PXEDIR/pxelinux.cfg/default
menulivepxe >> $PXEDIR/pxelinux.cfg/default
2018-05-21 12:41:52 +00:00
2018-05-27 13:07:46 +00:00
if [ "$PXE_INCLUDE_ARCH_LIVE" == "true" ]; then
2018-11-06 22:29:48 +00:00
menuarchlive >> $PXEDIR/pxelinux.cfg/default
2018-05-27 13:07:46 +00:00
fi
2018-05-21 12:41:52 +00:00
if [ "$PXE_INCLUDE_UBUNTU_INSTALLER" == "true" ] || [ "$PXE_INCLUDE_DEBIAN_INSTALLER" == "true" ]; then
2018-11-06 22:29:48 +00:00
menuinstallerhead >> $PXEDIR/pxelinux.cfg/default
2018-05-21 12:41:52 +00:00
fi
if [ "$PXE_INCLUDE_UBUNTU_INSTALLER" == "true" ]; then
2018-11-06 22:29:48 +00:00
menuinstaller ubuntu >> $PXEDIR/pxelinux.cfg/default
2018-05-21 12:41:52 +00:00
[ -L $PXEDIR/ubuntu-installer ] || ln -s ../INSTALLER/ubuntu-installer $PXEDIR/ubuntu-installer
fi
2018-05-22 19:41:24 +00:00
if [ "$PXE_INCLUDE_DEBIAN_INSTALLER" == "true" ]; then
2018-11-06 22:29:48 +00:00
menuinstaller debian >> $PXEDIR/pxelinux.cfg/default
2018-05-22 19:41:24 +00:00
[ -L $PXEDIR/debian-installer ] || ln -s ../INSTALLER/debian-installer $PXEDIR/debian-installer
fi
2018-05-21 12:41:52 +00:00
if [ "$PXE_INCLUDE_HDT" == "true" ] || [ "$PXE_INCLUDE_MEMTEST" == "true" ]; then
2018-11-06 22:29:48 +00:00
menuhwhead >> $PXEDIR/pxelinux.cfg/default
2018-05-21 12:41:52 +00:00
fi
if [ "$PXE_INCLUDE_HDT" == "true" ]; then
PXELINUX_MODULES="${PXELINUX_MODULES} hdt.c32 libutil.c32 libgpl.c32 libcom32.c32"
2018-11-06 22:29:48 +00:00
menuhwhdt >> $PXEDIR/pxelinux.cfg/default
2018-05-21 12:41:52 +00:00
[ -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
2018-11-06 22:29:48 +00:00
menuhwmemtest >> $PXEDIR/pxelinux.cfg/default
2018-05-21 12:41:52 +00:00
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/ .
2018-05-21 12:41:52 +00:00
#create tarball
endstage pxe
eok "PXE build Done"