[readonly/geninitrd: 463/1068] - typo (multipath part was always generated) - find_modules_dmraid() moved to function - $have_dmrai
draenog
draenog at pld-linux.org
Sat Nov 2 19:51:18 CET 2013
commit c083ae23a77ac6d3c416fd5b53326be8832126ce
Author: Elan Ruusamäe <glen at pld-linux.org>
Date: Wed Oct 24 18:45:34 2007 +0000
- typo (multipath part was always generated)
- find_modules_dmraid() moved to function
- $have_dmraid variable to denote dmraid status
svn-id: @8859
geninitrd | 64 ++++++++++++++++++++++++++++++++++++++++-----------------------
1 file changed, 41 insertions(+), 23 deletions(-)
---
diff --git a/geninitrd b/geninitrd
index 38578f1..192be4c 100755
--- a/geninitrd
+++ b/geninitrd
@@ -59,12 +59,15 @@ tmpfs_dev=no
proc_partitions=no
# dmraid component devices of rootfs is on dmraid
dmraid_devices=''
+
# if we should init NFS at boot
have_nfs=no
# if we should init LVM at boot
have_lvm=no
# if we should init md (softraid) at boot
have_md=no
+# if we should init dmraid at boot
+have_dmraid=no
# if we should init dm-multipath at boot
have_multipath=no
@@ -553,6 +556,34 @@ find_modules_multipath() {
return 0
}
+# find dmraid modules for $devpath
+# returns false if $devpath is not on dmraid
+find_modules_dmraid() {
+ local devpath="$1"
+
+ # get blockdev itself (without partition)
+ # /dev/mapper/sil_ahbgadcbchfc3 -> /dev/mapper/sil_ahbgadcbchfc
+ local blockdev=${devpath%%[0-9]*}
+ local raidname=${blockdev#/dev/mapper/}
+ local found=0
+
+ local dev phydevs=$(dmraid -r -cdevpath,raidname | awk -F, -vv="$raidname" '{if ($2 == v) print $1}')
+ for dev in $phydevs; do
+ find_modules_for_device $dev
+ dmraid_devices="$dmraid_devices $dev"
+ found=1
+ done
+
+ if [ $found = 0 ]; then
+ return 1
+ fi
+
+ # XXX probably should detect
+ findmodule "dm-mirror"
+ have_dmraid=yes
+ return 0
+}
+
# find modules for $devpath
find_modules_for_device() {
local devpath="$1"
@@ -597,6 +628,13 @@ find_modules_for_device() {
# fallback
fi
+ if is_yes "$USE_DMRAID" && is_yes "$(echo "$devpath" | awk '/^\/dev\/mapper\/(sil|hpt37x|hpt45x|isw|lsi|nvidia|pdc|sil|via|dos)_/ { print "yes"; }')"; then
+ if find_modules_dmraid "$devpath"; then
+ return
+ fi
+ # fallback
+ fi
+
if is_yes "$(echo "$devpath" | awk '/^\/dev\/(sd|scsi)/ { print "yes"; }')" ; then
find_modules_scsi
return
@@ -607,26 +645,6 @@ find_modules_for_device() {
return
fi
- if is_yes "$USE_DMRAID" && is_yes "$(echo "$devpath" | awk '/^\/dev\/mapper\/(sil|hpt37x|hpt45x|isw|lsi|nvidia|pdc|sil|via|dos)_/ { print "yes"; }')"; then
- # dmraid nodes taken from: `dmraid -l` output
- # XXX dmraid could say to us that /dev/dm-3 consists from /dev/sda, /dev/sdb
-
- local node
- # get blockdev itself (without partition)
- # /dev/mapper/sil_ahbgadcbchfc3 -> /dev/mapper/sil_ahbgadcbchfc
- local blockdev=${devpath%%[0-9]*}
- local raidname=${blockdev#/dev/mapper/}
- local dev phydevs=$(dmraid -r -cdevpath,raidname | awk -F, -vv="$raidname" '{if ($2 == v) print $1}'); do
- for dev in $phydevs; do
- find_modules_for_device $dev
- dmraid_devices="$dmraid_devices $dev"
- done
-
- # XXX probably should detect
- findmodule "dm-mirror"
- return
- fi
-
if is_yes "`echo "$devpath" | awk '/\/dev\/rd\// { print "yes"; }'`" ; then
findmodule "DAC960"
return
@@ -1506,7 +1524,7 @@ initrd_gen_lvm() {
if is_yes "$have_md"; then
echo " md_component_detection = 1" >> "$MNTIMAGE/etc/lvm.conf"
fi
- if [ "$dmraid_devices" ] || is_yes "$have_multipath"; then
+ if is_yes "$have_dmraid" || is_yes "$have_multipath"; then
echo ' types = [ "device-mapper", 254 ]' >> "$MNTIMAGE/etc/lvm.conf"
fi
if [ "$dmraid_devices" ]; then
@@ -1583,11 +1601,11 @@ if is_yes "$USE_TUXONICE"; then
initrd_gen_tuxonice
fi
-if [ "$dmraid_devices" ]; then
+if is_yes "$have_dmraid" ]; then
initrd_gen_dmraid
fi
-if [ "$have_multipath" ]; then
+if is_yes "$have_multipath"; then
initrd_gen_multipath
fi
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/readonly/geninitrd.git/commitdiff/147754ca159d40ca5eb541074dc043d8cbd92090
More information about the pld-cvs-commit
mailing list