Set zstd as recommented for kexec-tools

This patch will make zstd as recommended instead of required for
kexec-tools. If zstd command/package is unavaliable, it can failback to invoke
gzip when making kdump initramfs.

Fixes: 0311f6e ("Set zstd as the default compression method for kdump initrd")

Signed-off-by: Tao Liu <ltao@redhat.com>
Acked-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Tao Liu 2022-01-10 21:51:16 +08:00 committed by Coiby Xu
parent ae0cbdf34a
commit 7de4a0d6c8
4 changed files with 16 additions and 3 deletions

View File

@ -31,6 +31,11 @@ is_squash_available()
done
}
is_zstd_command_available()
{
[[ -x "$(command -v zstd)" ]]
}
perror_exit()
{
derror "$@"

View File

@ -70,7 +70,7 @@ Requires: dracut >= 050
Requires: dracut-network >= 050
Requires: dracut-squash >= 050
Requires: ethtool
Requires: zstd
Recommends: zstd
Recommends: grubby
BuildRequires: make
BuildRequires: zlib-devel elfutils-devel glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel libzstd-devel

View File

@ -432,8 +432,13 @@ 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
add_dracut_arg "--compress" "zstd"
fi
fi
if [[ -n $extra_modules ]]; then
add_dracut_arg "--add-drivers" "$extra_modules"

View File

@ -62,9 +62,12 @@ if is_squash_available; then
_dracut_isolate_args+=(--add squash)
fi
# Same as setting zstd in mkdumprd
if ! have_compression_in_dracut_args; then
if is_squash_available || is_zstd_command_available; then
_dracut_isolate_args+=(--compress zstd)
fi
fi
if ! dracut --force --quiet "${_dracut_isolate_args[@]}" "$@" "$TARGET_INITRD"; then
perror_exit "mkfadumprd: failed to setup '$TARGET_INITRD' with dump capture capability"