~tomleb/alpine-mkinitfs

108d4b529e42d0d9a0975c492dcf3bcabe59f937 — psykose 1 year, 3 months ago f2ae0ab
mkinitfs: allow specifying compression level

(and perhaps injecting more options)

the defaults are taken from before:

gzip: -9 -> -9
xz: unspecified (-1)! -> -9
zstd: -19 -> -19
lz4: --best(-12) -> -12
1 files changed, 9 insertions(+), 4 deletions(-)

M mkinitfs.in
M mkinitfs.in => mkinitfs.in +9 -4
@@ 297,11 297,16 @@ if [ -z "$list_sources" ] && [ -z "$quiet" ]; then
	echo "==> initramfs: creating $outfile"
fi

complevel_gzip="${complevel_gzip:--9}"
complevel_xz="${complevel_xz:--9}"
complevel_zstd="${complevel_zstd:--19}"
complevel_lz4="${complevel_lz4:--12}"

case "$initfscomp" in
	gzip) comp="$(command -v pigz 2>/dev/null || echo gzip) -9" ;;
	xz) cmd_exists xz; comp="xz -C crc32 -T 0" ;;
	zstd) cmd_exists zstd; comp="zstd -T0 -19" ;;
	lz4) cmd_exists lz4; comp="lz4 --favor-decSpeed --best -lz" ;;
	gzip) comp="$(command -v pigz 2>/dev/null || echo gzip) $complevel_gzip" ;;
	xz) cmd_exists xz; comp="xz -C crc32 -T0 $complevel_xz" ;;
	zstd) cmd_exists zstd; comp="zstd -T0 $complevel_zstd" ;;
	lz4) cmd_exists lz4; comp="lz4 --favor-decSpeed -lz $complevel_lz4" ;;
	none) comp="cat";;
	*) echo "Initramfs compression \"$initfscomp\" not supported!"; exit 1 ;;
esac