summaryrefslogtreecommitdiffstats
path: root/modules.d/90dmraid/dmraid.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:54:25 +0000
commit9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a (patch)
tree2efb72864cc69e174c9c5ee33efb88a5f1553b48 /modules.d/90dmraid/dmraid.sh
parentInitial commit. (diff)
downloaddracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.tar.xz
dracut-9cb1c4df7b9ce1a9ad1312621b0f2b16a94fba3a.zip
Adding upstream version 060+5.upstream/060+5
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'modules.d/90dmraid/dmraid.sh')
-rwxr-xr-xmodules.d/90dmraid/dmraid.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/modules.d/90dmraid/dmraid.sh b/modules.d/90dmraid/dmraid.sh
new file mode 100755
index 0000000..b517320
--- /dev/null
+++ b/modules.d/90dmraid/dmraid.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+type getarg > /dev/null 2>&1 || . /lib/dracut-lib.sh
+
+devenc=$(str_replace "$1" '/' '\2f')
+
+[ -e /tmp/dmraid."$devenc" ] && exit 0
+
+: > /tmp/dmraid."$devenc"
+
+DM_RAIDS=$(getargs rd.dm.uuid -d rd_DM_UUID=)
+
+if [ -n "$DM_RAIDS" ] || getargbool 0 rd.auto; then
+ # run dmraid if udev has settled
+ info "Scanning for dmraid devices $DM_RAIDS"
+ SETS=$(dmraid -c -s)
+
+ if [ "$SETS" = "no raid disks" -o "$SETS" = "no raid sets" ]; then
+ return
+ fi
+
+ info "Found dmraid sets:"
+ echo "$SETS" | vinfo
+
+ if [ -n "$DM_RAIDS" ]; then
+ # only activate specified DM RAIDS
+ for r in $DM_RAIDS; do
+ for s in $SETS; do
+ if [ "${s##"$r"}" != "$s" ]; then
+ info "Activating $s"
+ dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
+ fi
+ done
+ done
+ else
+ # scan and activate all DM RAIDS
+ for s in $SETS; do
+ info "Activating $s"
+ dmraid -ay -i -p --rm_partitions "$s" 2>&1 | vinfo
+ [ -e "/dev/mapper/$s" ] && kpartx -a "/dev/mapper/$s" 2>&1 | vinfo
+ udevsettle
+ done
+ fi
+
+ need_shutdown
+fi