]> git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/90mdraid/mdraid_start.sh
remove all vim and emacs code format comments
[thirdparty/dracut.git] / modules.d / 90mdraid / mdraid_start.sh
1 #!/bin/sh
2
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
16
17 _path_s="/sys/$(udevadm info -q path -n "$md")/md/array_state"
18 [ ! -r "$_path_s" ] && continue
19
20 # inactive ?
21 [ "$(cat "$_path_s")" != "inactive" ] && continue
22
23 mdadm $_offroot -R "$md" 2>&1 | vinfo
24
25 # still inactive ?
26 [ "$(cat "$_path_s")" = "inactive" ] && continue
27
28 _path_d="${_path_s%/*}/degraded"
29 [ ! -r "$_path_d" ] && continue
30 done
31 }
32
33 _md_force_run