9f65cc
From dc316701f752f5197a6a926a9a401688ffdb9bca Mon Sep 17 00:00:00 2001
9f65cc
From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
9f65cc
Date: Thu, 26 Nov 2020 13:04:44 +0100
9f65cc
Subject: [PATCH] fix(mdraid): remove offroot
9f65cc
9f65cc
offroot is deprecated and can be safety removed.
9f65cc
9f65cc
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
9f65cc
(cherry picked from commit 30e49d51751c695be85782cfc162de2a63db471c)
9f65cc
9f65cc
Resolves: #1958899
9f65cc
---
9f65cc
 modules.d/90mdraid/65-md-incremental-imsm.rules |  2 +-
9f65cc
 modules.d/90mdraid/md-shutdown.sh               |  5 ++---
9f65cc
 modules.d/90mdraid/mdraid-cleanup.sh            |  7 +++----
9f65cc
 modules.d/90mdraid/mdraid-waitclean.sh          |  7 +++----
9f65cc
 modules.d/90mdraid/mdraid_start.sh              | 10 +++-------
9f65cc
 modules.d/90mdraid/parse-md.sh                  |  2 --
9f65cc
 6 files changed, 12 insertions(+), 21 deletions(-)
9f65cc
9f65cc
diff --git a/modules.d/90mdraid/65-md-incremental-imsm.rules b/modules.d/90mdraid/65-md-incremental-imsm.rules
9f65cc
index 52f5b195..6697f159 100644
9f65cc
--- a/modules.d/90mdraid/65-md-incremental-imsm.rules
9f65cc
+++ b/modules.d/90mdraid/65-md-incremental-imsm.rules
9f65cc
@@ -39,6 +39,6 @@ RUN+="/sbin/initqueue --timeout --name 50-mdraid_start --onetime --unique /sbin/
9f65cc
 #
9f65cc
 LABEL="md_incremental"
9f65cc
 
9f65cc
-RUN+="/sbin/mdadm $env{rd_MD_OFFROOT} -I $env{DEVNAME}"
9f65cc
+RUN+="/sbin/mdadm -I $env{DEVNAME}"
9f65cc
 
9f65cc
 LABEL="md_end"
9f65cc
diff --git a/modules.d/90mdraid/md-shutdown.sh b/modules.d/90mdraid/md-shutdown.sh
9f65cc
index 400bb003..40c82570 100755
9f65cc
--- a/modules.d/90mdraid/md-shutdown.sh
9f65cc
+++ b/modules.d/90mdraid/md-shutdown.sh
9f65cc
@@ -3,12 +3,11 @@
9f65cc
 _do_md_shutdown() {
9f65cc
     local ret
9f65cc
     local final=$1
9f65cc
-    local _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
9f65cc
     info "Waiting for mdraid devices to be clean."
9f65cc
-    mdadm $_offroot -vv --wait-clean --scan| vinfo
9f65cc
+    mdadm -vv --wait-clean --scan| vinfo
9f65cc
     ret=$?
9f65cc
     info "Disassembling mdraid devices."
9f65cc
-    mdadm $_offroot -vv --stop --scan | vinfo
9f65cc
+    mdadm -vv --stop --scan | vinfo
9f65cc
     ret=$(($ret+$?))
9f65cc
     if [ "x$final" != "x" ]; then
9f65cc
         info "/proc/mdstat:"
9f65cc
diff --git a/modules.d/90mdraid/mdraid-cleanup.sh b/modules.d/90mdraid/mdraid-cleanup.sh
9f65cc
index 565449a5..007e581b 100755
9f65cc
--- a/modules.d/90mdraid/mdraid-cleanup.sh
9f65cc
+++ b/modules.d/90mdraid/mdraid-cleanup.sh
9f65cc
@@ -2,7 +2,6 @@
9f65cc
 
9f65cc
 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
9f65cc
 
9f65cc
-_offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
9f65cc
 containers=""
9f65cc
 for md in /dev/md[0-9_]*; do
9f65cc
     [ -b "$md" ] || continue
9f65cc
@@ -12,11 +11,11 @@ for md in /dev/md[0-9_]*; do
9f65cc
         containers="$containers $md"
9f65cc
         continue
9f65cc
     fi
9f65cc
-    mdadm $_offroot -S "$md" >/dev/null 2>&1
9f65cc
+    mdadm -S "$md" >/dev/null 2>&1
9f65cc
 done
9f65cc
 
9f65cc
 for md in $containers; do
9f65cc
-    mdadm $_offroot -S "$md" >/dev/null 2>&1
9f65cc
+    mdadm -S "$md" >/dev/null 2>&1
9f65cc
 done
9f65cc
 
9f65cc
-unset containers udevinfo _offroot
9f65cc
+unset containers udevinfo
9f65cc
diff --git a/modules.d/90mdraid/mdraid-waitclean.sh b/modules.d/90mdraid/mdraid-waitclean.sh
9f65cc
index 5c901982..0a7480f7 100755
9f65cc
--- a/modules.d/90mdraid/mdraid-waitclean.sh
9f65cc
+++ b/modules.d/90mdraid/mdraid-waitclean.sh
9f65cc
@@ -1,7 +1,6 @@
9f65cc
 #!/bin/sh
9f65cc
 
9f65cc
 if getargbool 0 rd.md.waitclean; then
9f65cc
-    _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
9f65cc
     type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
9f65cc
     containers=""
9f65cc
     for md in /dev/md[0-9_]*; do
9f65cc
@@ -13,13 +12,13 @@ if getargbool 0 rd.md.waitclean; then
9f65cc
             continue
9f65cc
         fi
9f65cc
         info "Waiting for $md to become clean"
9f65cc
-        mdadm $_offroot -W "$md" >/dev/null 2>&1
9f65cc
+        mdadm -W "$md" >/dev/null 2>&1
9f65cc
     done
9f65cc
 
9f65cc
     for md in $containers; do
9f65cc
         info "Waiting for $md to become clean"
9f65cc
-        mdadm $_offroot -W "$md" >/dev/null 2>&1
9f65cc
+        mdadm -W "$md" >/dev/null 2>&1
9f65cc
     done
9f65cc
 
9f65cc
-    unset containers udevinfo _offroot
9f65cc
+    unset containers udevinfo
9f65cc
 fi
9f65cc
diff --git a/modules.d/90mdraid/mdraid_start.sh b/modules.d/90mdraid/mdraid_start.sh
9f65cc
index 77e843d7..ed8d8dfe 100755
9f65cc
--- a/modules.d/90mdraid/mdraid_start.sh
9f65cc
+++ b/modules.d/90mdraid/mdraid_start.sh
9f65cc
@@ -7,7 +7,6 @@ _md_start() {
9f65cc
     local _path_s
9f65cc
     local _path_d
9f65cc
     local _md="$1"
9f65cc
-    local _offroot="$2"
9f65cc
 
9f65cc
     _udevinfo="$(udevadm info --query=env --name="${_md}")"
9f65cc
     strstr "$_udevinfo" "MD_LEVEL=container" && continue
9f65cc
@@ -19,7 +18,7 @@ _md_start() {
9f65cc
     # inactive ?
9f65cc
     [ "$(cat "$_path_s")" != "inactive" ] && continue
9f65cc
 
9f65cc
-    mdadm $_offroot -R "${_md}" 2>&1 | vinfo
9f65cc
+    mdadm -R "${_md}" 2>&1 | vinfo
9f65cc
 
9f65cc
     # still inactive ?
9f65cc
     [ "$(cat "$_path_s")" = "inactive" ] && continue
9f65cc
@@ -30,14 +29,11 @@ _md_start() {
9f65cc
 }
9f65cc
 
9f65cc
 _md_force_run() {
9f65cc
-    local _offroot
9f65cc
     local _md
9f65cc
     local _UUID
9f65cc
     local _MD_UUID=$(getargs rd.md.uuid -d rd_MD_UUID=)
9f65cc
     [ -n "$_MD_UUID" ] || getargbool 0 rd.auto || return
9f65cc
 
9f65cc
-    _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
9f65cc
-
9f65cc
     if [ -n "$_MD_UUID" ]; then
9f65cc
         _MD_UUID=$(str_replace "$_MD_UUID" "-" "")
9f65cc
         _MD_UUID=$(str_replace "$_MD_UUID" ":" "")
9f65cc
@@ -58,13 +54,13 @@ _md_force_run() {
9f65cc
             # check if we should handle this device
9f65cc
             strstr " $_MD_UUID " " $_UUID " || continue
9f65cc
 
9f65cc
-            _md_start "${_md}" "${_offroot}"
9f65cc
+            _md_start "${_md}"
9f65cc
         done
9f65cc
     else
9f65cc
         # try to force-run anything not running yet
9f65cc
         for _md in /dev/md[0-9_]*; do
9f65cc
             [ -b "$_md" ] || continue
9f65cc
-            _md_start "${_md}" "${_offroot}"
9f65cc
+            _md_start "${_md}"
9f65cc
         done
9f65cc
     fi
9f65cc
 }
9f65cc
diff --git a/modules.d/90mdraid/parse-md.sh b/modules.d/90mdraid/parse-md.sh
9f65cc
index 4d9baa52..2cce9769 100755
9f65cc
--- a/modules.d/90mdraid/parse-md.sh
9f65cc
+++ b/modules.d/90mdraid/parse-md.sh
9f65cc
@@ -60,5 +60,3 @@ if ! getargbool 1 rd.md.ddf -n rd_NO_MDDDF -n noddfmd -n nodmraid; then
9f65cc
     info "no MD RAID for SNIA ddf raids"
9f65cc
     udevproperty rd_NO_MDDDF=1
9f65cc
 fi
9f65cc
-
9f65cc
-strstr "$(mdadm --help-options 2>&1)" offroot && udevproperty rd_MD_OFFROOT=--offroot
9f65cc