]> git.pld-linux.org Git - projects/geninitrd.git/blobdiff - mod-md.sh
find_depmod(): Return 0 in non-fatal cases (prevent non-zero exit codes from slipping).
[projects/geninitrd.git] / mod-md.sh
index 27c04e2cc514c97cbd7adf6252b4a9cdac9abff7..7d4d88404bac3dc3f63fc549edf77912b20f002f 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}
 
@@ -51,7 +52,7 @@ find_modules_md() {
                        found = "no";
                        dev_list = "";
                        raidlevel = ""
-                       rootdev_new = ""
+                       rootdev_new = rootdev
                        rootdev_alias = rootdev;
                        # alternative name: normalize from /dev/md/X to /dev/mdX
                        if (rootdev_alias ~ /\/dev\/md\/[0-9]+/) {
@@ -133,6 +134,9 @@ find_modules_md() {
 # generate initrd fragment for md
 # @access      public
 initrd_gen_md() {
+       if ! is_yes "$have_md"; then
+               return
+       fi
        debug "Setting up mdadm..."
 
        inst_exec $mdassemble /bin/mdassemble
@@ -140,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
This page took 0.027073 seconds and 4 git commands to generate.