network: don't use "ifup -m"
[dracut.git] / modules.d / 90mdraid / mdraid_start.sh
blob400ab5dc46c7962f70e0114fdebdfc08c57f056f
1 #!/bin/sh
3 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
4 _md_force_run() {
5 local _udevinfo
6 local _path_s
7 local _path_d
8 local _offroot
9 _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
10 # try to force-run anything not running yet
11 for md in /dev/md[0-9_]*; do
12 [ -b "$md" ] || continue
13 _udevinfo="$(udevadm info --query=env --name="$md")"
14 strstr "$_udevinfo" "MD_LEVEL=container" && continue
15 strstr "$_udevinfo" "DEVTYPE=partition" && continue
17 _path_s="/sys/$(udevadm info -q path -n "$md")/md/array_state"
18 [ ! -r "$_path_s" ] && continue
20 # inactive ?
21 [ "$(cat "$_path_s")" != "inactive" ] && continue
23 mdadm $_offroot -R "$md" 2>&1 | vinfo
25 # still inactive ?
26 [ "$(cat "$_path_s")" = "inactive" ] && continue
28 _path_d="${_path_s%/*}/degraded"
29 [ ! -r "$_path_d" ] && continue
30 > $hookdir/initqueue/work
31 done
34 _md_force_run