]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
feat(dracut): search for zstd compressor first
authorBenjamin Drung <benjamin.drung@canonical.com>
Thu, 20 Jun 2024 12:11:02 +0000 (14:11 +0200)
committerLaszlo Gombos <laszlo.gombos@gmail.com>
Thu, 20 Jun 2024 21:54:58 +0000 (17:54 -0400)
Searching for an available compressor was introduced in commit
693b7a32833b ("Cleanup compressor handling") but the order was not
justified.

Ubuntu uses zstd for compressing the packages, the kernel modules,
firmware files, and the initrd (when using initramfs-tools). zstd has a
good compromise between compression ratio and speed. Therefore search
for zstd first.

Further readings:

 * https://lists.ubuntu.com/archives/ubuntu-devel/2021-December/041726.html
 * analysis.ipynb on https://github.com/waveform80/compression

dracut.sh

index 211742bdb80104461bd32c69fb7a4cba5b9d301c..f3f6c6827e7e8194fd3fcc3d26df496c6cf55f9c 100755 (executable)
--- a/dracut.sh
+++ b/dracut.sh
@@ -2364,7 +2364,7 @@ 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 $DRACUT_COMPRESS_BZIP2 $DRACUT_COMPRESS_CAT; do
+    for i in $DRACUT_COMPRESS_ZSTD $DRACUT_COMPRESS_PIGZ $DRACUT_COMPRESS_GZIP $DRACUT_COMPRESS_LZ4 $DRACUT_COMPRESS_LZOP $DRACUT_COMPRESS_LZMA $DRACUT_COMPRESS_XZ $DRACUT_COMPRESS_LBZIP2 $DRACUT_COMPRESS_BZIP2 $DRACUT_COMPRESS_CAT; do
         [[ $i != "$DRACUT_COMPRESS_ZSTD" || $DRACUT_KERNEL_RD_ZSTD ]] || continue
         command -v "$i" &> /dev/null || continue
         compress="$i"