]> git.pld-linux.org Git - projects/geninitrd.git/blobdiff - mod-md.sh
Version 12531.
[projects/geninitrd.git] / mod-md.sh
index 1b4c17c9f29739af6aef6797417d486fa507f7df..0c06e7285377bc7a32357122c1ad89ad59f778c5 100644 (file)
--- a/mod-md.sh
+++ b/mod-md.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
-#
+MD_RCSID='$Revision$ $Date::                            $'
+
 # geninitrd mod: mdadm
 USE_MD=${USE_MD:-yes}
 
@@ -143,15 +144,18 @@ initrd_gen_md() {
        # LVM on RAID case
        local dev_list_extra ex_dev
        dev_list_extra=$(awk '/^DEVICE / { for (i=2; i<=NF; i++) { printf "%s ", $i; }; } ' /etc/mdadm.conf | xargs)
-       if [ "$dev_list_extra" = "partitions" ]; then
-               # FIXME: handle this case (see man mdadm.conf)
-               echo "DEVICE partitions" >> "$DESTDIR/etc/mdadm.conf"
-               dev_list_extra=""
-       else
-               for ex_dev in $dev_list_extra; do
-                       echo "DEVICE $ex_dev" >> "$DESTDIR/etc/mdadm.conf"
-               done
-       fi
+       new_dev_list_extra=""
+       for ex_dev in $dev_list_extra; do
+               if [ "$ex_dev" = "partitions" ]; then
+                       echo "DEVICE partitions" >> "$DESTDIR/etc/mdadm.conf"
+                       # FIXME: find and copy partition devices from /proc/partitions
+                       #        - best if done at runtime, now initrd gen time
+                       continue
+               fi
+               echo "DEVICE $ex_dev" >> "$DESTDIR/etc/mdadm.conf"
+               new_dev_list_extra="$new_dev_list_extra $ex_dev"
+       done
+       dev_list_extra=$new_dev_list_extra
 
        local cr_rootdev cr_dev_list do_md0=1 nr cr_dev_list_md f cr_md_conf
        for nr in `seq 1 $rootdev_nr`; do
@@ -179,7 +183,13 @@ initrd_gen_md() {
                done
        done
 
-       echo "mdassemble" | add_linuxrc
+       add_linuxrc <<-EOF
+       mdassemble
+
+       if [ "$DEBUGINITRD" ]; then
+               [ -e /proc/mdstat ] && echo "/proc/mdstat contents:" && cat /proc/mdstat
+       fi
+       EOF
 
        # needed to determine md-version
        if [ "$do_md0" -eq 1 ]; then
This page took 0.068179 seconds and 4 git commands to generate.