|
Harald Hoyer |
52ce14 |
From d351541ee625f8a1b42446448214f200f19c2631 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
52ce14 |
From: Harald Hoyer <harald@redhat.com>
|
|
Harald Hoyer |
52ce14 |
Date: Mon, 11 Mar 2013 16:32:16 +0100
|
|
Harald Hoyer |
52ce14 |
Subject: [PATCH] make host_fs_types a hashmap
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
This requires bash >= 4, but hash maps are so much more comfortable
|
|
Harald Hoyer |
52ce14 |
---
|
|
Harald Hoyer |
52ce14 |
dracut-functions.sh | 14 +++---------
|
|
Harald Hoyer |
52ce14 |
dracut.sh | 23 +++++++++----------
|
|
Harald Hoyer |
52ce14 |
modules.d/90btrfs/module-setup.sh | 6 ++---
|
|
Harald Hoyer |
52ce14 |
modules.d/90crypt/module-setup.sh | 39 +++++++++++++++++++--------------
|
|
Harald Hoyer |
52ce14 |
modules.d/90dmraid/module-setup.sh | 34 ++++++++++++++++------------
|
|
Harald Hoyer |
52ce14 |
modules.d/90lvm/module-setup.sh | 36 +++++++++++++++++-------------
|
|
Harald Hoyer |
52ce14 |
modules.d/90mdraid/module-setup.sh | 45 +++++++++++++++++++++-----------------
|
|
Harald Hoyer |
52ce14 |
modules.d/95cifs/module-setup.sh | 2 +-
|
|
Harald Hoyer |
52ce14 |
modules.d/95nfs/module-setup.sh | 6 ++---
|
|
Harald Hoyer |
52ce14 |
modules.d/95virtfs/module-setup.sh | 4 ++--
|
|
Harald Hoyer |
52ce14 |
10 files changed, 112 insertions(+), 97 deletions(-)
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
|
Harald Hoyer |
52ce14 |
index 2a84d17..c6a5c7e 100755
|
|
Harald Hoyer |
52ce14 |
--- a/dracut-functions.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/dracut-functions.sh
|
|
Harald Hoyer |
52ce14 |
@@ -450,23 +450,15 @@ find_mp_fstype() {
|
|
Harald Hoyer |
52ce14 |
find_root_block_device() { find_block_device /; }
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
# for_each_host_dev_fs <func>
|
|
Harald Hoyer |
52ce14 |
-# Execute "<func> <dev> <filesystem>" for every "<dev>|<fs>" pair found
|
|
Harald Hoyer |
52ce14 |
+# Execute "<func> <dev> <filesystem>" for every "<dev> <fs>" pair found
|
|
Harald Hoyer |
52ce14 |
# in ${host_fs_types[@]}
|
|
Harald Hoyer |
52ce14 |
for_each_host_dev_fs()
|
|
Harald Hoyer |
52ce14 |
{
|
|
Harald Hoyer |
52ce14 |
local _func="$1"
|
|
Harald Hoyer |
52ce14 |
local _dev
|
|
Harald Hoyer |
52ce14 |
- local _fs
|
|
Harald Hoyer |
52ce14 |
local _ret=1
|
|
Harald Hoyer |
52ce14 |
- for f in ${host_fs_types[@]}; do
|
|
Harald Hoyer |
52ce14 |
- OLDIFS="$IFS"
|
|
Harald Hoyer |
52ce14 |
- IFS="|"
|
|
Harald Hoyer |
52ce14 |
- set -- $f
|
|
Harald Hoyer |
52ce14 |
- IFS="$OLDIFS"
|
|
Harald Hoyer |
52ce14 |
- _dev="$1"
|
|
Harald Hoyer |
52ce14 |
- [[ -b "$_dev" ]] || continue
|
|
Harald Hoyer |
52ce14 |
- _fs="$2"
|
|
Harald Hoyer |
52ce14 |
- $_func $_dev $_fs && _ret=0
|
|
Harald Hoyer |
52ce14 |
+ for _dev in "${!host_fs_types[@]}"; do
|
|
Harald Hoyer |
52ce14 |
+ $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
|
|
Harald Hoyer |
52ce14 |
done
|
|
Harald Hoyer |
52ce14 |
return $_ret
|
|
Harald Hoyer |
52ce14 |
}
|
|
Harald Hoyer |
52ce14 |
diff --git a/dracut.sh b/dracut.sh
|
|
Harald Hoyer |
52ce14 |
index 860cfb5..8306733 100755
|
|
Harald Hoyer |
52ce14 |
--- a/dracut.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/dracut.sh
|
|
Harald Hoyer |
52ce14 |
@@ -750,11 +750,13 @@ fi
|
|
Harald Hoyer |
52ce14 |
# Need to be able to have non-root users read stuff (rpcbind etc)
|
|
Harald Hoyer |
52ce14 |
chmod 755 "$initdir"
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
+declare -A host_fs_types
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
for line in "${fstab_lines[@]}"; do
|
|
Harald Hoyer |
52ce14 |
set -- $line
|
|
Harald Hoyer |
52ce14 |
#dev mp fs fsopts
|
|
Harald Hoyer |
52ce14 |
push host_devs "$1"
|
|
Harald Hoyer |
52ce14 |
- push host_fs_types "$1|$3"
|
|
Harald Hoyer |
52ce14 |
+ host_fs_types["$1"]="$3"
|
|
Harald Hoyer |
52ce14 |
done
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
for f in $add_fstab; do
|
|
Harald Hoyer |
52ce14 |
@@ -797,28 +799,27 @@ fi
|
|
Harald Hoyer |
52ce14 |
_get_fs_type() (
|
|
Harald Hoyer |
52ce14 |
[[ $1 ]] || return
|
|
Harald Hoyer |
52ce14 |
if [[ -b $1 ]] && get_fs_env $1; then
|
|
Harald Hoyer |
52ce14 |
- echo "$(readlink -f $1)|$ID_FS_TYPE"
|
|
Harald Hoyer |
52ce14 |
+ echo "$(readlink -f $1) $ID_FS_TYPE"
|
|
Harald Hoyer |
52ce14 |
return 1
|
|
Harald Hoyer |
52ce14 |
fi
|
|
Harald Hoyer |
52ce14 |
if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
|
|
Harald Hoyer |
52ce14 |
- echo "$(readlink -f /dev/block/$1)|$ID_FS_TYPE"
|
|
Harald Hoyer |
52ce14 |
+ echo "$(readlink -f /dev/block/$1) $ID_FS_TYPE"
|
|
Harald Hoyer |
52ce14 |
return 1
|
|
Harald Hoyer |
52ce14 |
fi
|
|
Harald Hoyer |
52ce14 |
if fstype=$(find_dev_fstype $1); then
|
|
Harald Hoyer |
52ce14 |
- echo "$1|$fstype"
|
|
Harald Hoyer |
52ce14 |
+ echo "$1 $fstype"
|
|
Harald Hoyer |
52ce14 |
return 1
|
|
Harald Hoyer |
52ce14 |
fi
|
|
Harald Hoyer |
52ce14 |
return 1
|
|
Harald Hoyer |
52ce14 |
)
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
for dev in "${host_devs[@]}"; do
|
|
Harald Hoyer |
52ce14 |
- unset fs_type
|
|
Harald Hoyer |
52ce14 |
- for fstype in $(_get_fs_type $dev) \
|
|
Harald Hoyer |
52ce14 |
- $(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do
|
|
Harald Hoyer |
52ce14 |
- if ! strstr " ${host_fs_types[*]} " " $fstype ";then
|
|
Harald Hoyer |
52ce14 |
- push host_fs_types "$fstype"
|
|
Harald Hoyer |
52ce14 |
- fi
|
|
Harald Hoyer |
52ce14 |
- done
|
|
Harald Hoyer |
52ce14 |
+ while read key val; do
|
|
Harald Hoyer |
52ce14 |
+ host_fs_types["$key"]="$val"
|
|
Harald Hoyer |
52ce14 |
+ done < <(
|
|
Harald Hoyer |
52ce14 |
+ _get_fs_type $dev
|
|
Harald Hoyer |
52ce14 |
+ check_block_and_slaves_all _get_fs_type $(get_maj_min $dev)
|
|
Harald Hoyer |
52ce14 |
+ )
|
|
Harald Hoyer |
52ce14 |
done
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
[[ -d $udevdir ]] \
|
|
Harald Hoyer |
52ce14 |
diff --git a/modules.d/90btrfs/module-setup.sh b/modules.d/90btrfs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
index 0f79f5e..4a7c01d 100755
|
|
Harald Hoyer |
52ce14 |
--- a/modules.d/90btrfs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/modules.d/90btrfs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
@@ -9,12 +9,10 @@ check() {
|
|
Harald Hoyer |
52ce14 |
type -P btrfs >/dev/null || return 1
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
- local _found
|
|
Harald Hoyer |
52ce14 |
for fs in ${host_fs_types[@]}; do
|
|
Harald Hoyer |
52ce14 |
- strstr "$fs" "\|btrfs" && _found="1"
|
|
Harald Hoyer |
52ce14 |
+ [[ "$fs" == "btrfs" ]] && return 0
|
|
Harald Hoyer |
52ce14 |
done
|
|
Harald Hoyer |
52ce14 |
- [[ $_found ]] || return 1
|
|
Harald Hoyer |
52ce14 |
- unset _found
|
|
Harald Hoyer |
52ce14 |
+ return 255
|
|
Harald Hoyer |
52ce14 |
}
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
return 0
|
|
Harald Hoyer |
52ce14 |
diff --git a/modules.d/90crypt/module-setup.sh b/modules.d/90crypt/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
index 2b4456b..b76f6ae 100755
|
|
Harald Hoyer |
52ce14 |
--- a/modules.d/90crypt/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/modules.d/90crypt/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
@@ -7,8 +7,30 @@ check() {
|
|
Harald Hoyer |
52ce14 |
# if cryptsetup is not installed, then we cannot support encrypted devices.
|
|
Harald Hoyer |
52ce14 |
type -P cryptsetup >/dev/null || return 1
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
+ [[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
+ for fs in "${host_fs_types[@]}"; do
|
|
Harald Hoyer |
52ce14 |
+ [[ $fs = "crypto_LUKS" ]] && return 0
|
|
Harald Hoyer |
52ce14 |
+ done
|
|
Harald Hoyer |
52ce14 |
+ return 255
|
|
Harald Hoyer |
52ce14 |
+ }
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+ return 0
|
|
Harald Hoyer |
52ce14 |
+}
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+depends() {
|
|
Harald Hoyer |
52ce14 |
+ echo dm rootfs-block
|
|
Harald Hoyer |
52ce14 |
+ return 0
|
|
Harald Hoyer |
52ce14 |
+}
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+installkernel() {
|
|
Harald Hoyer |
52ce14 |
+ instmods dm_crypt =crypto
|
|
Harald Hoyer |
52ce14 |
+}
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+install() {
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
check_crypt() {
|
|
Harald Hoyer |
52ce14 |
local dev=$1 fs=$2
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
[[ $fs = "crypto_LUKS" ]] || return 1
|
|
Harald Hoyer |
52ce14 |
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
|
|
Harald Hoyer |
52ce14 |
| while read line; do
|
|
Harald Hoyer |
52ce14 |
@@ -24,23 +46,8 @@ check() {
|
|
Harald Hoyer |
52ce14 |
return 0
|
|
Harald Hoyer |
52ce14 |
}
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
- [[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
- for_each_host_dev_and_slaves_all check_crypt || return 1
|
|
Harald Hoyer |
52ce14 |
- }
|
|
Harald Hoyer |
52ce14 |
-
|
|
Harald Hoyer |
52ce14 |
- return 0
|
|
Harald Hoyer |
52ce14 |
-}
|
|
Harald Hoyer |
52ce14 |
-
|
|
Harald Hoyer |
52ce14 |
-depends() {
|
|
Harald Hoyer |
52ce14 |
- echo dm rootfs-block
|
|
Harald Hoyer |
52ce14 |
- return 0
|
|
Harald Hoyer |
52ce14 |
-}
|
|
Harald Hoyer |
52ce14 |
-
|
|
Harald Hoyer |
52ce14 |
-installkernel() {
|
|
Harald Hoyer |
52ce14 |
- instmods dm_crypt =crypto
|
|
Harald Hoyer |
52ce14 |
-}
|
|
Harald Hoyer |
52ce14 |
+ for_each_host_dev_fs check_crypt
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
-install() {
|
|
Harald Hoyer |
52ce14 |
dracut_install cryptsetup rmdir readlink umount
|
|
Harald Hoyer |
52ce14 |
inst_script "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
|
Harald Hoyer |
52ce14 |
inst_script "$moddir"/probe-keydev.sh /sbin/probe-keydev
|
|
Harald Hoyer |
52ce14 |
diff --git a/modules.d/90dmraid/module-setup.sh b/modules.d/90dmraid/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
index c315961..76daa4a 100755
|
|
Harald Hoyer |
52ce14 |
--- a/modules.d/90dmraid/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/modules.d/90dmraid/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
@@ -8,9 +8,27 @@ check() {
|
|
Harald Hoyer |
52ce14 |
# in trying to support it in the initramfs.
|
|
Harald Hoyer |
52ce14 |
type -P dmraid >/dev/null || return 1
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
+ [[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
+ for fs in "${host_fs_types[@]}"; do
|
|
Harald Hoyer |
52ce14 |
+ [[ $fs = *_raid_member ]] && return 0
|
|
Harald Hoyer |
52ce14 |
+ done
|
|
Harald Hoyer |
52ce14 |
+ return 255
|
|
Harald Hoyer |
52ce14 |
+ }
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+ return 0
|
|
Harald Hoyer |
52ce14 |
+}
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+depends() {
|
|
Harald Hoyer |
52ce14 |
+ echo dm rootfs-block
|
|
Harald Hoyer |
52ce14 |
+ return 0
|
|
Harald Hoyer |
52ce14 |
+}
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+install() {
|
|
Harald Hoyer |
52ce14 |
+ local _i
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
check_dmraid() {
|
|
Harald Hoyer |
52ce14 |
local dev=$1 fs=$2 holder DEVPATH DM_NAME
|
|
Harald Hoyer |
52ce14 |
- [[ "$fs" = "${fs%%_raid_member}" ]] && return 1
|
|
Harald Hoyer |
52ce14 |
+ [[ "$fs" != *_raid_member ]] && return 1
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
DEVPATH=$(udevadm info --query=property --name=$dev \
|
|
Harald Hoyer |
52ce14 |
| while read line; do
|
|
Harald Hoyer |
52ce14 |
@@ -37,20 +55,8 @@ check() {
|
|
Harald Hoyer |
52ce14 |
return 0
|
|
Harald Hoyer |
52ce14 |
}
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
- [[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
- for_each_host_dev_and_slaves_all check_dmraid || return 1
|
|
Harald Hoyer |
52ce14 |
- }
|
|
Harald Hoyer |
52ce14 |
+ for_each_host_dev_fs check_dmraid
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
- return 0
|
|
Harald Hoyer |
52ce14 |
-}
|
|
Harald Hoyer |
52ce14 |
-
|
|
Harald Hoyer |
52ce14 |
-depends() {
|
|
Harald Hoyer |
52ce14 |
- echo dm rootfs-block
|
|
Harald Hoyer |
52ce14 |
- return 0
|
|
Harald Hoyer |
52ce14 |
-}
|
|
Harald Hoyer |
52ce14 |
-
|
|
Harald Hoyer |
52ce14 |
-install() {
|
|
Harald Hoyer |
52ce14 |
- local _i
|
|
Harald Hoyer |
52ce14 |
dracut_install dmraid
|
|
Harald Hoyer |
52ce14 |
dracut_install -o kpartx
|
|
Harald Hoyer |
52ce14 |
inst $(command -v partx) /sbin/partx
|
|
Harald Hoyer |
52ce14 |
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
index e0e4043..22186f4 100755
|
|
Harald Hoyer |
52ce14 |
--- a/modules.d/90lvm/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/modules.d/90lvm/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
@@ -7,22 +7,11 @@ check() {
|
|
Harald Hoyer |
52ce14 |
# No point trying to support lvm if the binaries are missing
|
|
Harald Hoyer |
52ce14 |
type -P lvm >/dev/null || return 1
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
- check_lvm() {
|
|
Harald Hoyer |
52ce14 |
- local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG
|
|
Harald Hoyer |
52ce14 |
- eval $(udevadm info --query=property --name=/dev/block/$1|egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=')
|
|
Harald Hoyer |
52ce14 |
- [[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1
|
|
Harald Hoyer |
52ce14 |
- [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
|
|
Harald Hoyer |
52ce14 |
- if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then
|
|
Harald Hoyer |
52ce14 |
- if ! [[ $kernel_only ]]; then
|
|
Harald Hoyer |
52ce14 |
- echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
|
Harald Hoyer |
52ce14 |
- fi
|
|
Harald Hoyer |
52ce14 |
- push _activated "${DM_VG_NAME}/${DM_LV_NAME}"
|
|
Harald Hoyer |
52ce14 |
- fi
|
|
Harald Hoyer |
52ce14 |
- return 0
|
|
Harald Hoyer |
52ce14 |
- }
|
|
Harald Hoyer |
52ce14 |
-
|
|
Harald Hoyer |
52ce14 |
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
- for_each_host_dev_and_slaves_all check_lvm || return 1
|
|
Harald Hoyer |
52ce14 |
+ for fs in "${host_fs_types[@]}"; do
|
|
Harald Hoyer |
52ce14 |
+ [[ $fs = LVM*_member ]] && return 0
|
|
Harald Hoyer |
52ce14 |
+ done
|
|
Harald Hoyer |
52ce14 |
+ return 255
|
|
Harald Hoyer |
52ce14 |
}
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
return 0
|
|
Harald Hoyer |
52ce14 |
@@ -38,6 +27,23 @@ install() {
|
|
Harald Hoyer |
52ce14 |
local _i
|
|
Harald Hoyer |
52ce14 |
inst lvm
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
+ check_lvm() {
|
|
Harald Hoyer |
52ce14 |
+ local DM_VG_NAME DM_LV_NAME DM_UDEV_DISABLE_DISK_RULES_FLAG
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+ eval $(udevadm info --query=property --name=$1 | egrep '(DM_VG_NAME|DM_LV_NAME|DM_UDEV_DISABLE_DISK_RULES_FLAG)=')
|
|
Harald Hoyer |
52ce14 |
+ [[ "$DM_UDEV_DISABLE_DISK_RULES_FLAG" = "1" ]] && return 1
|
|
Harald Hoyer |
52ce14 |
+ [[ ${DM_VG_NAME} ]] && [[ ${DM_LV_NAME} ]] || return 1
|
|
Harald Hoyer |
52ce14 |
+ if ! strstr " ${_activated[*]} " " ${DM_VG_NAME}/${DM_LV_NAME} "; then
|
|
Harald Hoyer |
52ce14 |
+ if ! [[ $kernel_only ]]; then
|
|
Harald Hoyer |
52ce14 |
+ echo " rd.lvm.lv=${DM_VG_NAME}/${DM_LV_NAME} " >> "${initdir}/etc/cmdline.d/90lvm.conf"
|
|
Harald Hoyer |
52ce14 |
+ fi
|
|
Harald Hoyer |
52ce14 |
+ push _activated "${DM_VG_NAME}/${DM_LV_NAME}"
|
|
Harald Hoyer |
52ce14 |
+ fi
|
|
Harald Hoyer |
52ce14 |
+ return 0
|
|
Harald Hoyer |
52ce14 |
+ }
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+ for_each_host_dev_fs check_lvm
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
inst_rules "$moddir/64-lvm.rules"
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
|
Harald Hoyer |
52ce14 |
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
index 0efffbb..70c27dd 100755
|
|
Harald Hoyer |
52ce14 |
--- a/modules.d/90mdraid/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/modules.d/90mdraid/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
@@ -7,27 +7,11 @@ check() {
|
|
Harald Hoyer |
52ce14 |
# No mdadm? No mdraid support.
|
|
Harald Hoyer |
52ce14 |
type -P mdadm >/dev/null || return 1
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
- check_mdraid() {
|
|
Harald Hoyer |
52ce14 |
- local dev=$1 fs=$2 holder DEVPATH MD_UUID
|
|
Harald Hoyer |
52ce14 |
- [[ "$fs" = "${fs%%_raid_member}" ]] && return 1
|
|
Harald Hoyer |
52ce14 |
-
|
|
Harald Hoyer |
52ce14 |
- MD_UUID=$(/sbin/mdadm --examine --export $dev \
|
|
Harald Hoyer |
52ce14 |
- | while read line; do
|
|
Harald Hoyer |
52ce14 |
- [[ ${line#MD_UUID} = $line ]] && continue
|
|
Harald Hoyer |
52ce14 |
- eval "$line"
|
|
Harald Hoyer |
52ce14 |
- echo $MD_UUID
|
|
Harald Hoyer |
52ce14 |
- break
|
|
Harald Hoyer |
52ce14 |
- done)
|
|
Harald Hoyer |
52ce14 |
-
|
|
Harald Hoyer |
52ce14 |
- [[ ${MD_UUID} ]] || return 1
|
|
Harald Hoyer |
52ce14 |
- if ! [[ $kernel_only ]]; then
|
|
Harald Hoyer |
52ce14 |
- echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
|
Harald Hoyer |
52ce14 |
- fi
|
|
Harald Hoyer |
52ce14 |
- return 0
|
|
Harald Hoyer |
52ce14 |
- }
|
|
Harald Hoyer |
52ce14 |
-
|
|
Harald Hoyer |
52ce14 |
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
- for_each_host_dev_and_slaves_all check_mdraid || return 1
|
|
Harald Hoyer |
52ce14 |
+ for fs in "${host_fs_types[@]}"; do
|
|
Harald Hoyer |
52ce14 |
+ [[ "$fs" == *_raid_member ]] && return 0
|
|
Harald Hoyer |
52ce14 |
+ done
|
|
Harald Hoyer |
52ce14 |
+ return 255
|
|
Harald Hoyer |
52ce14 |
}
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
return 0
|
|
Harald Hoyer |
52ce14 |
@@ -48,6 +32,27 @@ install() {
|
|
Harald Hoyer |
52ce14 |
inst $(command -v partx) /sbin/partx
|
|
Harald Hoyer |
52ce14 |
inst $(command -v mdadm) /sbin/mdadm
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
+ check_mdraid() {
|
|
Harald Hoyer |
52ce14 |
+ local dev=$1 fs=$2 holder DEVPATH MD_UUID
|
|
Harald Hoyer |
52ce14 |
+ [[ "$fs" != *_raid_member ]] && return 1
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+ MD_UUID=$(/sbin/mdadm --examine --export $dev \
|
|
Harald Hoyer |
52ce14 |
+ | while read line; do
|
|
Harald Hoyer |
52ce14 |
+ [[ ${line#MD_UUID} = $line ]] && continue
|
|
Harald Hoyer |
52ce14 |
+ eval "$line"
|
|
Harald Hoyer |
52ce14 |
+ echo $MD_UUID
|
|
Harald Hoyer |
52ce14 |
+ break
|
|
Harald Hoyer |
52ce14 |
+ done)
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+ [[ ${MD_UUID} ]] || return 1
|
|
Harald Hoyer |
52ce14 |
+ if ! [[ $kernel_only ]]; then
|
|
Harald Hoyer |
52ce14 |
+ echo " rd.md.uuid=${MD_UUID} " >> "${initdir}/etc/cmdline.d/90mdraid.conf"
|
|
Harald Hoyer |
52ce14 |
+ fi
|
|
Harald Hoyer |
52ce14 |
+ return 0
|
|
Harald Hoyer |
52ce14 |
+ }
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
+ for_each_host_dev_fs check_mdraid
|
|
Harald Hoyer |
52ce14 |
+
|
|
Harald Hoyer |
52ce14 |
inst_rules 64-md-raid.rules
|
|
Harald Hoyer |
52ce14 |
# remove incremental assembly from stock rules, so they don't shadow
|
|
Harald Hoyer |
52ce14 |
# 65-md-inc*.rules and its fine-grained controls, or cause other problems
|
|
Harald Hoyer |
52ce14 |
diff --git a/modules.d/95cifs/module-setup.sh b/modules.d/95cifs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
index 1c7d0be..bf0eddf 100755
|
|
Harald Hoyer |
52ce14 |
--- a/modules.d/95cifs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/modules.d/95cifs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
@@ -8,7 +8,7 @@ check() {
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
for fs in ${host_fs_types[@]}; do
|
|
Harald Hoyer |
52ce14 |
- strstr "$fs" "\|cifs" && return 0
|
|
Harald Hoyer |
52ce14 |
+ [[ "$fs" == "cifs" ]] && return 0
|
|
Harald Hoyer |
52ce14 |
done
|
|
Harald Hoyer |
52ce14 |
return 255
|
|
Harald Hoyer |
52ce14 |
}
|
|
Harald Hoyer |
52ce14 |
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
index 38ee5d7..7c3a64d 100755
|
|
Harald Hoyer |
52ce14 |
--- a/modules.d/95nfs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/modules.d/95nfs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
@@ -9,9 +9,9 @@ check() {
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
for fs in ${host_fs_types[@]}; do
|
|
Harald Hoyer |
52ce14 |
- strstr "$fs" "\|nfs" && return 0
|
|
Harald Hoyer |
52ce14 |
- strstr "$fs" "\|nfs3" && return 0
|
|
Harald Hoyer |
52ce14 |
- strstr "$fs" "\|nfs4" && return 0
|
|
Harald Hoyer |
52ce14 |
+ [[ "$fs" == "nfs" ]] && return 0
|
|
Harald Hoyer |
52ce14 |
+ [[ "$fs" == "nfs3" ]] && return 0
|
|
Harald Hoyer |
52ce14 |
+ [[ "$fs" == "nfs4" ]] && return 0
|
|
Harald Hoyer |
52ce14 |
done
|
|
Harald Hoyer |
52ce14 |
return 255
|
|
Harald Hoyer |
52ce14 |
}
|
|
Harald Hoyer |
52ce14 |
diff --git a/modules.d/95virtfs/module-setup.sh b/modules.d/95virtfs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
index 0b961a8..12bd354 100755
|
|
Harald Hoyer |
52ce14 |
--- a/modules.d/95virtfs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
+++ b/modules.d/95virtfs/module-setup.sh
|
|
Harald Hoyer |
52ce14 |
@@ -5,9 +5,9 @@
|
|
Harald Hoyer |
52ce14 |
check() {
|
|
Harald Hoyer |
52ce14 |
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
|
Harald Hoyer |
52ce14 |
for fs in ${host_fs_types[@]}; do
|
|
Harald Hoyer |
52ce14 |
- strstr "$fs" "\|9p" && return 0
|
|
Harald Hoyer |
52ce14 |
+ [[ "$fs" == "9p" ]] && return 0
|
|
Harald Hoyer |
52ce14 |
done
|
|
Harald Hoyer |
52ce14 |
- return 1
|
|
Harald Hoyer |
52ce14 |
+ return 255
|
|
Harald Hoyer |
52ce14 |
}
|
|
Harald Hoyer |
52ce14 |
|
|
Harald Hoyer |
52ce14 |
if type -P systemd-detect-virt >/dev/null 2>&1; then
|