feat: New compression logic
This commit is contained in:
parent
23403765e5
commit
1f2da45b25
@ -28,7 +28,6 @@ handler::tar() {
|
|||||||
local dst_path
|
local dst_path
|
||||||
local opts
|
local opts
|
||||||
local archive
|
local archive
|
||||||
local compr
|
|
||||||
local exclude
|
local exclude
|
||||||
local file_ext
|
local file_ext
|
||||||
|
|
||||||
@ -68,35 +67,32 @@ handler::tar() {
|
|||||||
exclude=
|
exclude=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Overwrite __compression
|
|
||||||
if [ "$compression" ]; then
|
|
||||||
compr="$compression"
|
|
||||||
else
|
|
||||||
compr="$__compression"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Select filename extension by compression type.
|
# Select filename extension by compression type.
|
||||||
# Make sure for the `--auto-compress` is enabled in __tar_options
|
if [ "$compression" ]; then
|
||||||
# Refference: https://www.gnu.org/software/tar/manual/html_node/gzip.html
|
# Make sure for the `--auto-compress` is enabled in __tar_options
|
||||||
case "$compr" in
|
# Refference: https://www.gnu.org/software/tar/manual/html_node/gzip.html
|
||||||
gzip|gz) file_ext='.tar.gz';; # gzip
|
case "$compression" in
|
||||||
tgz) file_ext='.tgz';; # gzip
|
gzip|gz) file_ext='.tar.gz';; # gzip
|
||||||
taz) file_ext='.taz';; # gzip
|
tgz) file_ext='.tgz';; # gzip
|
||||||
compress|Z) file_ext='.tar.Z';; # compress
|
taz) file_ext='.taz';; # gzip
|
||||||
taZ) file_ext='.taZ';; # compress
|
compress|Z) file_ext='.tar.Z';; # compress
|
||||||
bzip2|bz2) file_ext='.tar.bz2';; # bzip2
|
taZ) file_ext='.taZ';; # compress
|
||||||
tz2) file_ext='.tz2';; # bzip2
|
bzip2|bz2) file_ext='.tar.bz2';; # bzip2
|
||||||
tbz2) file_ext='.tbz2';; # bzip2
|
tz2) file_ext='.tz2';; # bzip2
|
||||||
tbz) file_ext='.tbz';; # bzip2
|
tbz2) file_ext='.tbz2';; # bzip2
|
||||||
lzip|lz) file_ext='.tar.lz';; # lzip
|
tbz) file_ext='.tbz';; # bzip2
|
||||||
lzma) file_ext='.tar.lzma';; # lzma
|
lzip|lz) file_ext='.tar.lz';; # lzip
|
||||||
tlz) file_ext='.tlz';; # lzma
|
lzma) file_ext='.tar.lzma';; # lzma
|
||||||
lzop|lzo) file_ext='.tar.lzo';; # lzop
|
tlz) file_ext='.tlz';; # lzma
|
||||||
xz) file_ext='.tar.xz';; # xz
|
lzop|lzo) file_ext='.tar.lzo';; # lzop
|
||||||
zstd|zst) file_ext='.tar.zst';; # zstd
|
xz) file_ext='.tar.xz';; # xz
|
||||||
tzst) file_ext='.tzst';; # zstd
|
zstd|zst) file_ext='.tar.zst';; # zstd
|
||||||
*) file_ext='.tar.gz';; # Force gzip
|
tzst) file_ext='.tzst';; # zstd
|
||||||
esac
|
*) file_ext='.tar';; # No compression
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
file_ext='.tar'
|
||||||
|
fi
|
||||||
|
|
||||||
archive="${dst_path}/$(gen_backup_name "$file_ext")"
|
archive="${dst_path}/$(gen_backup_name "$file_ext")"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user