summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2022-09-28 16:27:45 +0200
committerSimon Rettberg2022-09-28 16:27:45 +0200
commit51166e6cb0d6f51c66f334df301f057a20d0f79e (patch)
tree67e037114c644c311066bf1fc71a57545b581811
parentUltrastracke (diff)
downloadtm-scripts-51166e6cb0d6f51c66f334df301f057a20d0f79e.tar.gz
tm-scripts-51166e6cb0d6f51c66f334df301f057a20d0f79e.tar.xz
tm-scripts-51166e6cb0d6f51c66f334df301f057a20d0f79e.zip
Use zstd for initrd/sqfs if supportedHEADmaster
-rw-r--r--server/includes/packing.inc14
1 files changed, 12 insertions, 2 deletions
diff --git a/server/includes/packing.inc b/server/includes/packing.inc
index 2891aeef..7141dcbd 100644
--- a/server/includes/packing.inc
+++ b/server/includes/packing.inc
@@ -11,7 +11,14 @@ generate_initramfs() {
cd "$1" || perror "Cannot cd to '$1'"
rm -f -- "$3"
- find $2 | cpio --format="newc" --create | xz --check=crc32 --lzma2=dict=1MiB > "$3"
+ local cmd="gzip"
+ local args=
+ if grep -qF "CONFIG_RD_ZSTD=y" "$1/../kernel/config" && command -v zstd; then
+ cmd="zstd"
+ args="-T0 -16"
+ pinfo "Accompanying kernel supports zstd, using that"
+ fi
+ find $2 | cpio --format="newc" --create | $cmd $args > "$3"
local PS=(${PIPESTATUS[*]})
[ "x${PS[0]}" != "x0" ] && perror "'find $2' in '$(pwd)' failed."
[ "x${PS[1]}" != "x0" ] && perror "cpio create failed."
@@ -65,7 +72,10 @@ generate_squashfs() {
fi
# Detect mksquashfs xz support
local PARAMS
- if mksquashfs 2>&1 | grep -A 8 '^-comp' | grep -q '\sxz'; then
+ if mksquashfs 2>&1 | grep -A 10 '^-comp' | grep -q '\szstd' && grep -qF "CONFIG_SQUASHFS_ZSTD=y" "$1/../kernel/config"; then
+ pinfo "Using zstd compression"
+ PARAMS="-comp zstd -Xcompression-level 20"
+ elif mksquashfs 2>&1 | grep -A 10 '^-comp' | grep -q '\sxz'; then
pinfo "Using xz compression"
PARAMS="-comp xz"
else