From ac0dc031e19fc738150b861cb1d1b17ca4a8a7b9 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 26 Sep 2019 09:22:01 +0200 Subject: [PATCH] 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 --- templates/grub-pxelinux_config | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- 2.1.4