kdump-lib.sh: Use a more generic helper to detect omitted dracut module
Signed-off-by: Kairui Song <kasong@redhat.com> Acked-by: Lianbo Jiang <lijiang@redhat.com>
This commit is contained in:
parent
647aa56b53
commit
4464bcf8f3
21
kdump-lib.sh
21
kdump-lib.sh
@ -455,28 +455,21 @@ get_ifcfg_filename() {
|
||||
echo -n "${ifcfg_file}"
|
||||
}
|
||||
|
||||
# returns 0 when omission of watchdog module is desired in dracut_args
|
||||
# returns 0 when omission of a module is desired in dracut_args
|
||||
# returns 1 otherwise
|
||||
is_wdt_mod_omitted() {
|
||||
local dracut_args
|
||||
local ret=1
|
||||
is_dracut_mod_omitted() {
|
||||
local dracut_args dracut_mod=$1
|
||||
|
||||
dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
|
||||
[[ -z $dracut_args ]] && return $ret
|
||||
|
||||
eval set -- $dracut_args
|
||||
while :; do
|
||||
[[ -z $1 ]] && break
|
||||
set -- $(grep "^dracut_args" /etc/kdump.conf)
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-o|--omit)
|
||||
echo $2 | grep -qw "watchdog"
|
||||
[[ $? == 0 ]] && ret=0
|
||||
break
|
||||
[[ " ${2//[^[:alnum:]]/ } " == *" $dracut_mod "* ]] && return 0
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
return $ret
|
||||
return 1
|
||||
}
|
||||
|
||||
is_wdt_active() {
|
||||
|
2
kdumpctl
2
kdumpctl
@ -452,7 +452,7 @@ check_drivers_modified()
|
||||
fi
|
||||
|
||||
# Include watchdog drivers if watchdog module is not omitted
|
||||
is_wdt_mod_omitted || _new_drivers+=" $(get_watchdog_drvs)"
|
||||
is_dracut_mod_omitted watchdog || _new_drivers+=" $(get_watchdog_drvs)"
|
||||
|
||||
[ -z "$_new_drivers" ] && return 0
|
||||
_old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')"
|
||||
|
Loading…
Reference in New Issue
Block a user