From 17ee5f87d742a57f82960b08795b07896969ac8b Mon Sep 17 00:00:00 2001 From: Johannes Meixner Date: Wed, 4 May 2022 13:08:31 +0200 Subject: [PATCH] Update 450_check_bootloader_files.sh In layout/save/default/450_check_bootloader_files.sh added bash globbing characters [] around the first letter to ensure that with 'shopt -s nullglob' files that do not exist will not appear so nonexistent files are not appended to CHECK_CONFIG_FILES cf. https://github.com/rear/rear/pull/2796#issuecomment-1117171070 --- .../save/default/450_check_bootloader_files.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/usr/share/rear/layout/save/default/450_check_bootloader_files.sh b/usr/share/rear/layout/save/default/450_check_bootloader_files.sh index d0a6b6292c..1324220ede 100644 --- a/usr/share/rear/layout/save/default/450_check_bootloader_files.sh +++ b/usr/share/rear/layout/save/default/450_check_bootloader_files.sh @@ -7,33 +7,38 @@ # An artificial bash array is used so that the first array element $used_bootloader is the used bootloader: used_bootloader=( $( cat $VAR_DIR/recovery/bootloader ) ) +# No quoting of the elements that are appended to the CHECK_CONFIG_FILES array together with +# the bash globbing characters like '*' or the [] around the first letter make sure +# that with 'shopt -s nullglob' files that do not exist will not appear +# so nonexistent files are not appended to CHECK_CONFIG_FILES +# cf. https://github.com/rear/rear/pull/2796#issuecomment-1117171070 case $used_bootloader in (EFI|GRUB2-EFI) CHECK_CONFIG_FILES+=( /boot/efi/EFI/*/grub*.cfg ) ;; (GRUB|GRUB2) - CHECK_CONFIG_FILES+=( /etc/grub.cfg /etc/grub2.cfg /boot/grub2/grub2.cfg /boot/grub/grub.cfg ) + CHECK_CONFIG_FILES+=( /[e]tc/grub.cfg /[e]tc/grub2.cfg /[b]oot/grub2/grub2.cfg /[b]oot/grub/grub.cfg ) ;; (LILO) - CHECK_CONFIG_FILES+=( /etc/lilo.conf ) + CHECK_CONFIG_FILES+=( /[e]tc/lilo.conf ) ;; (ELILO) - CHECK_CONFIG_FILES+=( /etc/elilo.conf ) + CHECK_CONFIG_FILES+=( /[e]tc/elilo.conf ) ;; (PPC) # PPC arch bootloader can be : # - LILO : SLES < 12 # - YABOOT : RHEL < 7 # - GRUB2 : SLES >= 12, RHEL >= 7, Ubuntu and other new Linux on POWER distro. - CHECK_CONFIG_FILES+=( /etc/lilo.conf /etc/yaboot.conf /etc/grub.cfg /etc/grub2.cfg /boot/grub2/grub2.cfg /boot/grub/grub.cfg) + CHECK_CONFIG_FILES+=( /[e]tc/lilo.conf /[e]tc/yaboot.conf /[e]tc/grub.cfg /[e]tc/grub2.cfg /[b]oot/grub2/grub2.cfg /[b]oot/grub/grub.cfg) ;; (ARM|ARM-ALLWINNER) - CHECK_CONFIG_FILES+=( /boot/boot.scr ) + CHECK_CONFIG_FILES+=( /[b]oot/boot.scr ) ;; (ZIPL) # cf. https://github.com/rear/rear/issues/2137 # s390 - for rhel, ubuntu zipl config must be exist for restore. sles > 11 does not use zipl directly - CHECK_CONFIG_FILES+=( /etc/zipl.conf ) + CHECK_CONFIG_FILES+=( /[e]tc/zipl.conf ) ;; (*) BugError "Unknown bootloader ($used_bootloader) - ask for sponsoring to get this fixed"