diff --git a/kdump-lib.sh b/kdump-lib.sh index 43116a9..6475f52 100755 --- a/kdump-lib.sh +++ b/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 + set -- $(grep "^dracut_args" /etc/kdump.conf) + while [ $# -gt 0 ]; do + case $1 in + -o|--omit) + [[ " ${2//[^[:alnum:]]/ } " == *" $dracut_mod "* ]] && return 0 + esac + shift + done - eval set -- $dracut_args - while :; do - [[ -z $1 ]] && break - case $1 in - -o|--omit) - echo $2 | grep -qw "watchdog" - [[ $? == 0 ]] && ret=0 - break - esac - shift - done - - return $ret + return 1 } is_wdt_active() { diff --git a/kdumpctl b/kdumpctl index 14e99d7..3f6a9be 100755 --- a/kdumpctl +++ b/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' ' ')"