1
0
mirror of https://github.com/deajan/obackup.git synced 2024-12-25 23:13:41 +01:00

Further busybox compat. xz compression level not supported

This commit is contained in:
deajan 2016-10-23 13:34:33 +02:00
parent ba8541d5f0
commit b331ffb1f2

View File

@ -1,6 +1,6 @@
#### MINIMAL-FUNCTION-SET BEGIN ####
## FUNC_BUILD=2016102303
## FUNC_BUILD=2016102304
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
## To use in a program, define the following variables:
@ -8,6 +8,8 @@
## INSTANCE_ID=program-instance-name
## _DEBUG=yes/no
#TODO(high): Refactor GetRemoteOs into big oneliner for faster execution (if busybox else uname else uname -spio in one statement)
#TODO: Windows checks, check sendmail & mailsend
if ! type "$BASH" > /dev/null; then
@ -1387,6 +1389,8 @@ function RsyncPatterns {
function PreInit {
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
local compressionString
## SSH compression
if [ "$SSH_COMPRESSION" != "no" ]; then
SSH_COMP=-C
@ -1477,24 +1481,34 @@ function PreInit {
fi
## Set compression executable and extension
COMPRESSION_LEVEL=3
if [ "$(IsInteger $COMPRESSION_LEVEL)" -eq 0 ]; then
COMPRESSION_LEVEL=3
fi
## Busybox fix (Termux xz command doesn't support compression level as example)
if [ "$LOCAL_OS" == "BUSYBOX" ] || [ "$REMOTE_OS" == "BUSYBOX" ]; then
compressionString=""
else
compressionString=" -$COMPRESSION_LEVEL"
fi
if type xz > /dev/null 2>&1
then
COMPRESSION_PROGRAM="| xz -$COMPRESSION_LEVEL"
COMPRESSION_PROGRAM="| xz$compressionString"
COMPRESSION_EXTENSION=.xz
elif type lzma > /dev/null 2>&1
then
COMPRESSION_PROGRAM="| lzma -$COMPRESSION_LEVEL"
COMPRESSION_PROGRAM="| lzma$compressionString"
COMPRESSION_EXTENSION=.lzma
elif type pigz > /dev/null 2>&1
then
COMPRESSION_PROGRAM="| pigz -$COMPRESSION_LEVEL"
COMPRESSION_PROGRAM="| pigz$compressionString"
COMPRESSION_EXTENSION=.gz
# obackup specific
COMPRESSION_OPTIONS=--rsyncable
elif type gzip > /dev/null 2>&1
then
COMPRESSION_PROGRAM="| gzip -$COMPRESSION_LEVEL"
COMPRESSION_PROGRAM="| gzip$compressionString"
COMPRESSION_EXTENSION=.gz
# obackup specific
COMPRESSION_OPTIONS=--rsyncable