Move to template format instead of cat-EOF

Simplifies the scripts and adds the ability to easily and cleanly change
the contents of these files without dealing with escape characters, etc.
This commit is contained in:
2023-09-01 15:41:57 -04:00
parent cf42c366e0
commit c8f1d853a0
22 changed files with 1018 additions and 924 deletions

View File

@ -108,25 +108,6 @@ build_pxe() {
rmdir ${tmpdir}
echo "done."
echo -n "Creating base iPXE configuration... "
cat <<EOF > ${outputdir}/boot.pxe
#!ipxe
# Set global variables
set root-url tftp://\${next-server}
set menu-default pvc-installer
set submenu-default pvc-installer
:pvc-installer
kernel \${root-url}/vmlinuz
initrd \${root-url}/initrd.img
imgargs vmlinuz console=tty0 vga=normal nomodeset boot=live components ethdevice-timeout=600 timezone=America/Toronto fetch=\${root-url}/filesystem.squashfs username=root pvcinstall.preseed=on pvcinstall.seed_host=\${next-server} pvcinstall.seed_file=/host/mac-\${mac:hexraw}.preseed
boot
EOF
echo "done."
echo -n "Downloading iPXE binary undionly.kpxe (chainloads arbitrary PXE clients)... "
pushd ${outputdir} &>/dev/null
wget -O undionly.kpxe https://boot.ipxe.org/undionly.kpxe &>/dev/null || fail "failed to download undionly.kpxe."
@ -139,6 +120,10 @@ EOF
popd &>/dev/null
echo "done."
echo -n "Copying base iPXE configuration... "
cp templates/boot.pxe ${outputdir}/boot.pxe
echo "done."
sudo chown -R $(whoami) ${outputdir}
sudo chmod -R u+w ${outputdir}