[packages/grub2] grub-mkconfig: use lvs to expand LVM path. more reliable

glen glen at pld-linux.org
Mon Jan 13 15:14:52 CET 2014


commit 139b6f37ee04d68656322ccc2462aeef101ff6b7
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Mon Jan 13 16:14:20 2014 +0200

    grub-mkconfig: use lvs to expand LVM path. more reliable

 grub-lvmdevice.patch | 23 ++++++++---------------
 grub2.spec           |  6 +++---
 2 files changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/grub2.spec b/grub2.spec
index 81fa5a9..a3c267f 100644
--- a/grub2.spec
+++ b/grub2.spec
@@ -44,10 +44,10 @@ Summary(de.UTF-8):	GRUB2 - ein Bootloader für x86 und ppc
 Summary(hu.UTF-8):	GRUB2 - rendszerbetöltő x86 és ppc gépekhez
 Summary(pl.UTF-8):	GRUB2 - bootloader dla x86 i ppc
 Summary(pt_BR.UTF-8):	Gerenciador de inicialização GRUB2
+%define	beta	beta2
 Name:		grub2
 Version:	2.02
-%define	beta	beta2
-Release:	0.%{beta}.1
+Release:	0.%{beta}.2
 License:	GPL v2
 Group:		Base
 # git://git.savannah.gnu.org/grub.git
@@ -60,7 +60,7 @@ Source3:	grub.sysconfig
 Source4:	grub-custom.cfg
 # ./linguas.sh
 # TS=$(date +'%Y%m%d') ; tar cjvf grub-po-2.00.git$TS.tar.bz2 po/*.po po/LINGUAS
-Source5:	grub-po-2.02.git20140104.tar.bz2
+Source5:	grub-po-%{version}.git20140104.tar.bz2
 # Source5-md5:	aeef3e636178093cf9d780d92da7afdb
 Patch1:		pld-sysconfdir.patch
 Patch2:		grub-garbage.patch
diff --git a/grub-lvmdevice.patch b/grub-lvmdevice.patch
index 7b9c251..0f9d87f 100644
--- a/grub-lvmdevice.patch
+++ b/grub-lvmdevice.patch
@@ -1,7 +1,6 @@
-diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub-mkconfig.in grub-2.02~beta2/util/grub-mkconfig.in
---- grub-2.02~beta2.orig/util/grub-mkconfig.in	2014-01-04 10:59:07.595221161 +0100
-+++ grub-2.02~beta2/util/grub-mkconfig.in	2014-01-04 11:00:01.898554984 +0100
-@@ -130,6 +130,27 @@
+--- grub-2.02~beta2/util/grub-mkconfig.in~	2014-01-13 16:12:41.020705075 +0200
++++ grub-2.02~beta2/util/grub-mkconfig.in	2014-01-13 16:10:42.000000000 +0200
+@@ -131,6 +131,21 @@
  
  # Device containing our userland.  Typically used for root= parameter.
  GRUB_DEVICE="`${grub_probe} --target=device /`"
@@ -12,17 +11,11 @@ diff -dur -x '*~' -x '*.orig' grub-2.02~beta2.orig/util/grub-mkconfig.in grub-2.
 +# /dev/mapper/vg--meaw-root -> /dev/vg-meaw/root
 +case "$GRUB_DEVICE" in
 +	/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
++		LVM2_LV_NAME='' LVM2_VG_NAME=''
++		eval $(lvs --noheadings --nameprefixes "$GRUB_DEVICE" 2>/dev/null)
++		if [ -n "$LVM2_VG_NAME$LVM2_LV_NAME" ]; then
++			GRUB_DEVICE=/dev/$LVM2_VG_NAME/$LVM2_LV_NAME
++		fi
 +	;;
 +esac
 +
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list