diff --git a/kdump-lib.sh b/kdump-lib.sh index 817652d..b50b4f4 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -37,6 +37,12 @@ is_zstd_command_available() [[ -x "$(command -v zstd)" ]] } +dracut_have_option() +{ + local _option=$1 + ! dracut "$_option" 2>&1 | grep -q "unrecognized option" +} + perror_exit() { derror "$@" @@ -448,8 +454,7 @@ is_wdt_active() have_compression_in_dracut_args() { - [[ "$(kdump_get_conf_val dracut_args)" =~ \ - (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress)([[:space:]]|$) ]] + [[ "$(kdump_get_conf_val dracut_args)" =~ (^|[[:space:]])--(gzip|bzip2|lzma|xz|lzo|lz4|zstd|no-compress|compress|squash-compressor)([[:space:]]|$) ]] } # If "dracut_args" contains "--mount" information, use it diff --git a/kexec-tools.spec b/kexec-tools.spec index ee43b13..c829bbe 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -64,7 +64,6 @@ Requires: dracut >= 050 Requires: dracut-network >= 050 Requires: dracut-squash >= 050 Requires: ethtool -Recommends: zstd Recommends: grubby Recommends: hostname BuildRequires: make diff --git a/mkdumprd b/mkdumprd index 2e5659d..7b843a8 100644 --- a/mkdumprd +++ b/mkdumprd @@ -432,10 +432,9 @@ done <<< "$(kdump_read_conf)" handle_default_dump_target if ! have_compression_in_dracut_args; then - # Here zstd is set as the default compression method. If squash module - # is available for dracut, libzstd will be used by mksquashfs. If - # squash module is unavailable, command zstd will be used instead. - if is_squash_available || is_zstd_command_available; then + if is_squash_available && dracut_have_option "--squash-compressor"; then + add_dracut_arg "--squash-compressor" "zstd" + elif is_zstd_command_available; then add_dracut_arg "--compress" "zstd" fi fi diff --git a/mkfadumprd b/mkfadumprd index 86dfcee..f353f15 100644 --- a/mkfadumprd +++ b/mkfadumprd @@ -64,7 +64,9 @@ fi # Same as setting zstd in mkdumprd if ! have_compression_in_dracut_args; then - if is_squash_available || is_zstd_command_available; then + if is_squash_available && dracut_have_option "--squash-compressor"; then + _dracut_isolate_args+=(--squash-compressor zstd) + elif is_zstd_command_available; then _dracut_isolate_args+=(--compress zstd) fi fi