Set zstd as recommented for kexec-tools

resolves: bz1896698
upstream: fedora
conflict: none

commit b8ec5cbda89610244fdd4711e5974350f78e63e3
Author: Tao Liu <ltao@redhat.com>
Date:   Fri Jan 7 19:47:06 2022 +0800

    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>

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2022-01-07 19:47:06 +08:00
parent 35486b6030
commit a501dcbd7b
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

@ -71,7 +71,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,7 +432,12 @@ done <<< "$(kdump_read_conf)"
handle_default_dump_target
if ! have_compression_in_dracut_args; then
add_dracut_arg "--compress" "zstd"
# 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

View File

@ -62,8 +62,11 @@ if is_squash_available; then
_dracut_isolate_args+=(--add squash)
fi
# Same as setting zstd in mkdumprd
if ! have_compression_in_dracut_args; then
_dracut_isolate_args+=(--compress zstd)
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