Skip to content

Commit

Permalink
Update 450_check_bootloader_files.sh
Browse files Browse the repository at this point in the history
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. #2796 (comment)
  • Loading branch information
jsmeix committed May 4, 2022
1 parent 1334414 commit 17ee5f8
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions usr/share/rear/layout/save/default/450_check_bootloader_files.sh
Expand Up @@ -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"
Expand Down

0 comments on commit 17ee5f8

Please sign in to comment.