dracut-systemd/dracut-initqueue: only start service if really needed
[dracut.git] / modules.d / 90mdraid / mdraid-cleanup.sh
blob565449a5118125ac4ebbd118ff5637c9c354ee10
1 #!/bin/sh
3 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
5 _offroot=$(strstr "$(mdadm --help-options 2>&1)" offroot && echo --offroot)
6 containers=""
7 for md in /dev/md[0-9_]*; do
8 [ -b "$md" ] || continue
9 udevinfo="$(udevadm info --query=env --name=$md)"
10 strstr "$udevinfo" "DEVTYPE=partition" && continue
11 if strstr "$udevinfo" "MD_LEVEL=container"; then
12 containers="$containers $md"
13 continue
15 mdadm $_offroot -S "$md" >/dev/null 2>&1
16 done
18 for md in $containers; do
19 mdadm $_offroot -S "$md" >/dev/null 2>&1
20 done
22 unset containers udevinfo _offroot