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 # default boot arguments used for both grub and pxelinux
21 if [ -e "$MOUNT_POINT_" ]; then
22 default_boot_args_="root=/dev/nfs rw nfsroot=$IP_:$MOUNT_POINT_ \
25 default_boot_args_="ramdisk_size=24000 root=/dev/ram0 rw \
26 init=/etc/init nfsdir=$IP_:$MOUNT_POINT_ nodhcp noprompt noeject \
30 # special boot arguments required by pxelinux
31 pxe_def_boot_args_="$default_boot_args_"
34 ## create pxelinux config
37 if [ -d /run/live/medium ] ; then # since December 2018
38 grml2usb --bootloader-only \
39 --bootoptions="$pxe_def_boot_args_ $BOOT_ARGS_" \
40 --remove-bootoption=nodhcp \
41 /run/live/medium "$DEST_DIR"
43 mv "$DEST_DIR"/boot/syslinux/* "$TFTPD_DATA_DIR_/"
44 rmdir "$DEST_DIR"/boot/syslinux
46 mv "$DEST_DIR"/boot/ "$TFTPD_DATA_DIR_"
47 elif [ -d /lib/live/mount/medium ] ; then
48 grml2usb --bootloader-only \
49 --bootoptions="$pxe_def_boot_args_ $BOOT_ARGS_" \
50 --remove-bootoption=nodhcp \
51 /lib/live/mount/medium "$DEST_DIR"
53 mv "$DEST_DIR"/boot/syslinux/* "$TFTPD_DATA_DIR_/"
54 rmdir "$DEST_DIR"/boot/syslinux
56 mv "$DEST_DIR"/boot/ "$TFTPD_DATA_DIR_"
58 if [ ! -d /usr/share/grml-live/templates/boot/isolinux ] ; then
59 echo "E: Could not find isolinux directory, can not operate without.
61 Did you boot the system with the toram=... boot option? If so please
62 either do not use the toram boot option at all or use boot option toram
63 without any arguments (just \"toram\" instead of \"toram=...\")." >&2
67 array=( $(cat /etc/grml_version) )
68 grml_name_=${array[0]}
69 grml_version_=${array[1]}
71 cp /usr/share/grml-live/templates/boot/isolinux/* "$TFTPD_DATA_DIR_/"
73 config_files_=$(find "$TFTPD_DATA_DIR_/" -name "*.cfg" -type f)
74 sed -i "s/%ARCH%/$(uname -m)/" $config_files_
75 sed -i "s/%BOOTID%/$RANDOM/" $config_files_
76 sed -i "s/%SHORT_NAME%/dummy/" $config_files_
77 sed -i "s/%VERSION%/$grml_version_/" $config_files_
78 sed -i "s/%GRML_NAME%/$grml_name_/" $config_files_
79 sed -i "s/%DISTRI_SPLASH%/grml.png/" $config_files_
80 sed -i "s/%DISTRI_INFO%/Grml/" $config_files_
81 sed -i "s#\(^.*append.*initrd.*$\)#\1 $pxe_def_boot_args_ $BOOT_ARGS_#" $config_files_
82 cat > "$TFTPD_DATA_DIR_/grmlmain.cfg"<<EOT
84 include menuoptions.cfg
94 # Copy initrd.img and vmlinuz from all directories which name begins
95 # with grml, e.g. grml32full and grml64full
96 # This way we can boot multiple ISOs
97 for filename in "${MULTIBOOT_PATH_}"/grml* ; do
98 [ -d "$filename" ] || continue
99 cp -r "${filename}" "${TFTPD_DATA_DIR_}/boot/"
102 config_files_=$(find "$TFTPD_DATA_DIR_/" -name "*.cfg" -type f)
104 # cd is multi iso, grml2usb got it right ;0
105 if [ -d "$MOUNT_POINT_"/boot/release ] ; then
106 sed -i -e 's#\(.*\)/boot/\(.*\)#\1\2#' $config_files_
109 # adjust ldbsd.com bootline
110 sed -i -e 's#\(.*kernel .*/ldbsd.com\)#\1 set image /boot/addons/bsd4grml/bsd.rd`echo Type "boot" to load MirOS bsd4grml via keeppxe#' "$TFTPD_DATA_DIR_/"addon_*_bsd.cfg
112 # remove grub entries
113 rm -f "$TFTPD_DATA_DIR_/"addon_*grub*.cfg
115 mv "$TFTPD_DATA_DIR_/syslinux.cfg" "$TFTPD_DATA_DIR_/pxelinux.cfg/default"