From d32d4630dab8d1d5da6eeb5930bc33b66b441fd4 Mon Sep 17 00:00:00 2001 From: Azalea Gui Date: Sat, 18 Feb 2023 11:11:16 -0500 Subject: [PATCH] [O] Better compress script --- scripts/bin/compress-zst-gpg | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/bin/compress-zst-gpg b/scripts/bin/compress-zst-gpg index 09275cb..10bdf51 100755 --- a/scripts/bin/compress-zst-gpg +++ b/scripts/bin/compress-zst-gpg @@ -8,10 +8,21 @@ if command -v "gtar" &> /dev/null; then fi echo "Using $cmd" +# Read first parameter +arg1="$1" name="$1".tar.zst.gpg shift echo "Output to $name" +# Read second parameter +if [[ -z "$*" ]]; then + files="$arg1" +else + files="$*" +fi + +echo "Compressing $files" + cores=$(python3 -c "import os; print(os.cpu_count())") echo "Starting ZSTD compression with $cores cores and level $level" -"$cmd" -I "zstd -T$cores -$level" --checkpoint=.1024 --totals --totals=SIGUSR1 -cf - "$@" | gpg --symmetric --cipher-algo aes256 -o "$name" \ No newline at end of file +"$cmd" -I "zstd -T$cores -$level" --checkpoint=.1024 --totals --totals=SIGUSR1 -cf - "$files" | gpg --symmetric --cipher-algo aes256 -o "$name" \ No newline at end of file