No function change, decide which compressor to use right before
compressing the initramfs.
This may delay the print of this message:
"dracut: no compression tool available. Initramfs image is going to be big."
but should be OK, this message is not an error.
master
Kairui Song3 years agocommitted byJóhann B. Guðmundsson
@ -905,53 +905,6 @@ if [[ $_no_compress_l = "$DRACUT_COMPRESS_CAT" ]]; then
@@ -905,53 +905,6 @@ if [[ $_no_compress_l = "$DRACUT_COMPRESS_CAT" ]]; then
compress="$DRACUT_COMPRESS_CAT"
fi
if ! [[ $compress ]]; then
# check all known compressors, if none specified
for i in $DRACUT_COMPRESS_PIGZ $DRACUT_COMPRESS_GZIP $DRACUT_COMPRESS_LZ4 $DRACUT_COMPRESS_LZOP $ $DRACUT_COMPRESS_ZSTD $DRACUT_COMPRESS_LZMA $DRACUT_COMPRESS_XZ $DRACUT_COMPRESS_LBZIP2 $OMPRESS_BZIP2 $DRACUT_COMPRESS_CAT; do
command -v "$i" &>/dev/null || continue
compress="$i"
break
done
if [[ $compress = cat ]]; then
printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
fi
fi
# choose the right arguments for the compressor
case $compress in
bzip2|lbzip2)
if [[ "$compress" = lbzip2 ]] || command -v "$DRACUT_COMPRESS_LBZIP2" &>/dev/null; then
@ -2132,6 +2085,53 @@ if [[ $create_early_cpio = yes ]]; then
@@ -2132,6 +2085,53 @@ if [[ $create_early_cpio = yes ]]; then
fi
fi
if ! [[ $compress ]]; then
# check all known compressors, if none specified
for i in $DRACUT_COMPRESS_PIGZ $DRACUT_COMPRESS_GZIP $DRACUT_COMPRESS_LZ4 $DRACUT_COMPRESS_LZOP $ $DRACUT_COMPRESS_ZSTD $DRACUT_COMPRESS_LZMA $DRACUT_COMPRESS_XZ $DRACUT_COMPRESS_LBZIP2 $OMPRESS_BZIP2 $DRACUT_COMPRESS_CAT; do
command -v "$i" &>/dev/null || continue
compress="$i"
break
done
if [[ $compress = cat ]]; then
printf "%s\n" "dracut: no compression tool available. Initramfs image is going to be big." >&2
fi
fi
# choose the right arguments for the compressor
case $compress in
bzip2|lbzip2)
if [[ "$compress" = lbzip2 ]] || command -v "$DRACUT_COMPRESS_LBZIP2" &>/dev/null; then