You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-overlay/sys-boot/grub/files/grub-1.99-lvm_mapper-r1.patch

59 lines
2.3 KiB

commit 12564fda0ef25d65db2ef2da444abde448a87a71
Author: Mike Hiretsky <mh@calculate.ru>
Date: Tue Jul 26 18:20:55 2011 +0400
Fix detect filesystem for lvm.
Fix readable_by_grub, prepare_grub_access_device for LVM. Fix
grub-install.
Sometimes program cann't determine fs for device by path /dev/mapper.
For resolve the problem filesystem for that devices determined by device
to which they point. (readlink -f)
diff --git a/util/grub-install.in b/util/grub-install.in
index 16236ba..7ebbb50 100644
--- a/util/grub-install.in
+++ b/util/grub-install.in
@@ -466,6 +466,10 @@ fi
# Create the core image. First, auto-detect the filesystem module.
fs_module="`"$grub_probe" --device-map="${device_map}" --target=fs --device "${grub_device}"`"
if test "x$fs_module" = x ; then
+ grub_device_fs=$(readlink -f ${grub_device})
+ fs_module="`"$grub_probe" --device-map="${device_map}" --target=fs --device "${grub_device_fs}"`"
+fi
+if test "x$fs_module" = x ; then
echo "Auto-detection of a filesystem of ${grub_device} failed." 1>&2
echo "Try with --recheck." 1>&2
echo "If the problem persists please report this together with the output of \"$grub_probe --device-map=\"${device_map}\" --target=fs -v ${grubdir}\" to <bug-grub@gnu.org>" 1>&2
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
index 2c5fd8c..ace6c28 100644
--- a/util/grub-mkconfig_lib.in
+++ b/util/grub-mkconfig_lib.in
@@ -58,7 +58,10 @@ is_path_readable_by_grub ()
# abort if file is in a filesystem we can't read
if "${grub_probe}" -t fs "$path" > /dev/null 2>&1 ; then : ; else
- return 1
+ fsdevice=`readlink -f $(${grub_probe} -t device "$path" 2>/dev/null)`
+ if "${grub_probe}" -t fs -d "${fsdevice}" > /dev/null 2>&1 ; then : ; else
+ return 1
+ fi
fi
# ... or if we can't figure out the abstraction module, for example if
@@ -121,7 +124,12 @@ prepare_grub_to_access_device ()
esac
done
- fs="`"${grub_probe}" --device "${device}" --target=fs`"
+ if "${grub_probe}" --device "${device}" --target=fs >/dev/null 2>/dev/null; then
+ device_fs="${device}"
+ else
+ device_fs=`readlink -f "${device}"`
+ fi
+ fs="`"${grub_probe}" --device "${device_fs}" --target=fs`"
for module in ${fs} ; do
echo "insmod ${module}"
done