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

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