1 # the following variables are available in the template:
3 # $INTERFACE_ (interface for the terminalserver)
4 # $IP_ (ip for the terminalserver to bind)
5 # $NETMASK_ (network mask)
7 # $NAMESERVERS_ (nameservers for the nodes)
8 # $IPRANGE_FROM_ (user configured iprange, first ip)
9 # $IPRANGE_TO_ (user configured iprange, last ip)
10 # $NETWORK_ (first ip in this subnet)
11 # $OPTIONS_ (options for grml-terminalserver)
12 # $BOOT_ARGS_ (boot arguments for the nodes)
15 # templates are shellscript fragments and will be sourced from the
20 if [ -r "${TFTPD_DATA_DIR_}"/shim.efi ] ; then
21 echo "${TFTPD_DATA_DIR_}/shim.efi exists already, nothing to do."
22 elif [ -r /usr/lib/shim/shimx64.efi.signed ] ; then
23 echo "Installing /usr/lib/shim/shimx64.efi.signed as shim.efi for TFTP usage"
24 cp /usr/lib/shim/shimx64.efi.signed "${TFTPD_DATA_DIR_}"/shim.efi
25 elif [ -r /usr/lib/shim/shimx64.efi ] ; then
26 echo "Installing /usr/lib/shim/shimx64.efi as shim.efi for TFTP usage"
27 cp /usr/lib/shim/shimx64.efi "${TFTPD_DATA_DIR_}"/shim.efi
29 echo "WARN: No shimx64.efi for usage with PXE boot found, not setting up UEFI boot via GRUB."
34 if [ -r "${TFTPD_DATA_DIR_}"/grubx64.efi ] ; then
35 echo "${TFTPD_DATA_DIR_}/grubx64.efi exists already, nothing to do."
36 elif [ -r /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed ] ; then
37 echo "Installing /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed as grubx64.efi for TFTP usage"
38 cp /usr/lib/grub/x86_64-efi-signed/grubnetx64.efi.signed "${TFTPD_DATA_DIR_}"/grubx64.efi
39 elif [ -r /usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi ] ; then
40 echo "Installing /usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi as grubx64.efi for TFTP usage"
41 cp /usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi "${TFTPD_DATA_DIR_}"/grubx64.efi
43 echo "WARN: No grubnetx64.efi for usage with PXE boot found, not setting up UEFI boot via GRUB."
48 if [ -r "${TFTPD_DATA_DIR_}"/grub/fonts/unicode.pf2 ] ; then
49 echo "${TFTPD_DATA_DIR_}/grub/fonts/unicode.pf2 exists already, nothing to do."
50 elif [ -r /usr/share/grub/unicode.pf2 ] ; then
51 echo "Installing /usr/share/grub/unicode.pf2 for TFTP usage"
52 mkdir -p "${TFTPD_DATA_DIR_}"/grub/fonts/
53 cp /usr/share/grub/unicode.pf2 "${TFTPD_DATA_DIR_}"/grub/fonts/
55 echo "WARN: No unicode.pf2 for usage with PXE boot found."
58 echo "Setting up GRUB configuration for PXE/UEFI usage"
59 mkdir -p "${TFTPD_DATA_DIR_}/grub/"
60 cat > "${TFTPD_DATA_DIR_}/grub/grub.cfg" << EOT
61 # GRUB PXE configuration file
63 # adjust according to your needs
69 terminal_output gfxterm
73 set menu_color_normal=white/black
74 set menu_color_highlight=black/yellow
76 # this needs some tuning, so not enabled by default
77 # set theme=/boot/grub/grml-theme/theme.txt
82 # theme support requires e.g. icons/submenu.png within the theme directory,
83 # which we don't ship though, so not enabled by default
84 #mkdir -p "${TFTPD_DATA_DIR_}"/grub/themes/boot/grub
85 #ln -s "${TFTPD_DATA_DIR_}"/boot/grub/grml-theme "${TFTPD_DATA_DIR_}"/grub/themes/boot/grub/
87 for file in "${TFTPD_DATA_DIR_}"/boot/grub/*_default.cfg "${TFTPD_DATA_DIR_}"/boot/grub/*_options.cfg ; do
88 filename="$(basename "${file}")"
89 echo "source boot/grub/${filename}" >> "${TFTPD_DATA_DIR_}/grub/grub.cfg"
92 cat >> "${TFTPD_DATA_DIR_}/grub/grub.cfg" << EOT
94 menuentry "Boot OS of first partition on first disk" {