=== modified file 'docs/grub.texi' --- old/docs/grub.texi 2012-07-31 22:18:57 +0000 +++ new/docs/grub.texi 2012-09-16 16:41:08 +0000 @@ -1285,6 +1285,14 @@ the Linux kernel, using a @samp{root=UUID=...} kernel parameter. This is usually more reliable, but in some cases it may not be appropriate. To disable the use of UUIDs, set this option to @samp{true}. address@hidden governs the scheme used instead of +the UUID, either the file system label or the traditional device path + address@hidden GRUB_DEVICE_IDENTIFICATION +Works in conjunction with GRUB_DISABLE_LINUX_UUID to determine how the root filesystem +will be identified for the Linux kernel. The default value is @samp{uuid}, which will use UUIDs. +Other alternatives are @samp{label} to use the file system label, or @samp{path} to use +the traditional device path (@samp{/dev/sda1}) @item GRUB_DISABLE_RECOVERY If this option is set to @samp{true}, disable the generation of recovery === modified file 'util/grub-mkconfig.in' --- old/util/grub-mkconfig.in 2012-04-07 17:49:25 +0000 +++ new/util/grub-mkconfig.in 2012-09-16 16:33:06 +0000 @@ -131,10 +131,12 @@ # Device containing our userland. Typically used for root= parameter. GRUB_DEVICE="`${grub_probe} --target=device /`" GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true +GRUB_DEVICE_LABEL="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_label 2> /dev/null`" || true # Device containing our /boot partition. Usually the same as GRUB_DEVICE. GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`" GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true +GRUB_DEVICE_BOOT_LABEL="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_label 2> /dev/null`" || # Filesystem for the device containing our userland. Used for stuff like # choosing Hurd filesystem module. @@ -170,13 +172,20 @@ if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub_editenv}" - list | sed -n '/^saved_entry=/ s,^saved_entry=,,p'`" ; fi +# Default to UUID if GRUB_DEVICE_IDENTIFICATION is undefined or unrecognised +if [ "x${GRUB_DEVICE_IDENTIFICATION}" = "x" ] ; then GRUB_DEVICE_IDENTIFICATION="uuid" ; fi +if [ "${GRUB_DEVICE_IDENTIFICATION}" != "uuid" -a "${GRUB_DEVICE_IDENTIFICATION}" != "label" -a "${GRUB_DEVICE_IDENTIFICATION}" != "path" ] ; then + GRUB_DEVICE_IDENTIFICATION="uuid" +fi # These are defined in this script, export them here so that user can # override them. export GRUB_DEVICE \ GRUB_DEVICE_UUID \ + GRUB_DEVICE_LABEL \ GRUB_DEVICE_BOOT \ GRUB_DEVICE_BOOT_UUID \ + GRUB_DEVICE_BOOT_LABEL \ GRUB_FS \ GRUB_FONT \ GRUB_PRELOAD_MODULES \ === modified file 'util/grub-mkconfig_lib.in' --- old/util/grub-mkconfig_lib.in 2012-07-22 18:02:17 +0000 +++ new/util/grub-mkconfig_lib.in 2012-09-16 16:15:50 +0000 @@ -146,22 +146,30 @@ done fi - # If there's a filesystem UUID that GRUB is capable of identifying, use it; + # If there's a filesystem UUID or label that GRUB is capable of identifying, use it according to GRUB_DEVICE_IDENTIFICATION # otherwise set root as per value in device.map. fs_hint="`"${grub_probe}" --device "${device}" --target=compatibility_hint`" if [ "x$fs_hint" != x ]; then echo "set root='$fs_hint'" fi - if fs_uuid="`"${grub_probe}" --device "${device}" --target=fs_uuid 2> /dev/null`" ; then + if [ "x${GRUB_DEVICE_IDENTIFICATION}" = "xlabel" ] && fs_label="`"${grub_probe}" --device "${device}" --target=fs_label 2> /dev/null`" ; then hints="`"${grub_probe}" --device "${device}" --target=hints_string 2> /dev/null`" || hints= echo "if [ x\$feature_platform_search_hint = xy ]; then" - echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}" + echo " search --no-floppy --label --set=root ${hints} ${fs_label}" echo "else" - echo " search --no-floppy --fs-uuid --set=root ${fs_uuid}" + echo " search --no-floppy --label --set=root ${fs_label}" echo "fi" + else + if fs_uuid="`"${grub_probe}" --device "${device}" --target=fs_uuid 2> /dev/null`" ; then + hints="`"${grub_probe}" --device "${device}" --target=hints_string 2> /dev/null`" || hints= + echo "if [ x\$feature_platform_search_hint = xy ]; then" + echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}" + echo "else" + echo " search --no-floppy --fs-uuid --set=root ${fs_uuid}" + echo "fi" + fi fi } - grub_get_device_id () { device="$1" === modified file 'util/grub.d/10_linux.in' --- old/util/grub.d/10_linux.in 2012-07-22 18:02:17 +0000 +++ new/util/grub.d/10_linux.in 2012-09-16 16:21:41 +0000 @@ -43,13 +43,27 @@ ;; esac -if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ - || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ - || uses_abstraction "${GRUB_DEVICE}" lvm; then - LINUX_ROOT_DEVICE=${GRUB_DEVICE} -else - LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} -fi +case x"$GRUB_DEVICE_IDENTIFICATION" in + xpath) + LINUX_ROOT_DEVICE=${GRUB_DEVICE} + ;; + xlabel) + if [ "x${GRUB_DEVICE_LABEL}" = "x" ] \ + || ! test -e "/dev/disk/by-label/${GRUB_DEVICE_LABEL}" \ + || uses_abstraction "${GRUB_DEVICE}" lvm; then + LINUX_ROOT_DEVICE=${GRUB_DEVICE} + else + LINUX_ROOT_DEVICE=LABEL=\"${GRUB_DEVICE_LABEL}\" + fi;; + *) + if [ "x{GRUB_DEVICE_UUID}" = "x" ] \ + || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ + || uses_abstraction "${GRUB_DEVICE}" lvm; then + LINUX_ROOT_DEVICE=${GRUB_DEVICE} + else + LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} + fi;; +esac GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`"