[packages/grub2] Mangle root device name only for LVM devices, release 5

wiget wiget at pld-linux.org
Wed Nov 20 17:54:39 CET 2013


commit d889a8f501d3bff5468b82370de3be7bdb48d38d
Author: Artur Frysiak <artur at frysiak.net>
Date:   Wed Nov 20 17:53:25 2013 +0100

    Mangle root device name only for LVM devices, release 5

 grub-lvmdevice.patch | 22 ++++++++++++++--------
 grub2.spec           |  2 +-
 2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/grub2.spec b/grub2.spec
index 1fb1eee..fe41c70 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -46,7 +46,7 @@ Summary(pl.UTF-8):	GRUB2 - bootloader dla x86 i ppc
 Summary(pt_BR.UTF-8):	Gerenciador de inicialização GRUB2
 Name:		grub2
 Version:	2.00
-Release:	4
+Release:	5
 License:	GPL v2
 Group:		Base
 Source0:	http://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz
diff --git a/grub-lvmdevice.patch b/grub-lvmdevice.patch
index 53324ec..8f04e80 100644
--- a/grub-lvmdevice.patch
+++ b/grub-lvmdevice.patch
@@ -1,6 +1,6 @@
 --- grub-1.97.1/util/grub-mkconfig.in~	2009-11-17 17:02:16.626243372 +0200
 +++ grub-1.97.1/util/grub-mkconfig.in	2009-11-17 17:02:08.346050859 +0200
-@@ -120,6 +120,21 @@
+@@ -120,6 +120,27 @@
  
  # Device containing our userland.  Typically used for root= parameter.
  GRUB_DEVICE="`${grub_probe} --target=device /`"
@@ -10,13 +10,19 @@
 +# /dev/mapper/blodnatt-blah--bleh -> /dev/blodnatt/blah-bleh
 +# /dev/mapper/vg--meaw-root -> /dev/vg-meaw/root
 +case "$GRUB_DEVICE" in
-+/dev/mapper/*-*)
-+	# change "--" to / (as "/" is impossible in LV name)
-+	local dev=$(awk -vdev="${GRUB_DEVICE#/dev/mapper/}" 'BEGIN{gsub(/--/, "/", dev); print dev}')
-+	local VG=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[1]); print v[1]}')
-+	local LV=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[2]); print v[2]}')
-+	GRUB_DEVICE=/dev/$VG/$LV
-+;;
++	/dev/mapper/*-*)
++		DM_REAL_DEVICE="$(readlink -f "$GRUB_DEVICE")"
++		DM_UUID="$(cat /sys/block/${DM_REAL_DEVICE#/dev/}/dm/uuid)"
++		case "$DM_UUID" in
++			LVM-*)
++				# change "--" to / (as "/" is impossible in LV name)
++				local dev=$(awk -vdev="${GRUB_DEVICE#/dev/mapper/}" 'BEGIN{gsub(/--/, "/", dev); print dev}')
++				local VG=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[1]); print v[1]}')
++				local LV=$(awk -vdev="$dev" 'BEGIN{split(dev, v, "-"); gsub("/", "-", v[2]); print v[2]}')
++				GRUB_DEVICE=/dev/$VG/$LV
++				;;
++		esac
++	;;
 +esac
 +
  GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/grub2.git/commitdiff/d889a8f501d3bff5468b82370de3be7bdb48d38d



More information about the pld-cvs-commit mailing list