kdump-lib: make is_zstd_command_available more generic
There is value to use the function in other places as well. For example it can be used to check whether optional dependencies, like grubby, are installed. Thus make it more generic so it can be reused in later commits. Signed-off-by: Philipp Rudo <prudo@redhat.com> Reviewed-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
026edc2b59
commit
bbda12a5ac
@ -48,9 +48,9 @@ is_squash_available()
|
||||
done
|
||||
}
|
||||
|
||||
is_zstd_command_available()
|
||||
has_command()
|
||||
{
|
||||
[[ -x "$(command -v zstd)" ]]
|
||||
[[ -x $(command -v "$1") ]]
|
||||
}
|
||||
|
||||
dracut_have_option()
|
||||
|
2
mkdumprd
2
mkdumprd
@ -443,7 +443,7 @@ handle_default_dump_target
|
||||
if ! have_compression_in_dracut_args; then
|
||||
if is_squash_available && dracut_have_option "--squash-compressor"; then
|
||||
add_dracut_arg "--squash-compressor" "zstd"
|
||||
elif is_zstd_command_available; then
|
||||
elif has_command zstd; then
|
||||
add_dracut_arg "--compress" "zstd"
|
||||
fi
|
||||
fi
|
||||
|
@ -64,7 +64,7 @@ _dracut_isolate_args=(
|
||||
|
||||
# Use zstd compression method, if available
|
||||
if ! have_compression_in_dracut_args; then
|
||||
if is_zstd_command_available; then
|
||||
if has_command zstd; then
|
||||
_dracut_isolate_args+=(--compress zstd)
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user