a56a5e
From 4fde4d06474cdf321958592edf3f856446927d29 Mon Sep 17 00:00:00 2001
90b079
From: Alexander Tsoy <alexander@tsoy.me>
90b079
Date: Sun, 29 Sep 2013 01:31:01 +0400
90b079
Subject: [PATCH] mdraid/module-setup.sh: fixes for mdadm-3.2.6+
90b079
90b079
mdadm-3.2.6+:
90b079
Incremental assembly rule contains "--offroot" arg. Update
90b079
regexp to catch this variant.
90b079
90b079
mdadm-3.3+:
90b079
Rules was splitted into two files: 63-md-raid-arrays.rules
90b079
and 64-md-raid-assembly.rules. Install them both and edit
90b079
the latter.
90b079
---
90b079
 modules.d/90mdraid/module-setup.sh | 11 ++++++++++-
90b079
 1 file changed, 10 insertions(+), 1 deletion(-)
90b079
90b079
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
1755ca
index 45767c67..34aae1e3 100755
90b079
--- a/modules.d/90mdraid/module-setup.sh
90b079
+++ b/modules.d/90mdraid/module-setup.sh
90b079
@@ -59,6 +59,7 @@ cmdline() {
90b079
 }
90b079
 
90b079
 install() {
90b079
+    local rule rule_path
90b079
     inst_multiple cat
90b079
     inst_multiple -o mdmon
90b079
     inst $(command -v partx) /sbin/partx
90b079
@@ -67,12 +68,20 @@ install() {
90b079
     cmdline  >> "${initdir}/etc/cmdline.d/90mdraid.conf"
90b079
     echo  >> "${initdir}/etc/cmdline.d/90mdraid.conf"
90b079
 
90b079
+    # 
90b079
     inst_rules 64-md-raid.rules
90b079
+    # >=mdadm-3.3 udev rules
90b079
+    inst_rules 63-md-raid-arrays.rules 64-md-raid-assembly.rules
90b079
     # remove incremental assembly from stock rules, so they don't shadow
90b079
     # 65-md-inc*.rules and its fine-grained controls, or cause other problems
90b079
     # when we explicitly don't want certain components to be incrementally
90b079
     # assembled
90b079
-    sed -i -r -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode)"/d' "${initdir}${udevdir}/rules.d/64-md-raid.rules"
90b079
+    for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
90b079
+        rule_path="${initdir}${udevdir}/rules.d/${rule}"
90b079
+        [ -f "${rule_path}" ] && sed -i -r \
90b079
+            -e '/RUN\+?="[[:alpha:]/]*mdadm[[:blank:]]+(--incremental|-I)[[:blank:]]+(\$env\{DEVNAME\}|\$tempnode|\$devnode)/d' \
90b079
+            "${rule_path}"
90b079
+    done
90b079
 
90b079
     inst_rules "$moddir/65-md-incremental-imsm.rules"
90b079