From 7998e96b98bfde7eb4a6911aaf5eb237ece86bef Mon Sep 17 00:00:00 2001 From: Matt DeVillier Date: Wed, 13 Nov 2019 17:36:29 -0600 Subject: [PATCH] functions: check both grub/grub2 dirs for boot files Signed-off-by: Matt DeVillier --- initrd/etc/functions | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/initrd/etc/functions b/initrd/etc/functions index dc3b6765..2e8bd6a4 100755 --- a/initrd/etc/functions +++ b/initrd/etc/functions @@ -305,10 +305,11 @@ detect_boot_device() # check $CONFIG_BOOT_DEV if set/valid if [ -e "$CONFIG_BOOT_DEV" ]; then - mount -o ro $CONFIG_BOOT_DEV /boot >/dev/null 2>&1 - if [[ $? && -d /boot/grub ]]; then - # CONFIG_BOOT_DEV is valid device and contains an installed OS - return 0 + if mount -o ro $CONFIG_BOOT_DEV /boot >/dev/null 2>&1; then + if ls -d /boot/grub* >/dev/null 2>&1; then + # CONFIG_BOOT_DEV is valid device and contains an installed OS + return 0 + fi fi fi @@ -330,10 +331,11 @@ detect_boot_device() # iterate thru possible options and check for grub dir for i in `cat /tmp/boot_device_list`; do umount /boot 2>/dev/null - mount -o ro $i /boot >/dev/null 2>&1 - if [[ $? && -d /boot/grub ]]; then - CONFIG_BOOT_DEV="$i" - return 0 + if mount -o ro $i /boot >/dev/null 2>&1; then + if ls -d /boot/grub* >/dev/null 2>&1; then + CONFIG_BOOT_DEV="$i" + return 0 + fi fi done