mirror of
https://github.com/deajan/obackup.git
synced 2025-01-12 15:13:53 +01:00
Updated ofunctions
This commit is contained in:
parent
82e1b68398
commit
48c178ed6b
@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-RC1
|
|||||||
PROGRAM_BUILD=2016052601
|
PROGRAM_BUILD=2016052601
|
||||||
IS_STABLE=yes
|
IS_STABLE=yes
|
||||||
|
|
||||||
## FUNC_BUILD=2016052502
|
## FUNC_BUILD=2016052602
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
@ -592,11 +592,37 @@ function IsNumeric {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## from https://gist.github.com/cdown/1163649
|
||||||
|
function urlEncode {
|
||||||
|
local length="${#1}"
|
||||||
|
|
||||||
|
local LANG=C
|
||||||
|
for (( i = 0; i < length; i++ )); do
|
||||||
|
local c="${1:i:1}"
|
||||||
|
case $c in
|
||||||
|
[a-zA-Z0-9.~_-])
|
||||||
|
printf "$c"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf '%%%02X' "'$c"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function urlDecode {
|
||||||
|
local url_encoded="${1//+/ }"
|
||||||
|
|
||||||
|
printf '%b' "${url_encoded//%/\\x}"
|
||||||
|
}
|
||||||
|
|
||||||
function CleanUp {
|
function CleanUp {
|
||||||
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
if [ "$_DEBUG" != "yes" ]; then
|
if [ "$_DEBUG" != "yes" ]; then
|
||||||
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID"
|
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID"
|
||||||
|
# Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements)
|
||||||
|
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.tmp"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
obackup.sh
28
obackup.sh
@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-RC1
|
|||||||
PROGRAM_BUILD=2016052601
|
PROGRAM_BUILD=2016052601
|
||||||
IS_STABLE=yes
|
IS_STABLE=yes
|
||||||
|
|
||||||
## FUNC_BUILD=2016052502
|
## FUNC_BUILD=2016052602
|
||||||
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
@ -578,10 +578,36 @@ function IsNumeric {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## from https://gist.github.com/cdown/1163649
|
||||||
|
function urlEncode {
|
||||||
|
local length="${#1}"
|
||||||
|
|
||||||
|
local LANG=C
|
||||||
|
for (( i = 0; i < length; i++ )); do
|
||||||
|
local c="${1:i:1}"
|
||||||
|
case $c in
|
||||||
|
[a-zA-Z0-9.~_-])
|
||||||
|
printf "$c"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
printf '%%%02X' "'$c"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
function urlDecode {
|
||||||
|
local url_encoded="${1//+/ }"
|
||||||
|
|
||||||
|
printf '%b' "${url_encoded//%/\\x}"
|
||||||
|
}
|
||||||
|
|
||||||
function CleanUp {
|
function CleanUp {
|
||||||
|
|
||||||
if [ "$_DEBUG" != "yes" ]; then
|
if [ "$_DEBUG" != "yes" ]; then
|
||||||
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID"
|
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID"
|
||||||
|
# Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements)
|
||||||
|
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.tmp"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user