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

Another compression fix for busybox

This commit is contained in:
deajan 2016-10-23 13:48:34 +02:00
parent 4044ea6dbc
commit b697c13c76

View File

@ -1,6 +1,6 @@
#### MINIMAL-FUNCTION-SET BEGIN #### #### MINIMAL-FUNCTION-SET BEGIN ####
## FUNC_BUILD=2016102305 ## FUNC_BUILD=2016102306
## BEGIN Generic bash functions written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## 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: ## To use in a program, define the following variables:
@ -1485,36 +1485,45 @@ function PreInit {
COMPRESSION_LEVEL=3 COMPRESSION_LEVEL=3
fi fi
## Busybox fix (Termux xz command doesn't support compression level as example) ## Busybox fix (Termux xz command doesn't support compression at all)
if [ "$LOCAL_OS" == "BUSYBOX" ] || [ "$REMOTE_OS" == "BUSYBOX" ]; then if [ "$LOCAL_OS" == "BUSYBOX" ] || [ "$REMOTE_OS" == "BUSYBOX" ]; then
compressionString="" compressionString=""
if type gzip > /dev/null 2>&1
then
COMPRESSION_PROGRAM="| gzip -c$compressionString"
COMPRESSION_EXTENSION=.gz
# obackup specific
else
COMPRESSION_PROGRAM=
COMPRESSION_EXTENSION=
fi
else else
compressionString=" -$COMPRESSION_LEVEL" compressionString=" -$COMPRESSION_LEVEL"
fi
if type xz > /dev/null 2>&1 if type xz > /dev/null 2>&1
then then
COMPRESSION_PROGRAM="| xz -c$compressionString" COMPRESSION_PROGRAM="| xz -c$compressionString"
COMPRESSION_EXTENSION=.xz COMPRESSION_EXTENSION=.xz
elif type lzma > /dev/null 2>&1 elif type lzma > /dev/null 2>&1
then then
COMPRESSION_PROGRAM="| lzma -c$compressionString" COMPRESSION_PROGRAM="| lzma -c$compressionString"
COMPRESSION_EXTENSION=.lzma COMPRESSION_EXTENSION=.lzma
elif type pigz > /dev/null 2>&1 elif type pigz > /dev/null 2>&1
then then
COMPRESSION_PROGRAM="| pigz -c$compressionString" COMPRESSION_PROGRAM="| pigz -c$compressionString"
COMPRESSION_EXTENSION=.gz COMPRESSION_EXTENSION=.gz
# obackup specific # obackup specific
COMPRESSION_OPTIONS=--rsyncable COMPRESSION_OPTIONS=--rsyncable
elif type gzip > /dev/null 2>&1 elif type gzip > /dev/null 2>&1
then then
COMPRESSION_PROGRAM="| gzip -c$compressionString" COMPRESSION_PROGRAM="| gzip -c$compressionString"
COMPRESSION_EXTENSION=.gz COMPRESSION_EXTENSION=.gz
# obackup specific # obackup specific
COMPRESSION_OPTIONS=--rsyncable COMPRESSION_OPTIONS=--rsyncable
else else
COMPRESSION_PROGRAM= COMPRESSION_PROGRAM=
COMPRESSION_EXTENSION= COMPRESSION_EXTENSION=
fi
fi fi
ALERT_LOG_FILE="$ALERT_LOG_FILE$COMPRESSION_EXTENSION" ALERT_LOG_FILE="$ALERT_LOG_FILE$COMPRESSION_EXTENSION"
} }