1
0
Fork 0
mirror of synced 2024-11-22 23:35:35 -05:00

fixup pigz and pbzip2 in (un)archive funcs

This commit is contained in:
Matt Hamilton 2015-12-19 17:08:43 -05:00
parent 1b2176534a
commit fd826dbd8a
2 changed files with 5 additions and 15 deletions

View file

@ -2,7 +2,7 @@
# Creates archive files # Creates archive files
# #
local archive_name dir_to_archive _gzip_bin _bzip2_bin local archive_name dir_to_archive
if (( ${#} != 2 )); then if (( ${#} != 2 )); then
cat >&2 <<EOF cat >&2 <<EOF
@ -28,18 +28,8 @@ if [[ ! -e "${dir_to_archive}" ]]; then
return 1 return 1
fi fi
# here, we check for dropin/multi-threaded replacements # pigz and pbzip2 are aliased in the init.zsh file. This provides a significant speedup, resulting in a
if (( ${+commands[pigz]} )); then # near-liner decrease in compression time based on on the number of available cores.
_gzip_bin='pigz'
else
_gzip_bin='gzip'
fi
if (( ${+commands[pbzip2]} )); then
_bzip2_bin='pbzip2'
else
_bzip2_bin='bzip2'
fi
case "${archive_name}" in case "${archive_name}" in
(*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${dir_to_archive}" ;; (*.tar.gz|*.tgz) tar -cvf "${archive_name}" --use-compress-program="${_gzip_bin}" "${dir_to_archive}" ;;

View file

@ -2,7 +2,7 @@
# Unarchives files # Unarchives files
# #
local archive_name _gunzip_bin _bunzip2_bin local archive_name
if (( ${#} != 1 )); then if (( ${#} != 1 )); then
cat >&2 <<EOF cat >&2 <<EOF
@ -20,7 +20,7 @@ fi
archive_name="${1:t}" archive_name="${1:t}"
# using unpigz/pbunzip2 provides little to decompression time; the benefit is mainly in compression time. # 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 case "${archive_name}" in
(*.tar.gz|*.tgz) tar -xvzf "${archive_name}" ;; (*.tar.gz|*.tgz) tar -xvzf "${archive_name}" ;;