Move some dracut module dependencies checks to module-setup.sh

depend() in module-setup.sh is a better place to setup dracut module
dependency, it will do early check, and fail early if needed module is
missing. Also remove a unneeded helper add_dracut_module.

Also remove the unnecessary return in depend() function.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
Kairui Song 2020-10-15 18:16:42 +08:00
parent cd85fe9165
commit 08de712528
2 changed files with 8 additions and 10 deletions

View File

@ -36,6 +36,14 @@ depends() {
dwarning "Required modules to build a squashed kdump image is missing!" dwarning "Required modules to build a squashed kdump image is missing!"
fi fi
if is_ssh_dump_target; then
_dep="$_dep ssh-client"
fi
if [ "$(uname -m)" = "s390x" ]; then
_dep="$_dep znet"
fi
if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then
_dep="$_dep drm" _dep="$_dep drm"
fi fi
@ -45,7 +53,6 @@ depends() {
fi fi
echo $_dep echo $_dep
return 0
} }
kdump_is_bridge() { kdump_is_bridge() {

View File

@ -62,10 +62,6 @@ add_dracut_arg() {
dracut_args="$dracut_args $@" dracut_args="$dracut_args $@"
} }
add_dracut_module() {
add_dracut_arg "--add" "\"$1\""
}
add_dracut_mount() { add_dracut_mount() {
add_dracut_arg "--mount" "\"$1\"" add_dracut_arg "--mount" "\"$1\""
} }
@ -421,10 +417,6 @@ if [ -f "$keyfile" ]; then
SSH_KEY_LOCATION=$(/usr/bin/readlink -m $keyfile) SSH_KEY_LOCATION=$(/usr/bin/readlink -m $keyfile)
fi fi
if [ "$(uname -m)" = "s390x" ]; then
add_dracut_module "znet"
fi
if is_wdt_addition_needed; then if is_wdt_addition_needed; then
add_dracut_arg "-a" "watchdog" add_dracut_arg "-a" "watchdog"
fi fi
@ -457,7 +449,6 @@ do
then then
mkdir_save_path_ssh $config_val mkdir_save_path_ssh $config_val
check_size ssh $config_val check_size ssh $config_val
add_dracut_module "ssh-client"
add_dracut_sshkey "$SSH_KEY_LOCATION" add_dracut_sshkey "$SSH_KEY_LOCATION"
else else
perror_exit "Bad ssh dump target $config_val" perror_exit "Bad ssh dump target $config_val"