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}"
|
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
|
# returns 1 otherwise
|
||||||
is_wdt_mod_omitted() {
|
is_dracut_mod_omitted() {
|
||||||
local dracut_args
|
local dracut_args dracut_mod=$1
|
||||||
local ret=1
|
|
||||||
|
|
||||||
dracut_args=$(grep "^dracut_args" /etc/kdump.conf)
|
set -- $(grep "^dracut_args" /etc/kdump.conf)
|
||||||
[[ -z $dracut_args ]] && return $ret
|
while [ $# -gt 0 ]; do
|
||||||
|
|
||||||
eval set -- $dracut_args
|
|
||||||
while :; do
|
|
||||||
[[ -z $1 ]] && break
|
|
||||||
case $1 in
|
case $1 in
|
||||||
-o|--omit)
|
-o|--omit)
|
||||||
echo $2 | grep -qw "watchdog"
|
[[ " ${2//[^[:alnum:]]/ } " == *" $dracut_mod "* ]] && return 0
|
||||||
[[ $? == 0 ]] && ret=0
|
|
||||||
break
|
|
||||||
esac
|
esac
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
return $ret
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
is_wdt_active() {
|
is_wdt_active() {
|
||||||
|
2
kdumpctl
2
kdumpctl
@ -452,7 +452,7 @@ check_drivers_modified()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Include watchdog drivers if watchdog module is not omitted
|
# 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
|
[ -z "$_new_drivers" ] && return 0
|
||||||
_old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')"
|
_old_drivers="$(lsinitrd $TARGET_INITRD -f /usr/lib/dracut/hostonly-kernel-modules.txt | tr '\n' ' ')"
|
||||||
|
Loading…
Reference in New Issue
Block a user