From: Michael Prokop Date: Thu, 26 Sep 2019 07:22:01 +0000 (+0200) Subject: addon_*_bsd.cfg: don't try to modify if file doesn't exist X-Git-Tag: v0.102.2~1 X-Git-Url: http://git.grml.org/?p=grml-terminalserver.git;a=commitdiff_plain;h=ac0dc031e19fc738150b861cb1d1b17ca4a8a7b9 addon_*_bsd.cfg: don't try to modify if file doesn't exist This exhibits an ugly error message if no such file exists, so let's check if any such file exists before trying to operate on them --- diff --git a/templates/grub-pxelinux_config b/templates/grub-pxelinux_config index 50fc1bd..8360ac3 100644 --- a/templates/grub-pxelinux_config +++ b/templates/grub-pxelinux_config @@ -107,7 +107,9 @@ if [ -d "$MOUNT_POINT_"/boot/release ] ; then fi # adjust ldbsd.com bootline -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 +if ls "$TFTPD_DATA_DIR_/"addon_*_bsd.cfg >/dev/null 2>&1; then + 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 +fi # remove grub entries rm -f "$TFTPD_DATA_DIR_/"addon_*grub*.cfg