Blame SOURCES/0018-mdraid-module-setup.sh-fixes-for-mdadm-3.2.6.patch

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