module-setup.sh: don't polute the namespace unnecessarily

Only source kdump libs when building a kdump initramfs.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
Kairui Song 2021-01-19 22:23:16 +08:00
parent d49a5015d8
commit 88f787e1f5
2 changed files with 11 additions and 5 deletions

View File

@ -1,7 +1,6 @@
#!/bin/bash #!/bin/bash
. /etc/sysconfig/kdump . /etc/sysconfig/kdump
. /lib/kdump/kdump-lib.sh
KDUMP_KERNEL="" KDUMP_KERNEL=""
KDUMP_INITRD="" KDUMP_INITRD=""
@ -21,6 +20,8 @@ depends() {
} }
prepare_kernel_initrd() { prepare_kernel_initrd() {
. /lib/kdump/kdump-lib.sh
prepare_kdump_bootinfo prepare_kdump_bootinfo
# $kernel is a variable from dracut # $kernel is a variable from dracut

View File

@ -1,11 +1,13 @@
#!/bin/bash #!/bin/bash
. /lib/kdump/kdump-lib.sh kdump_module_init() {
if ! [[ -d "${initdir}/tmp" ]]; then if ! [[ -d "${initdir}/tmp" ]]; then
mkdir -p "${initdir}/tmp" mkdir -p "${initdir}/tmp"
fi fi
. /lib/kdump/kdump-lib.sh
}
check() { check() {
[[ $debug ]] && set -x [[ $debug ]] && set -x
#kdumpctl sets this explicitly #kdumpctl sets this explicitly
@ -19,6 +21,8 @@ check() {
depends() { depends() {
local _dep="base shutdown" local _dep="base shutdown"
kdump_module_init
add_opt_module() { add_opt_module() {
[[ " $omit_dracutmodules " != *\ $1\ * ]] && _dep="$_dep $1" [[ " $omit_dracutmodules " != *\ $1\ * ]] && _dep="$_dep $1"
} }
@ -825,6 +829,7 @@ kdump_install_systemd_conf() {
} }
install() { install() {
kdump_module_init
kdump_install_conf kdump_install_conf
overwrite_sysctl_conf overwrite_sysctl_conf