Hi everybody,
While looking at the code I noticed that it contains some dead functions. This series removes them. Furthermore it fixes two small bugs.
Thanks Philipp
Philipp Rudo (8): kdump-lib-initramfs: harden is_mounted kdump-lib-initramfs: remove is_fs_dump_target dracut-module-setup: remove dead source_ifcfg_file kdump-lib: remove get_nmcli_field_by_conpath kdump-lib: remove get_nmcli_connection_apath_by_ifname kdump-lib: remove kdump_get_maj_min kdump-lib: move is_dracut_mod_omitted to kdumpctl kdumpctl: fix is_dracut_mod_omitted
dracut-module-setup.sh | 13 --- kdump-lib-initramfs.sh | 7 +- kdump-lib.sh | 157 +--------------------------------- kdumpctl | 51 +++++++++++ kexec-tools.spec | 1 + spec/kdumpctl_general_spec.sh | 48 +++++++++++ 6 files changed, 103 insertions(+), 174 deletions(-)
If the device/mountpoint for findmnt is omitted findmnt will list all mounted filesystems. In that case it will always return "true". So explicitly check if an argument was passed to prevent false-positives.
Signed-off-by: Philipp Rudo prudo@redhat.com --- kdump-lib-initramfs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index e45d6de..06e1647 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -30,7 +30,7 @@ kdump_get_conf_val()
is_mounted() { - findmnt -k -n "$1" > /dev/null 2>&1 + [ -n "$1" ] && findmnt -k -n "$1" > /dev/null 2>&1 }
# $1: info type
The function isn't used anywhere. Thus remove it to keep kdump-lib-initramfs small and simple.
Signed-off-by: Philipp Rudo prudo@redhat.com --- kdump-lib-initramfs.sh | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 06e1647..1145abb 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -150,11 +150,6 @@ is_nfs_dump_target() return 1 }
-is_fs_dump_target() -{ - [ -n "$(kdump_get_conf_val "ext[234]|xfs|btrfs|minix|virtiofs")" ] -} - is_lvm2_thinp_device() { _device_path=$1
Looks good to me. Reviewed-by: Lichen Liu lichliu@redhat.com
On Tue, Mar 14, 2023 at 12:17 AM Philipp Rudo prudo@redhat.com wrote:
The function isn't used anywhere. Thus remove it to keep kdump-lib-initramfs small and simple.
Signed-off-by: Philipp Rudo prudo@redhat.com
kdump-lib-initramfs.sh | 5 ----- 1 file changed, 5 deletions(-)
diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index 06e1647..1145abb 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -150,11 +150,6 @@ is_nfs_dump_target() return 1 }
-is_fs_dump_target() -{
[ -n "$(kdump_get_conf_val "ext[234]\|xfs\|btrfs\|minix\|virtiofs")" ]-}
is_lvm2_thinp_device() { _device_path=$1 -- 2.39.2 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
With the NetworkManager rewrite this function in no longer used. This also allows to remove a lot of dead code in kdump-lib.
Signed-off-by: Philipp Rudo prudo@redhat.com --- dracut-module-setup.sh | 13 ------ kdump-lib.sh | 104 ----------------------------------------- 2 files changed, 117 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index a8ac16c..3faf239 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -91,19 +91,6 @@ kdump_is_vlan() { [[ -f /proc/net/vlan/"$1" ]] }
-# $1: netdev name -source_ifcfg_file() { - local ifcfg_file - - dwarning "Network Scripts are deprecated. You are encouraged to set up network by NetworkManager." - ifcfg_file=$(get_ifcfg_filename "$1") - if [[ -f ${ifcfg_file} ]]; then - . "${ifcfg_file}" - else - dwarning "The ifcfg file of $1 is not found!" - fi -} - # $1: repeat times # $2: string to be repeated # $3: separator diff --git a/kdump-lib.sh b/kdump-lib.sh index 6b0a83d..bfc650c 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -292,18 +292,6 @@ is_hostname() echo "$1" | grep -q "[a-zA-Z]" }
-# Copied from "/etc/sysconfig/network-scripts/network-functions" -get_hwaddr() -{ - if [[ -f "/sys/class/net/$1/address" ]]; then - awk '{ print toupper($0) }' < "/sys/class/net/$1/address" - elif [[ -d "/sys/class/net/$1" ]]; then - LC_ALL="" LANG="" ip -o link show "$1" 2> /dev/null | - awk '{ print toupper(gensub(/.*link/[^ ]* ([[:alnum:]:]*).*/, - "\1", 1)); }' - fi -} - # Get value by a field using "nmcli -g" # Usage: get_nmcli_value_by_field <field> <nmcli command> # @@ -339,98 +327,6 @@ get_nmcli_connection_apath_by_ifname() get_nmcli_value_by_field "GENERAL.CON-PATH" device show "$_ifname" }
-get_ifcfg_by_device() -{ - grep -E -i -l "^[[:space:]]*DEVICE="*${1}"*[[:space:]]*$" \ - /etc/sysconfig/network-scripts/ifcfg-* 2> /dev/null | head -1 -} - -get_ifcfg_by_hwaddr() -{ - grep -E -i -l "^[[:space:]]*HWADDR="*${1}"*[[:space:]]*$" \ - /etc/sysconfig/network-scripts/ifcfg-* 2> /dev/null | head -1 -} - -get_ifcfg_by_uuid() -{ - grep -E -i -l "^[[:space:]]*UUID="*${1}"*[[:space:]]*$" \ - /etc/sysconfig/network-scripts/ifcfg-* 2> /dev/null | head -1 -} - -get_ifcfg_by_name() -{ - grep -E -i -l "^[[:space:]]*NAME="*${1}"*[[:space:]]*$" \ - /etc/sysconfig/network-scripts/ifcfg-* 2> /dev/null | head -1 -} - -is_nm_running() -{ - [[ "$(LANG=C nmcli -t --fields running general status 2> /dev/null)" == "running" ]] -} - -is_nm_handling() -{ - LANG=C nmcli -t --fields device,state dev status 2> /dev/null | - grep -q "^(${1}:connected)|(${1}:connecting.*)$" -} - -# $1: netdev name -get_ifcfg_nmcli() -{ - local nm_uuid nm_name - local ifcfg_file - - # Get the active nmcli config name of $1 - if is_nm_running && is_nm_handling "${1}"; then - # The configuration "uuid" and "name" generated by nm is wrote to - # the ifcfg file as "UUID=<nm_uuid>" and "NAME=<nm_name>". - nm_uuid=$(LANG=C nmcli -t --fields uuid,device c show --active 2> /dev/null | - grep "${1}" | head -1 | cut -d':' -f1) - nm_name=$(LANG=C nmcli -t --fields name,device c show --active 2> /dev/null | - grep "${1}" | head -1 | cut -d':' -f1) - ifcfg_file=$(get_ifcfg_by_uuid "${nm_uuid}") - [[ -z ${ifcfg_file} ]] && ifcfg_file=$(get_ifcfg_by_name "${nm_name}") - fi - - echo -n "${ifcfg_file}" -} - -# $1: netdev name -get_ifcfg_legacy() -{ - local ifcfg_file hwaddr - - ifcfg_file="/etc/sysconfig/network-scripts/ifcfg-${1}" - [[ -f ${ifcfg_file} ]] && echo -n "${ifcfg_file}" && return - - ifcfg_file=$(get_ifcfg_by_name "${1}") - [[ -f ${ifcfg_file} ]] && echo -n "${ifcfg_file}" && return - - hwaddr=$(get_hwaddr "${1}") - if [[ -n $hwaddr ]]; then - ifcfg_file=$(get_ifcfg_by_hwaddr "${hwaddr}") - [[ -f ${ifcfg_file} ]] && echo -n "${ifcfg_file}" && return - fi - - ifcfg_file=$(get_ifcfg_by_device "${1}") - - echo -n "${ifcfg_file}" -} - -# $1: netdev name -# Return the ifcfg file whole name(including the path) of $1 if any. -get_ifcfg_filename() -{ - local ifcfg_file - - ifcfg_file=$(get_ifcfg_nmcli "${1}") - if [[ -z ${ifcfg_file} ]]; then - ifcfg_file=$(get_ifcfg_legacy "${1}") - fi - - echo -n "${ifcfg_file}" -} - # returns 0 when omission of a module is desired in dracut_args # returns 1 otherwise is_dracut_mod_omitted()
The function isn't used anywhere. Thus remove it to keep kdump-lib small and simple.
Signed-off-by: Philipp Rudo prudo@redhat.com --- kdump-lib.sh | 9 --------- 1 file changed, 9 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index bfc650c..06cdc9e 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -307,15 +307,6 @@ get_nmcli_value_by_field() LANG=C nmcli --get-values "$@" }
-# Get nmcli field value of an connection apath (a D-Bus active connection path) -# Usage: get_nmcli_field_by_apath <field> <apath> -get_nmcli_field_by_conpath() -{ - local _field=$1 _apath=$2 - - get_nmcli_value_by_field "$_field" connection show "$_apath" -} - # Get nmcli connection apath (a D-Bus active connection path ) by ifname # # apath is used for nmcli connection operations, e.g.
The function isn't used anywhere. Thus remove it to keep kdump-lib small and simple.
Signed-off-by: Philipp Rudo prudo@redhat.com --- kdump-lib.sh | 11 ----------- 1 file changed, 11 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 06cdc9e..722616c 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -307,17 +307,6 @@ get_nmcli_value_by_field() LANG=C nmcli --get-values "$@" }
-# Get nmcli connection apath (a D-Bus active connection path ) by ifname -# -# apath is used for nmcli connection operations, e.g. -# $ nmcli connection show $apath -get_nmcli_connection_apath_by_ifname() -{ - local _ifname=$1 - - get_nmcli_value_by_field "GENERAL.CON-PATH" device show "$_ifname" -} - # returns 0 when omission of a module is desired in dracut_args # returns 1 otherwise is_dracut_mod_omitted()
Drop the function in favor of the identical get_maj_min function from dracut-functions.
Signed-off-by: Philipp Rudo prudo@redhat.com --- kdump-lib.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 722616c..495994f 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -7,6 +7,8 @@ if [[ ${__SOURCED__:+x} ]]; then else . /lib/kdump/kdump-lib-initramfs.sh fi +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +. $dracutbasedir/dracut-functions.sh
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" @@ -852,18 +854,6 @@ get_luks_crypt_dev() done }
-# kdump_get_maj_min <device> -# Prints the major and minor of a device node. -# Example: -# $ get_maj_min /dev/sda2 -# 8:2 -kdump_get_maj_min() -{ - local _majmin - _majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)" - printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))" -} - get_all_kdump_crypt_dev() { local _dev
Hi Philipp,
I see get_all_kdump_crypt_dev() will call kdump_get_maj_min(), maybe should be replaced with get_maj_min().
Lichen
On Tue, Mar 14, 2023 at 12:17 AM Philipp Rudo prudo@redhat.com wrote:
Drop the function in favor of the identical get_maj_min function from dracut-functions.
Signed-off-by: Philipp Rudo prudo@redhat.com
kdump-lib.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 722616c..495994f 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -7,6 +7,8 @@ if [[ ${__SOURCED__:+x} ]]; then else . /lib/kdump/kdump-lib-initramfs.sh fi +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +. $dracutbasedir/dracut-functions.sh
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" @@ -852,18 +854,6 @@ get_luks_crypt_dev() done }
-# kdump_get_maj_min <device> -# Prints the major and minor of a device node. -# Example: -# $ get_maj_min /dev/sda2 -# 8:2 -kdump_get_maj_min() -{
local _majmin_majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)"printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"-}
get_all_kdump_crypt_dev() { local _dev -- 2.39.2 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
On Wed, 15 Mar 2023 10:01:43 +0800 Lichen Liu lichliu@redhat.com wrote:
Hi Philipp,
I see get_all_kdump_crypt_dev() will call kdump_get_maj_min(), maybe should be replaced with get_maj_min().
Ouch! I wonder how I missed that...
I've fixed it locally but will wait with sending the v2 for a couple of days in case you find more.
Thanks! Philipp
Lichen
On Tue, Mar 14, 2023 at 12:17 AM Philipp Rudo prudo@redhat.com wrote:
Drop the function in favor of the identical get_maj_min function from dracut-functions.
Signed-off-by: Philipp Rudo prudo@redhat.com
kdump-lib.sh | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 722616c..495994f 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -7,6 +7,8 @@ if [[ ${__SOURCED__:+x} ]]; then else . /lib/kdump/kdump-lib-initramfs.sh fi +[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut +. $dracutbasedir/dracut-functions.sh
FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" @@ -852,18 +854,6 @@ get_luks_crypt_dev() done }
-# kdump_get_maj_min <device> -# Prints the major and minor of a device node. -# Example: -# $ get_maj_min /dev/sda2 -# 8:2 -kdump_get_maj_min() -{
local _majmin_majmin="$(stat -L -c '%t:%T' "$1" 2> /dev/null)"printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"-}
get_all_kdump_crypt_dev() { local _dev -- 2.39.2 _______________________________________________ kexec mailing list -- kexec@lists.fedoraproject.org To unsubscribe send an email to kexec-leave@lists.fedoraproject.org Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/ List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines List Archives: https://lists.fedoraproject.org/archives/list/kexec@lists.fedoraproject.org Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue
The function is only used in kdumpctl. Thus move it there to keep kdump-lib small and simple.
Signed-off-by: Philipp Rudo prudo@redhat.com --- kdump-lib.sh | 19 ------------------- kdumpctl | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 495994f..9d110ab 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -309,25 +309,6 @@ get_nmcli_value_by_field() LANG=C nmcli --get-values "$@" }
-# returns 0 when omission of a module is desired in dracut_args -# returns 1 otherwise -is_dracut_mod_omitted() -{ - local dracut_args dracut_mod=$1 - - set -- $(kdump_get_conf_val dracut_args) - while [ $# -gt 0 ]; do - case $1 in - -o | --omit) - [[ " ${2//[^[:alnum:]]/ } " == *" $dracut_mod "* ]] && return 0 - ;; - esac - shift - done - - return 1 -} - is_wdt_active() { local active diff --git a/kdumpctl b/kdumpctl index 2bec428..ee711ac 100755 --- a/kdumpctl +++ b/kdumpctl @@ -45,6 +45,25 @@ if ! dlog_init; then exit 1 fi
+# returns 0 when omission of a module is desired in dracut_args +# returns 1 otherwise +is_dracut_mod_omitted() +{ + local dracut_args dracut_mod=$1 + + set -- $(kdump_get_conf_val dracut_args) + while [ $# -gt 0 ]; do + case $1 in + -o | --omit) + [[ " ${2//[^[:alnum:]]/ } " == *" $dracut_mod "* ]] && return 0 + ;; + esac + shift + done + + return 1 +} + single_instance_lock() { local rc timeout=5 lockfile
The function is pretty broken right now. To start with the -o/--omit option allows a quoted, space separated list of modules. But using 'set' breaks quotation and thus only considers the first element in the list. Furthermore dracut uses getopt internally. This means that it is also possible to pass the list via --omit=.
Fix the function by making use of getopt for parsing the dracut_args. While at it also add a test cases to cover the functions.
Signed-off-by: Philipp Rudo prudo@redhat.com --- kdumpctl | 52 ++++++++++++++++++++++++++++------- kexec-tools.spec | 1 + spec/kdumpctl_general_spec.sh | 48 ++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 10 deletions(-)
diff --git a/kdumpctl b/kdumpctl index ee711ac..8c2c422 100755 --- a/kdumpctl +++ b/kdumpctl @@ -45,23 +45,55 @@ if ! dlog_init; then exit 1 fi
-# returns 0 when omission of a module is desired in dracut_args -# returns 1 otherwise -is_dracut_mod_omitted() +_get_dracut_arg() { - local dracut_args dracut_mod=$1 + local shortopt longopt n tmp + local -a _opt _ret + + shortopt=$1; shift + longopt=$1; shift + n=0
- set -- $(kdump_get_conf_val dracut_args) - while [ $# -gt 0 ]; do + if [[ -n $shortopt ]]; then + _opt+=(-o "${shortopt#-}:") + else + # getopt requires the -o/--option to be set. + _opt+=(-o "") + fi + [[ -n $longopt ]] && _opt+=(--long "${longopt#--}:") + + # make sure bash didn't break quoting + eval set -- "$*" + tmp=$( + unset POSIXLY_CORRECT + getopt -q "${_opt[@]}" -- "$@" + ) + eval set -- "$tmp" + while :; do case $1 in - -o | --omit) - [[ " ${2//[^[:alnum:]]/ } " == *" $dracut_mod "* ]] && return 0 - ;; + "$shortopt"|"$longopt") + _ret+=("$2"); shift + n=$((n+1)) + ;; + --|*) + break + ;; esac shift done
- return 1 + echo "${_ret[@]}" + return $n +} + +is_dracut_mod_omitted() +{ + local mod omitted + + mod=$1 + omitted=$(_get_dracut_arg -o --omit "${OPT[dracut_args]}") + + [[ " $omitted " == *" $mod "* ]] }
single_instance_lock() diff --git a/kexec-tools.spec b/kexec-tools.spec index 5c42af6..0156767 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -65,6 +65,7 @@ Requires: dracut >= 050 Requires: dracut-network >= 050 Requires: dracut-squash >= 050 Requires: ethtool +Requires: util-linx Recommends: grubby Recommends: hostname BuildRequires: make diff --git a/spec/kdumpctl_general_spec.sh b/spec/kdumpctl_general_spec.sh index 41fbc29..bb5755c 100644 --- a/spec/kdumpctl_general_spec.sh +++ b/spec/kdumpctl_general_spec.sh @@ -107,6 +107,54 @@ Describe 'kdumpctl' End End
+ Describe "_get_dracut_arg" + dracut_args='-o "foo bar baz" -t 1 --test="a b c" --omit bla' + Parameters + -o --omit 2 "foo bar baz bla" + -e --empty 0 "" + -t "" 1 "1" + "" --test 1 "a b c" + "" "" 0 "" + End + It "should parse the dracut_args correctly" + When call _get_dracut_arg "$1" "$2" "$dracut_args" + The status should equal $3 + The output should equal "$4" + End + End + + Describe "is_dracut_mod_omitted()" + KDUMP_CONFIG_FILE=$(mktemp -t kdump_conf.XXXXXXXXXX) + cleanup() { + rm -f "$kdump_conf" + } + AfterAll 'cleanup' + + Parameters:dynamic + for opt in '-o ' '--omit ' '--omit='; do + for val in \ + 'foo' \ + '"foo"' \ + '"foo bar baz"' \ + '"bar foo baz"' \ + '"bar baz foo"'; do + %data success foo "$opt$val" + %data success foo "-a x $opt$val -i y" + %data failure xyz "$opt$val" + %data failure xyz "-a x $opt$val -i y" + done + done + %data success foo "-o xxx -o foo" + %data failure foo "-a x -i y" + End + It "shall return $1 for module $2 and dracut_args '$3'" + echo "dracut_args $3" > $KDUMP_CONFIG_FILE + parse_config + When call is_dracut_mod_omitted $2 + The status should be $1 + End + End + Describe '_update_kernel_arg_in_grub_etc_default()' GRUB_ETC_DEFAULT=/tmp/default_grub
Hi,
On Mon, 13 Mar 2023 17:16:53 +0100 Philipp Rudo prudo@redhat.com wrote:
The function is pretty broken right now. To start with the -o/--omit option allows a quoted, space separated list of modules. But using 'set' breaks quotation and thus only considers the first element in the list. Furthermore dracut uses getopt internally. This means that it is also possible to pass the list via --omit=.
Fix the function by making use of getopt for parsing the dracut_args. While at it also add a test cases to cover the functions.
Signed-off-by: Philipp Rudo prudo@redhat.com
kdumpctl | 52 ++++++++++++++++++++++++++++------- kexec-tools.spec | 1 + spec/kdumpctl_general_spec.sh | 48 ++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 10 deletions(-)
[...]
diff --git a/kexec-tools.spec b/kexec-tools.spec index 5c42af6..0156767 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -65,6 +65,7 @@ Requires: dracut >= 050 Requires: dracut-network >= 050 Requires: dracut-squash >= 050 Requires: ethtool +Requires: util-linx
^^^^ I just noticed this typo and fixed it locally.
Thanks Philipp
Recommends: grubby Recommends: hostname BuildRequires: make diff --git a/spec/kdumpctl_general_spec.sh b/spec/kdumpctl_general_spec.sh index 41fbc29..bb5755c 100644 --- a/spec/kdumpctl_general_spec.sh +++ b/spec/kdumpctl_general_spec.sh @@ -107,6 +107,54 @@ Describe 'kdumpctl' End End
- Describe "_get_dracut_arg"
dracut_args='-o "foo bar baz" -t 1 --test="a b c" --omit bla'Parameters-o --omit 2 "foo bar baz bla"-e --empty 0 ""-t "" 1 "1""" --test 1 "a b c""" "" 0 ""EndIt "should parse the dracut_args correctly"When call _get_dracut_arg "$1" "$2" "$dracut_args"The status should equal $3The output should equal "$4"End- End
- Describe "is_dracut_mod_omitted()"
KDUMP_CONFIG_FILE=$(mktemp -t kdump_conf.XXXXXXXXXX)cleanup() {rm -f "$kdump_conf"}AfterAll 'cleanup'Parameters:dynamicfor opt in '-o ' '--omit ' '--omit='; dofor val in \'foo' \'"foo"' \'"foo bar baz"' \'"bar foo baz"' \'"bar baz foo"'; do%data success foo "$opt$val"%data success foo "-a x $opt$val -i y"%data failure xyz "$opt$val"%data failure xyz "-a x $opt$val -i y"donedone%data success foo "-o xxx -o foo"%data failure foo "-a x -i y"EndIt "shall return $1 for module $2 and dracut_args '$3'"echo "dracut_args $3" > $KDUMP_CONFIG_FILEparse_configWhen call is_dracut_mod_omitted $2The status should be $1End- End
- Describe '_update_kernel_arg_in_grub_etc_default()' GRUB_ETC_DEFAULT=/tmp/default_grub