aports/misc-tools/mkinitfs/0001-mkinitfs-add-optional-...

47 lines
1.3 KiB
Diff

From 59204d36985de5ba2444d5f3e0d50a119287ec51 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sat, 25 Jan 2020 12:04:32 +0100
Subject: [PATCH] mkinitfs: add optional support for pigz
pigz(1) is a parallel gzip implementation. As such, it significantly
faster than gzip(1). This patch uses pigz(1) instead of gzip(1),
if it is installed, otherwise it just falls back to gzip(1). This is
similar to the current pigz support in abuild.
Without this patch:
$ time mkinitfs
==> initramfs: creating /boot/initramfs-lts
real 0m 38.19s
user 0m 35.47s
sys 0m 0.49s
With this patch applied and pigz installed:
==> initramfs: creating /boot/initramfs-lts
real 0m 13.24s
user 0m 38.30s
sys 0m 0.56s
This change was discussed on IRC with _ikke_ and mps.
---
mkinitfs.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mkinitfs.in b/mkinitfs.in
index 9bd95f9..9676fce 100755
--- a/mkinitfs.in
+++ b/mkinitfs.in
@@ -278,7 +278,7 @@ if [ -z "$list_sources" ] && [ -z "$quiet" ]; then
fi
case "$initfscomp" in
- gzip) comp="gzip -9" ;;
+ gzip) comp="$(command -v pigz 2>/dev/null || echo gzip) -9" ;;
xz) cmd_exists xz; comp="xz -C crc32 -T 0" ;;
*) echo "Initramfs compression \"$initfscomp\" not supported!"; exit 1 ;;
esac
--
2.26.2