From 293f3b48e4c9b5991ccd66919cf4036d623050b7 Mon Sep 17 00:00:00 2001 From: nospoonuser Date: Sun, 27 May 2018 15:07:46 +0200 Subject: [PATCH] Added Arch live system to the PXE menu --- scripts/defaults.conf | 1 + scripts/menufunction.sh | 36 ++++++++++++++++++++++++++++++++++++ scripts/pxe.sh | 4 ++++ 3 files changed, 41 insertions(+) diff --git a/scripts/defaults.conf b/scripts/defaults.conf index 926a898..eba6d79 100644 --- a/scripts/defaults.conf +++ b/scripts/defaults.conf @@ -1,3 +1,4 @@ MEMTEST_BIN="/boot/memtest86+.bin" UBUNTU_INSTALL_NETBOOT="http://de.archive.ubuntu.com/ubuntu/dists/bionic/main/installer-amd64/current/images/netboot/netboot.tar.gz" DEBIAN_INSTALL_NETBOOT="http://ftp.nl.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/netboot.tar.gz" +ARCH_BASEDIR="arch/arch" diff --git a/scripts/menufunction.sh b/scripts/menufunction.sh index 98d921c..fbed336 100644 --- a/scripts/menufunction.sh +++ b/scripts/menufunction.sh @@ -41,6 +41,24 @@ function menulivepxe { # FETCH # ftp, http, tftp + +if [ -n "$PXE_HTTP_BASE" ] +then + PXE_FETCH_HTTP="http://${PXE_SERVER}${PXE_HTTP_BASE}" +fi + +if [ -n "$PXE_FTP_BASE" ] +then + PXE_FETCH_FTP="ftp://${PXE_SERVER}${PXE_FTP_BASE}" +fi + +if [ -n "$PXE_TFTP_BASE" ] +then + PXE_FETCH_TFTP="ftp://${PXE_SERVER}${PXE_TFTP_BASE}" +fi + + + num=$(echo "$PXE_FETCH_FTP $PXE_FETCH_HTTP $PXE_FETCH_TFTP" | wc -w) if [ $num -gt 1 ];then @@ -175,3 +193,21 @@ menu end EOF } + +menuarchlive(){ +archbasedir=$ARCH_BASEDIR +localarchpath=$ARCH_LOCALPATH + +if [ -n "$localarchpath" ] && [ -d $localarchpath/$archisobasedir ]; +then + sed -r -e "s~boot~../${archbasedir}/boot~g" -n -e '/arch64_http/,/^$/p' ${localarchpath}${archbasedir}/boot/syslinux/archiso_pxe.cfg +else + #echo "http://${pxeserver}/${archbasedir}/boot/syslinux/archiso_pxe.cfg" 1>&2 + curl -s http://${PXE_SERVER}${PXE_HTTP_BASE}/${archbasedir}/boot/syslinux/archiso_pxe.cfg | sed -r \ + -e "s~boot~../${archbasedir}/boot~g" \ + -e "s~basedir=arch~basedir=${PXE_HTTP_BASE}/${ARCH_BASEDIR}~g" \ + -e "s/\\$\{pxeserver\}/${PXE_SERVER}/g" \ + -n -e '/arch64_http/,/^$/p' +fi + +} diff --git a/scripts/pxe.sh b/scripts/pxe.sh index 016c23a..99b5c55 100755 --- a/scripts/pxe.sh +++ b/scripts/pxe.sh @@ -27,6 +27,10 @@ menuhead > $PXEDIR/pxelinux/pxelinux.cfg/default menulivehead >> $PXEDIR/pxelinux/pxelinux.cfg/default menulivepxe >> $PXEDIR/pxelinux/pxelinux.cfg/default +if [ "$PXE_INCLUDE_ARCH_LIVE" == "true" ]; then + menuarchlive >> $PXEDIR/pxelinux/pxelinux.cfg/default +fi + if [ "$PXE_INCLUDE_UBUNTU_INSTALLER" == "true" ] || [ "$PXE_INCLUDE_DEBIAN_INSTALLER" == "true" ]; then menuinstallerhead >> $PXEDIR/pxelinux/pxelinux.cfg/default fi