summaryrefslogtreecommitdiff
path: root/modules.d
diff options
context:
space:
mode:
Diffstat (limited to 'modules.d')
-rwxr-xr-xmodules.d/90crypt/module-setup.sh34
-rwxr-xr-xmodules.d/90dmraid/module-setup.sh31
-rwxr-xr-xmodules.d/90lvm/module-setup.sh51
-rwxr-xr-xmodules.d/90mdraid/module-setup.sh44
-rwxr-xr-xmodules.d/95rootfs-block/module-setup.sh9
5 files changed, 100 insertions, 69 deletions
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
index bb014b98..67bc83d6 100755
--- a/modules.d/90crypt/module-setup.sh
+++ b/modules.d/90crypt/module-setup.sh
@@ -26,25 +26,27 @@ installkernel() {
instmods dm_crypt =crypto
}
-install() {
-
- check_crypt() {
- local dev=$1 fs=$2 UUID
-
- [[ $fs = "crypto_LUKS" ]] || return 1
- UUID=$(blkid -u crypto -o export $dev \
- | while read line; do
+cmdline() {
+ local dev UUID
+ for dev in "${!host_fs_types[@]}"; do
+ [[ "${host_fs_types[$dev]}" != "crypto_LUKS" ]] && continue
+
+ UUID=$(
+ blkid -u crypto -o export $dev \
+ | while read line; do
[[ ${line#UUID} = $line ]] && continue
printf "%s" "${line#UUID=}"
break
- done)
- [[ ${UUID} ]] || return 1
- if ! [[ $kernel_only ]]; then
- echo " rd.luks.uuid=luks-${UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
- fi
- return 0
- }
+ done
+ )
+ [[ ${UUID} ]] || continue
+ printf "%s" " rd.luks.uuid=luks-${UUID}"
+ done
+}
+
+install() {
+ cmdline >> "${initdir}/etc/cmdline.d/90crypt.conf"
inst_multiple cryptsetup rmdir readlink umount
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
@@ -74,8 +76,6 @@ install() {
done < /etc/crypttab > $initdir/etc/crypttab
fi
- for_each_host_dev_fs check_crypt
-
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
inst_multiple -o \
diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh
index 87465d93..b93db8f7 100755
--- a/modules.d/90dmraid/module-setup.sh
+++ b/modules.d/90dmraid/module-setup.sh
@@ -23,13 +23,13 @@ depends() {
return 0
}
-install() {
- local _i
-
- check_dmraid() {
- local dev=$1 fs=$2 holder DEVPATH DM_NAME majmin
- [[ "$fs" != *_raid_member ]] && return 1
+cmdline() {
+ local _activated
+ declare -A _activated
+ for dev in "${!host_fs_types[@]}"; do
+ local holder DEVPATH DM_NAME majmin
+ [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
majmin=$(get_maj_min $dev)
DEVPATH=$(
@@ -45,18 +45,23 @@ install() {
for holder in "$DEVPATH"/holders/*; do
[[ -e "$holder" ]] || continue
dev="/dev/${holder##*/}"
- DM_NAME="$(/usr/sbin/dmsetup info -c --noheadings -o name "$dev" 2>/dev/null)"
+ DM_NAME="$(dmsetup info -c --noheadings -o name "$dev" 2>/dev/null)"
[[ ${DM_NAME} ]] && break
done
- [[ ${DM_NAME} ]] || return 1
- if ! [[ $kernel_only ]]; then
- echo " rd.dm.uuid=${DM_NAME} " >> "${initdir}/etc/cmdline.d/90dmraid.conf"
+ [[ ${DM_NAME} ]] || continue
+
+ if ! [[ ${_activated[${DM_NAME}]} ]]; then
+ printf "%s" " rd.dm.uuid=${DM_NAME}"
+ _activated["${DM_NAME}"]=1
fi
- return 0
- }
+ done
+}
+
+install() {
+ local _i
- for_each_host_dev_fs check_dmraid
+ cmdline >> "${initdir}/etc/cmdline.d/90dmraid.conf"
inst_multiple dmraid
inst_multiple -o kpartx
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 4b774c9c..69250393 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -22,29 +22,42 @@ depends() {
return 0
}
-install() {
- local _i
- local _needthin
+get_host_lvs() {
local _activated
- inst lvm
-
- check_lvm() {
- local DM_VG_NAME DM_LV_NAME
-
- eval $(/usr/sbin/dmsetup splitname --nameprefixes --noheadings --rows $1 2>/dev/null)
+ declare -A _activated
+
+ for dev in "${!host_fs_types[@]}"; do
+ [ -e /sys/block/${dev#/dev/}/dm/name ] || continue
+ [ -e /sys/block/${dev#/dev/}/dm/uuid ] || continue
+ uuid=$(</sys/block/${dev#/dev/}/dm/uuid)
+ [[ "${uuid#LVM-}" == "$uuid" ]] && continue
+ dev=$(</sys/block/${dev#/dev/}/dm/name)
+ eval $(dmsetup splitname --nameprefixes --noheadings --rows "$dev" 2>/dev/null)
[[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
- if ! [[ " ${_activated[*]} " == *\ ${DM_VG_NAME}/${DM_LV_NAME}\ * ]]; then
- echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
- push _activated "${DM_VG_NAME}/${DM_LV_NAME}"
- fi
- if ! [[ $_needthin ]]; then
- [[ $(lvs --noheadings -o segtype ${DM_VG_NAME} 2>/dev/null) == *thin* ]] && _needthin=1
+ if ! [[ ${_activated[${DM_VG_NAME}/${DM_LV_NAME}]} ]]; then
+ printf "%s\n" "${DM_VG_NAME}/${DM_LV_NAME} "
+ _activated["${DM_VG_NAME}/${DM_LV_NAME}"]=1
fi
+ done
+}
- return 0
- }
+cmdline() {
+ get_host_lvs | while read line; do
+ printf " rd.lvm.lv=$line"
+ done
+}
+
+install() {
+ local _i _needthin
- for_each_host_dev_fs check_lvm
+ inst lvm
+
+ get_host_lvs | while read line; do
+ printf "%s" " rd.lvm.lv=$line"
+ if ! [[ $_needthin ]]; then
+ [[ "$(lvs --noheadings -o segtype ${line%%/*} 2>/dev/null)" == *thin* ]] && _needthin=1
+ fi
+ done >> "${initdir}/etc/cmdline.d/90lvm.conf"
inst_rules "$moddir/64-lvm.rules"
@@ -81,7 +94,7 @@ install() {
inst_libdir_file "libdevmapper-event-lvm*.so"
if [[ $_needthin ]]; then
- inst_multiple -o thin_dump thin_restore thin_check
+ inst_multiple -o thin_dump thin_restore thin_check thin_repair
fi
}
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index b44ce50b..2fe4074d 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
@@ -26,32 +26,36 @@ installkernel() {
instmods =drivers/md
}
+cmdline() {
+ local _activated dev line UUID
+ declare -A _activated
+
+ for dev in "${!host_fs_types[@]}"; do
+ [[ "${host_fs_types[$dev]}" != *_raid_member ]] && continue
+
+ UUID=$(
+ /sbin/mdadm --examine --export $dev \
+ | while read line; do
+ [[ ${line#MD_UUID=} = $line ]] && continue
+ printf "%s" "${line#MD_UUID=} "
+ done
+ )
+
+ if ! [[ ${_activated[${UUID}]} ]]; then
+ printf "%s" " rd.md.uuid=${UUID}"
+ _activated["${UUID}"]=1
+ fi
+
+ done
+}
+
install() {
inst_multiple cat
inst_multiple -o mdmon
inst $(command -v partx) /sbin/partx
inst $(command -v mdadm) /sbin/mdadm
- check_mdraid() {
- local dev=$1 fs=$2 holder DEVPATH MD_UUID
- [[ "$fs" != *_raid_member ]] && return 1
-
- MD_UUID=$(/sbin/mdadm --examine --export $dev \
- | while read line; do
- [[ ${line#MD_UUID} = $line ]] && continue
- eval "$line"
- echo $MD_UUID
- break
- done)
-
- [[ ${MD_UUID} ]] || return 1
- if ! [[ $kernel_only ]]; then
- echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
- fi
- return 0
- }
-
- for_each_host_dev_fs check_mdraid
+ cmdline >> "${initdir}/etc/cmdline.d/90mdraid.conf"
inst_rules 64-md-raid.rules
# remove incremental assembly from stock rules, so they don't shadow
diff --git a/modules.d/95rootfs-block/module-setup.sh b/modules.d/95rootfs-block/module-setup.sh
index 32eec4a4..6792f1d3 100755
--- a/modules.d/95rootfs-block/module-setup.sh
+++ b/modules.d/95rootfs-block/module-setup.sh
@@ -10,6 +10,15 @@ depends() {
echo fs-lib
}
+cmdline() {
+ local dev=/dev/block/$(find_root_block_device)
+ if [ -e $dev ]; then
+ printf " root=%s" $(get_persistent_dev "$dev")
+ printf " rootflags=%s" $(find_mp_fsopts /)
+ printf " rootfstype=%s" $(find_mp_fstype /)
+ fi
+}
+
install() {
if [[ $hostonly ]]; then