diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index e982b14..52dfcb4 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -63,13 +63,13 @@ is_fs_type_virtiofs() # If $1 contains dracut_args "--mount", return get_dracut_args_fstype() { - echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f3 + echo "$1" | sed -n "s/.*--mount .\(.*\)/\1/p" | cut -d' ' -f3 } # If $1 contains dracut_args "--mount", return get_dracut_args_target() { - echo $1 | grep "\-\-mount" | sed "s/.*--mount .\(.*\)/\1/" | cut -d' ' -f1 + echo "$1" | sed -n "s/.*--mount .\(.*\)/\1/p" | cut -d' ' -f1 } get_save_path() diff --git a/kdumpctl b/kdumpctl index 7f82f4f..8ff4cb0 100755 --- a/kdumpctl +++ b/kdumpctl @@ -224,7 +224,7 @@ parse_config() case "$config_opt" in dracut_args) if [[ $config_val == *--mount* ]]; then - if [[ $(echo "$config_val" | grep -o "\-\-mount" | wc -l) -ne 1 ]]; then + if [[ $(echo "$config_val" | grep -o -- "--mount" | wc -l) -ne 1 ]]; then derror 'Multiple mount targets specified in one "dracut_args".' return 1 fi @@ -506,7 +506,7 @@ check_fs_modified() # if --mount argument present then match old and new target, mount # point and file system. If any of them mismatches then rebuild - if echo "$_dracut_args" | grep -q "\-\-mount"; then + if echo "$_dracut_args" | grep -q -- "--mount"; then # shellcheck disable=SC2046 set -- $(echo "$_dracut_args" | awk -F "--mount '" '{print $2}' | cut -d' ' -f1,2,3) _old_dev=$1