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/profiles/templates/3.6/6_ac_install_patch/sys-boot/grub/2.00/grub2-lvm.patch

58 lines
2.3 KiB

# Calculate format=diff merge(sys-boot/grub)>=2.00
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 util/grub-install.in util/grub-install.in
index aa978c8..f85d257 100644
--- util/grub-install.in
+++ util/grub-install.in
@@ -571,6 +571,11 @@ fi
# Create the core image. First, auto-detect the filesystem module.
fs_module="`echo "${grub_device}" | xargs "$grub_probe" --device-map="${device_map}" --target=fs --device `"
+# sometimes filesystem on LVM (place in /dev/mapper) is not detected. Try detect by /dev/dm-X
+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
gettext_printf "Auto-detection of a filesystem of %s failed.\n" "${grub_device}" 1>&2
gettext "Try with --recheck." 1>&2
diff --git util/grub-mkconfig_lib.in util/grub-mkconfig_lib.in
index 76133b4..04241d9 100644
--- util/grub-mkconfig_lib.in
+++ util/grub-mkconfig_lib.in
@@ -60,7 +60,11 @@ 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
+ # sometimes filesystem on LVM (place in /dev/mapper) is not detected. Try detect by /dev/dm-X
+ 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
@@ -135,7 +139,13 @@ prepare_grub_to_access_device ()
echo "insmod ${module}"
done
- fs="`"${grub_probe}" --device "${device}" --target=fs`"
+ # sometimes filesystem on LVM (place in /dev/mapper) is not detected. Try detect by /dev/dm-X
+ 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