fixup pigz and pbzip2 in (un)archive funcs
This commit is contained in:
parent
1b2176534a
commit
fd826dbd8a
@ -2,7 +2,7 @@
|
||||
# Creates archive files
|
||||
#
|
||||
|
||||
local archive_name dir_to_archive _gzip_bin _bzip2_bin
|
||||
local archive_name dir_to_archive
|
||||
|
||||
if (( ${#} != 2 )); then
|
||||
cat >&2 <<EOF
|
||||
@ -28,18 +28,8 @@ if [[ ! -e "${dir_to_archive}" ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# here, we check for dropin/multi-threaded replacements
|
||||
if (( ${+commands[pigz]} )); then
|
||||
_gzip_bin='pigz'
|
||||
else
|
||||
_gzip_bin='gzip'
|
||||
fi
|
||||
|
||||
if (( ${+commands[pbzip2]} )); then
|
||||
_bzip2_bin='pbzip2'
|
||||
else
|
||||
_bzip2_bin='bzip2'
|
||||
fi
|
||||
# pigz and pbzip2 are aliased in the init.zsh file. This provides a significant speedup, resulting in a
|
||||
# near-liner decrease in compression time based on on the number of available cores.
|
||||
|
||||
case "${archive_name}" in
|
||||
(*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${dir_to_archive}" ;;
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Unarchives files
|
||||
#
|
||||
|
||||
local archive_name _gunzip_bin _bunzip2_bin
|
||||
local archive_name
|
||||
|
||||
if (( ${#} != 1 )); then
|
||||
cat >&2 <<EOF
|
||||
@ -20,7 +20,7 @@ fi
|
||||
archive_name="${1:t}"
|
||||
|
||||
# using unpigz/pbunzip2 provides little to decompression time; the benefit is mainly in compression time.
|
||||
# may add it later.
|
||||
# setting it as an alias in the init.zsh file should be sufficient here.
|
||||
|
||||
case "${archive_name}" in
|
||||
(*.tar.gz|*.tgz) tar -xvzf "${archive_name}" ;;
|
||||
|
Reference in New Issue
Block a user