]> git.ipfire.org Git - thirdparty/dracut.git/blob - modules.d/90dmraid/module-setup.sh
dracut-functions.sh: inst_multiple == dracut_install
[thirdparty/dracut.git] / modules.d / 90dmraid / module-setup.sh
1 #!/bin/bash
2 # -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
3 # ex: ts=8 sw=4 sts=4 et filetype=sh
4
5 check() {
6 local _rootdev
7 # if we don't have dmraid installed on the host system, no point
8 # in trying to support it in the initramfs.
9 type -P dmraid >/dev/null || return 1
10
11 [[ $hostonly ]] || [[ $mount_needs ]] && {
12 for fs in "${host_fs_types[@]}"; do
13 [[ $fs = *_raid_member ]] && return 0
14 done
15 return 255
16 }
17
18 return 0
19 }
20
21 depends() {
22 echo dm rootfs-block
23 return 0
24 }
25
26 install() {
27 local _i
28
29 check_dmraid() {
30 local dev=$1 fs=$2 holder DEVPATH DM_NAME
31 [[ "$fs" != *_raid_member ]] && return 1
32
33 DEVPATH=$(udevadm info --query=property --name=$dev \
34 | while read line; do
35 [[ ${line#DEVPATH} = $line ]] && continue
36 eval "$line"
37 echo $DEVPATH
38 break
39 done)
40 for holder in /sys/$DEVPATH/holders/*; do
41 [[ -e $holder ]] || continue
42 DM_NAME=$(udevadm info --query=property --path=$holder \
43 | while read line; do
44 [[ ${line#DM_NAME} = $line ]] && continue
45 eval "$line"
46 echo $DM_NAME
47 break
48 done)
49 done
50
51 [[ ${DM_NAME} ]] || return 1
52 if ! [[ $kernel_only ]]; then
53 echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
54 fi
55 return 0
56 }
57
58 for_each_host_dev_fs check_dmraid
59
60 inst_multiple dmraid
61 inst_multiple -o kpartx
62 inst $(command -v partx) /sbin/partx
63
64 inst "$moddir/dmraid.sh" /sbin/dmraid_scan
65
66 inst_rules 64-md-raid.rules
67
68 inst_libdir_file "libdmraid-events*.so*"
69
70 inst_rules "$moddir/61-dmraid-imsm.rules"
71 #inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
72 inst_hook pre-trigger 30 "$moddir/parse-dm.sh"
73 }