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
. /etc/sysconfig/kdump
. /lib/kdump/kdump-lib.sh
KDUMP_KERNEL=""
KDUMP_INITRD=""
@ -21,6 +20,8 @@ depends() {
}
prepare_kernel_initrd() {
. /lib/kdump/kdump-lib.sh
prepare_kdump_bootinfo
# $kernel is a variable from dracut

View File

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