From 992ea4cf23bc0ff9ff2bf6dd2bf6adcda94f7213 Mon Sep 17 00:00:00 2001 From: Hykilpikonna Date: Sat, 24 Dec 2022 04:24:40 -0500 Subject: [PATCH] [O] Separate compress-zst --- scripts/bin/compress-zst | 13 +++++++++++++ scripts/zshrc.sh | 5 ----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100755 scripts/bin/compress-zst diff --git a/scripts/bin/compress-zst b/scripts/bin/compress-zst new file mode 100755 index 0000000..9bfd8cf --- /dev/null +++ b/scripts/bin/compress-zst @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +level="${level:-15}" + +cmd=$(which tar) +if command -v "gtar" &> /dev/null; then + cmd=$(which gtar) +fi +echo "Using $cmd" + +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 -c -f "$@" \ No newline at end of file diff --git a/scripts/zshrc.sh b/scripts/zshrc.sh index 9def8a1..11f5a16 100755 --- a/scripts/zshrc.sh +++ b/scripts/zshrc.sh @@ -98,11 +98,6 @@ alias btrfs-balance-progress="sudo watch -d btrfs balance status" alias catt="echo 🐱" alias old-update-ssh-keys="curl -L https://github.com/Hykilpikonna.keys > ~/.ssh/authorized_keys" -compress-zst() { - cores=$(grep -c ^processor /proc/cpuinfo) - echo "Starting ZSTD compression with $cores cores" - tar -I 'zstd -T36 -15' --checkpoint=.1024 --totals --totals=SIGUSR1 -c -f "$@" -} alias tar-kill-progress="watch -n 60 killall tar -SIGUSR1" # Gradle with auto environment detection