From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1TDtZt-0001ta-UB for mharc-grub-devel@gnu.org; Tue, 18 Sep 2012 04:54:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDtZo-0001qi-Ad for grub-devel@gnu.org; Tue, 18 Sep 2012 04:54:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TDtZg-0002C9-MP for grub-devel@gnu.org; Tue, 18 Sep 2012 04:54:40 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:65465) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TDtZg-0002At-D7 for grub-devel@gnu.org; Tue, 18 Sep 2012 04:54:32 -0400 Received: by wgbdt14 with SMTP id dt14so1812171wgb.30 for ; Tue, 18 Sep 2012 01:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type; bh=8hZNdogAx48AdJxHhrCZ6x/ukT1YrZVVZI8/12BZOy8=; b=dujP+eOW2FyJREvnS+wwffLa2SKCbn1J4+nZhw04MWE1fc8hztbgiQNOXBGG/v4itz 3S7roDAQc0H3uxIGRRqunzWrPzaHKf5lrS/uXvnmcfxzufVlPbPpB6vrjb6DJDCgDq2a DrGSrUf7HjhGjloHB6JfZ7O6eRHVg6hCs/ZZCPcWYDQ2uhUcBUzjrN7hJKkaIucXg8ph Uf7Q4CsPNJjAOuK+kVZByCLMnBJsIH8iSYy7AoStYNvpCw70aeeUkdZhgGR/Uth5ayIW rKQt4EZg7733UzxdQK5BoKVnRV8/BaBEkwxWsxJqMgB0O9kxrVPS+Xl0Y2pdx8ed2jro 75Ng== Received: by 10.217.1.7 with SMTP id m7mr7698025wes.158.1347958471247; Tue, 18 Sep 2012 01:54:31 -0700 (PDT) Received: from debian.x201.phnet (68-73.106-92.cust.bluewin.ch. [92.106.73.68]) by mx.google.com with ESMTPS id j6sm30802186wiy.4.2012.09.18.01.54.30 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Sep 2012 01:54:30 -0700 (PDT) Message-ID: <505836C4.1040103@gmail.com> Date: Tue, 18 Sep 2012 10:54:28 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120817 Icedove/10.0.6 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> In-Reply-To: <50563BC8.3060004@catcity.dyndns.org> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enigDC33775281220BFEF2070A70" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 74.125.82.49 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 08:54:45 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigDC33775281220BFEF2070A70 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 16.09.2012 22:51, Pete Appleton wrote: >=20 > On 16/09/12 18:40, Vladimir '=CF=86-coder/phcoder' Serbinenko wrote: >> On 16.09.2012 18:57, Pete Appleton wrote: >> >>> Hi all, >>> >>> The file attached is intended to allow a Linux user to easily specify= >>> whether GRUB2 should use the traditional device path (/dev/sda1) or t= he >>> filesystem label instead of the default UUID scheme. This functional= ity >>> is currently supported by GRUB2 itself but the peripheral files >>> (grub-mkconfig, 10-linux etc) don't directly support it, requiring th= e >>> user to edit the distribution-supplied files on their installation wi= th >>> the potential for consequent upgrade conflicts. >>> >>> This patch adds support for a new environment variable >>> GRUB_DEVICE_IDENTIFICATION taking as value one of {uuid, label, path}= ; >>> if not set or invalid then it defaults to uuid so that the current >>> semantics are respected. If set to label then the 'search' clause an= d >>> root=3DXXX kernel parameter are written using file system label synta= x as >>> opposed to the current single behaviour of device path if >>> GRUB_DISABLE_LINUX_UUID=3Dtrue >> >> In this patch the same option has effect on both how device is passed = to >> kernel and how it's identified internally. These 2 parts should be kep= t >> separate. >=20 > Update attached which splits the option into GRUB_DEVICE_IDENTIFICATION= > (used by 10-linux for the root FS) This is Linux-specific then, so it has to contain "LINUX" in its name. > and GRUB_SEARCH_METHOD, used by > grub-mkconfig to generate the search clause. >=20 > Pete Appleton >=20 > linux_fslabel_support.patch >=20 >=20 > =3D=3D=3D modified file 'docs/grub.texi' > --- old/docs/grub.texi 2012-07-31 22:18:57 +0000 > +++ new/docs/grub.texi 2012-09-16 20:45:58 +0000 > @@ -1285,6 +1285,19 @@ > the Linux kernel, using a @samp{root=3DUUID=3D...} kernel parameter. = This is > usually more reliable, but in some cases it may not be appropriate. T= o > disable the use of UUIDs, set this option to @samp{true}. > +@samp{GRUB_DEVICE_IDENTIFICATION} governs the scheme used instead of > +the UUID, either the file system label or the traditional device path > + > +@item 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{u= uid}, which will use UUIDs.=20 > +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 t= o the Linux root filesysttem) > +using the same settings as @samp{GRUB_DEVICE_IDENTIFICATION}. If unse= t or unrecognised > +then GRUB will default to searching by UUID > =20 > @item GRUB_DISABLE_RECOVERY > If this option is set to @samp{true}, disable the generation of recove= ry >=20 > =3D=3D=3D 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 20:42:56 +0000 > @@ -131,10 +131,12 @@ > # Device containing our userland. Typically used for root=3D paramete= r. > GRUB_DEVICE=3D"`${grub_probe} --target=3Ddevice /`" > GRUB_DEVICE_UUID=3D"`${grub_probe} --device ${GRUB_DEVICE} --target=3D= fs_uuid 2> /dev/null`" || true > +GRUB_DEVICE_LABEL=3D"`${grub_probe} --device ${GRUB_DEVICE} --target=3D= fs_label 2> /dev/null`" || true > =20 > # Device containing our /boot partition. Usually the same as GRUB_DEV= ICE. > GRUB_DEVICE_BOOT=3D"`${grub_probe} --target=3Ddevice /boot`" > GRUB_DEVICE_BOOT_UUID=3D"`${grub_probe} --device ${GRUB_DEVICE_BOOT} -= -target=3Dfs_uuid 2> /dev/null`" || true > +GRUB_DEVICE_BOOT_LABEL=3D"`${grub_probe} --device ${GRUB_DEVICE_BOOT} = --target=3Dfs_label 2> /dev/null`" ||=20 > "true" was lost. Also it doesn't seem that you use this variable anywhere. =20 > # Filesystem for the device containing our userland. Used for stuff l= ike > # choosing Hurd filesystem module. > @@ -170,13 +172,24 @@ > =20 > if [ "x${GRUB_ACTUAL_DEFAULT}" =3D "xsaved" ] ; then GRUB_ACTUAL_DEFAU= LT=3D"`"${grub_editenv}" - list | sed -n '/^saved_entry=3D/ s,^saved_entr= y=3D,,p'`" ; fi > =20 > +# Default to UUID if GRUB_DEVICE_IDENTIFICATION is undefined or unreco= gnised > +if [ "x${GRUB_DEVICE_IDENTIFICATION}" =3D "x" ] ; then GRUB_DEVICE_IDE= NTIFICATION=3D"uuid" ; fi > +if [ "${GRUB_DEVICE_IDENTIFICATION}" !=3D "uuid" -a "${GRUB_DEVICE_IDE= NTIFICATION}" !=3D "label" -a "${GRUB_DEVICE_IDENTIFICATION}" !=3D "path"= ] ; then > + GRUB_DEVICE_IDENTIFICATION=3D"uuid" > +fi > +if [ "x${GRUB_SEARCH_METHOD}" =3D "x" ] ; then GRUB_SEARCH_METHOD=3D"u= uid" ; fi > +if [ "${GRUB_SEARCH_METHOD}" !=3D "uuid" -a "${GRUB_SEARCH_METHOD}" !=3D= "label" -a "${GRUB_SEARCH_METHOD}" !=3D "path" ] ; then > + GRUB_SEARCH_METHOD=3D"uuid" > +fi > =20 case ... esac would be much more appropriate in this case. > # 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 \ > @@ -216,7 +229,9 @@ > GRUB_INIT_TUNE \ > GRUB_SAVEDEFAULT \ > GRUB_ENABLE_CRYPTODISK \ > - GRUB_BADRAM > + GRUB_BADRAM \ > + GRUB_DEVICE_IDENTIFICATION \ > + GRUB_SEARCH_METHOD > =20 > if test "x${grub_cfg}" !=3D "x"; then > rm -f "${grub_cfg}.new" >=20 > =3D=3D=3D 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 20:43:31 +0000 > @@ -146,22 +146,30 @@ > done > fi > =20 > - # 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 iden= tifying, use it according to GRUB_SEARCH_METHOD > # otherwise set root as per value in device.map. > fs_hint=3D"`"${grub_probe}" --device "${device}" --target=3Dcompatib= ility_hint`" > if [ "x$fs_hint" !=3D x ]; then > echo "set root=3D'$fs_hint'" > fi > - if fs_uuid=3D"`"${grub_probe}" --device "${device}" --target=3Dfs_uu= id 2> /dev/null`" ; then > + if [ "x${GRUB_SEARCH_METHOD}" =3D "xlabel" ] && fs_label=3D"`"${grub= _probe}" --device "${device}" --target=3Dfs_label 2> /dev/null`" ; then > hints=3D"`"${grub_probe}" --device "${device}" --target=3Dhints_st= ring 2> /dev/null`" || hints=3D > echo "if [ x\$feature_platform_search_hint =3D xy ]; then" > - echo " search --no-floppy --fs-uuid --set=3Droot ${hints} ${fs_uu= id}" > + echo " search --no-floppy --label --set=3Droot ${hints} ${fs_labe= l}" > echo "else" > - echo " search --no-floppy --fs-uuid --set=3Droot ${fs_uuid}" > + echo " search --no-floppy --label --set=3Droot ${fs_label}" > echo "fi" > + else > + if fs_uuid=3D"`"${grub_probe}" --device "${device}" --target=3Dfs_= uuid 2> /dev/null`" ; then > + hints=3D"`"${grub_probe}" --device "${device}" --target=3Dhints_= string 2> /dev/null`" || hints=3D > + echo "if [ x\$feature_platform_search_hint =3D xy ]; then" > + echo " search --no-floppy --fs-uuid --set=3Droot ${hints} ${fs_= uuid}" > + echo "else" > + echo " search --no-floppy --fs-uuid --set=3Droot ${fs_uuid}" > + echo "fi" > + fi > fi > } > - > grub_get_device_id () > { > device=3D"$1" >=20 > =3D=3D=3D 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 > =20 > -if [ "x${GRUB_DEVICE_UUID}" =3D "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID= }" =3D "xtrue" ] \ > - || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ > - || uses_abstraction "${GRUB_DEVICE}" lvm; then > - LINUX_ROOT_DEVICE=3D${GRUB_DEVICE} > -else > - LINUX_ROOT_DEVICE=3DUUID=3D${GRUB_DEVICE_UUID} > -fi > +case x"$GRUB_DEVICE_IDENTIFICATION" in > + xpath) > + LINUX_ROOT_DEVICE=3D${GRUB_DEVICE} > + ;; > + xlabel) > + if [ "x${GRUB_DEVICE_LABEL}" =3D "x" ] \ > + || ! test -e "/dev/disk/by-label/${GRUB_DEVICE_LABEL}" \ > + || uses_abstraction "${GRUB_DEVICE}" lvm; then > + LINUX_ROOT_DEVICE=3D${GRUB_DEVICE} > + else > + LINUX_ROOT_DEVICE=3DLABEL=3D\"${GRUB_DEVICE_LABEL}\" > + fi;; > + *) > + if [ "x{GRUB_DEVICE_UUID}" =3D "x" ] \ > + || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" \ > + || uses_abstraction "${GRUB_DEVICE}" lvm; then > + LINUX_ROOT_DEVICE=3D${GRUB_DEVICE} > + else > + LINUX_ROOT_DEVICE=3DUUID=3D${GRUB_DEVICE_UUID} > + fi;; =20 > +esac > =20 > GRUBFS=3D"`${grub_probe} --device ${GRUB_DEVICE} --target=3Dfs 2>/dev/= null || true`" > =20 >=20 >=20 >=20 >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel --=20 Regards Vladimir '=CF=86-coder/phcoder' Serbinenko --------------enigDC33775281220BFEF2070A70 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAlBYNsQACgkQNak7dOguQgmWKwD/Q4V7WBMP8as5yw7c122BZxqy HsiaeKumm9VZaX/+1cAA/iOK4UQ0BUKHMWpamqJoi4g2YgC/Svnx31K/caeXgrRi =utwu -----END PGP SIGNATURE----- --------------enigDC33775281220BFEF2070A70--