packages: grub2/grub-lvmdevice.patch - lvm2: allow dash in PV too (geninitr...

glen glen at pld-linux.org
Tue Jan 12 11:16:42 CET 2010


Author: glen                         Date: Tue Jan 12 10:16:42 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- lvm2: allow dash in PV too (geninitrd merge)

---- Files affected:
packages/grub2:
   grub-lvmdevice.patch (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: packages/grub2/grub-lvmdevice.patch
diff -u packages/grub2/grub-lvmdevice.patch:1.1 packages/grub2/grub-lvmdevice.patch:1.2
--- packages/grub2/grub-lvmdevice.patch:1.1	Tue Nov 17 16:06:30 2009
+++ packages/grub2/grub-lvmdevice.patch	Tue Jan 12 11:16:36 2010
@@ -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,19 @@
+@@ -120,6 +120,21 @@
  
  # Device containing our userland.  Typically used for root= parameter.
  GRUB_DEVICE="`${grub_probe} --target=device /`"
@@ -8,11 +8,13 @@
 +# Rewrite to sane LVM node (Code from PLD Linux geninitrd):
 +# /dev/mapper/sys-rootfs -> /dev/sys/rootfs
 +# /dev/mapper/blodnatt-blah--bleh -> /dev/blodnatt/blah-bleh
++# /dev/mapper/vg--meaw-root -> /dev/vg-meaw/root
 +case "$GRUB_DEVICE" in
 +/dev/mapper/*-*)
-+	GRUB_DEVICE=${GRUB_DEVICE#/dev/mapper/}
-+	local VG=${GRUB_DEVICE%%-*}
-+	local LV=$(echo "${GRUB_DEVICE#$VG-}" | awk '{gsub(/--/, "-"); print}')
++	# 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
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/grub2/grub-lvmdevice.patch?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list