From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TE59B-0005u0-0s for mharc-grub-devel@gnu.org; Tue, 18 Sep 2012 17:15:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47280) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE598-0005tO-90 for grub-devel@gnu.org; Tue, 18 Sep 2012 17:15:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TE596-0005nL-SJ for grub-devel@gnu.org; Tue, 18 Sep 2012 17:15:54 -0400 Received: from april.london.02.net ([87.194.255.143]:49765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TE596-0005n9-Gh for grub-devel@gnu.org; Tue, 18 Sep 2012 17:15:52 -0400 Received: from coldfusion.catcity.dyndns.org (87.194.150.96) by april.london.02.net (8.5.140) id 4FED9C490226D33F for grub-devel@gnu.org; Tue, 18 Sep 2012 22:15:51 +0100 Received: from localhost (localhost [127.0.0.1]) by coldfusion.catcity.dyndns.org (Postfix) with ESMTP id 635C38BC3E for ; Tue, 18 Sep 2012 22:15:50 +0100 (BST) Received: from coldfusion.catcity.dyndns.org ([127.0.0.1]) by localhost (coldfusion.catcity.dyndns.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bfViQkUfn6ed for ; Tue, 18 Sep 2012 22:15:50 +0100 (BST) Received: from [192.168.0.4] (nebula.catcity.dyndns.org [192.168.0.4]) by coldfusion.catcity.dyndns.org (Postfix) with ESMTPSA id 2611A8BC2B for ; Tue, 18 Sep 2012 22:15:50 +0100 (BST) Message-ID: <5058E404.9010608@catcity.dyndns.org> Date: Tue, 18 Sep 2012 22:13:40 +0100 From: Pete Appleton User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120910 Thunderbird/15.0.1 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH] Allow user to choose between path or fs-label instead of UUID References: <505604DF.305@catcity.dyndns.org> <50560EFC.6080005@gmail.com> <50563BC8.3060004@catcity.dyndns.org> <505836C4.1040103@gmail.com> <5058BCD7.60109@catcity.dyndns.org> <5058C0AC.1060407@gmail.com> In-Reply-To: <5058C0AC.1060407@gmail.com> Content-Type: multipart/mixed; boundary="------------080402040602050902080703" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 87.194.255.143 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Sep 2012 21:15:55 -0000 This is a multi-part message in MIME format. --------------080402040602050902080703 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: Quoted-Printable On 18/09/12 19:42, Vladimir '=CF=86-coder/phcoder' Serbinenko wrote: > On 18.09.2012 20:26, Pete Appleton wrote: > >> GRUB_DEVICE_IDENTIFICATION renamed to LINUX_DEVICE_IDENTIFICATION >> GRUB_DEVICE_LABEL renamed to LINUX_DEVICE_LABEL as also Linux spe= cific >> GRUB_DEVICE_BOOT_LABEL removed completely as unused (was added >> purely for symmetry) >> if statements replaced by case > Linux-specific vars aren't exempted from the need to be in GRUB_* names= pace. Renamed LINUX_DEVICE_IDENTIFICATION to GRUB_DEVICE_IDENTIFICATION_LINUX Renamed LINUX_DEVICE_LABEL to GRUB_DEVICE_LABEL_LINUX Regards, Pete Appleton --------------080402040602050902080703 Content-Type: text/x-patch; name="linux_fslabel_support.patch" Content-Disposition: attachment; filename="linux_fslabel_support.patch" Content-Transfer-Encoding: 7Bit === modified file 'docs/grub.texi' --- old/docs/grub.texi 2012-07-31 22:18:57 +0000 +++ new/docs/grub.texi 2012-09-18 21:05:03 +0000 @@ -1285,6 +1285,19 @@ 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}. +@samp{GRUB_DEVICE_IDENTIFICATION_LINUX} governs the scheme used instead of +the UUID, either the file system label or the traditional device path + +@item GRUB_DEVICE_IDENTIFICATION_LINUX +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_SEARCH_METHOD +Governs the method used to generate the search directive (as opposed to the Linux root filesysttem) +using the same settings as @samp{GRUB_DEVICE_IDENTIFICATION_LINUX}. If unset or unrecognised +then GRUB will default to searching by UUID @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-18 21:05:03 +0000 @@ -131,6 +131,7 @@ # 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_LINUX="`${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`" @@ -170,11 +171,19 @@ 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_LINUX is undefined or unrecognised +case "x${GRUB_DEVICE_IDENTIFICATION_LINUX}" in + xuuid) ;; + xlabel) ;; + xpath)) ;; + *) LINUX_DEVICE_IDENTIFCATION = uuid ;; +esac # These are defined in this script, export them here so that user can # override them. export GRUB_DEVICE \ GRUB_DEVICE_UUID \ + GRUB_DEVICE_LABEL_LINUX \ GRUB_DEVICE_BOOT \ GRUB_DEVICE_BOOT_UUID \ GRUB_FS \ @@ -216,7 +225,9 @@ GRUB_INIT_TUNE \ GRUB_SAVEDEFAULT \ GRUB_ENABLE_CRYPTODISK \ - GRUB_BADRAM + GRUB_BADRAM \ + GRUB_DEVICE_IDENTIFICATION_LINUX \ + GRUB_SEARCH_METHOD if test "x${grub_cfg}" != "x"; then rm -f "${grub_cfg}.new" === 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-18 18:15:21 +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_SEARCH_METHOD # 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_SEARCH_METHOD}" = "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-18 21:10:51 +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_LINUX" in + xpath) + LINUX_ROOT_DEVICE=${GRUB_DEVICE} + ;; + xlabel) + if [ "x${GRUB_DEVICE_LABEL_LINUX}" = "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_LINUX}\" + 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`" --------------080402040602050902080703--