[readonly/geninitrd/devel: 182/334] Try to load only required LVM module (needs testing with LVM1 tools and LVM2 tools using lvm1 metada

draenog draenog at pld-linux.org
Sat Nov 2 19:26:49 CET 2013


commit 93d781d1b77f4d56110ed454b3f1cfd977ca4637
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Fri Jan 30 00:35:26 2004 +0000

    Try to load only required LVM module (needs testing with LVM1 tools and LVM2 tools using lvm1 metadata)
    
    svn-id: @3226

 geninitrd | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 4e862b6..9547d61 100755
--- a/geninitrd
+++ b/geninitrd
@@ -585,6 +585,7 @@ find_modules_for() {
 		fi
 		if [ -z "$PVDEVICES" ] ; then
     		    VGVOLUME=$(/sbin/lvdisplay -c "$1" 2> /dev/null | awk -F":" ' { print $2 } ')
+		    VGFORMAT=$(/sbin/vgdisplay "${VGVOLUME}" 2> /dev/null | awk ' /Format/ { print $2 } ')
     		    PVDEVICES=$(/sbin/pvdisplay -c | awk -F":" -v vg="$VGVOLUME" ' BEGIN { devices="" } { if ($2 == vg) { devices = devices " " $1 } } END { print devices } ')
 		fi
 		if [ -n "$PVDEVICES" ] ; then
@@ -596,9 +597,16 @@ find_modules_for() {
 			echo "You can try to set PVDEVICES in /etc/sysconfig/geninitrd."
 			exit 1
 		fi
-		findmodule "-dm-mod"
-		findmodule "-lvm"
-		findmodule "-lvm-mod"
+		if [ "$VGFORMAT" = "lvm2" ]; then
+    		    findmodule "-dm-mod"
+		elif [ "$VGFORMAT" = "lvm1" ]; then
+    		    findmodule "-lvm"
+    		    findmodule "-lvm-mod"
+		else
+		    findmodule "-dm-mod"
+		    findmodule "-lvm"
+		    findmodule "-lvm-mod"
+		fi
 		uselvm="yes"
 	fi
 }
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/398807324938659207036e520c0950a61ef50c11



More information about the pld-cvs-commit mailing list