1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-15 04:03:41 +01:00

Rebuilt targets

This commit is contained in:
deajan 2018-10-01 15:12:32 +02:00
parent f4525f0f13
commit a0384fc452
2 changed files with 30 additions and 72 deletions

View File

@ -35,7 +35,7 @@ IS_STABLE=no
# FilesBackup #__WITH_PARANOIA_DEBUG # FilesBackup #__WITH_PARANOIA_DEBUG
_OFUNCTIONS_VERSION=2.3.0-RC1 _OFUNCTIONS_VERSION=2.3.0-RC1
_OFUNCTIONS_BUILD=2018093003 _OFUNCTIONS_BUILD=2018100105
_OFUNCTIONS_BOOTSTRAP=true _OFUNCTIONS_BOOTSTRAP=true
## To use in a program, define the following variables: ## To use in a program, define the following variables:
@ -128,38 +128,17 @@ fi
#### PoorMansRandomGenerator SUBSET #### #### PoorMansRandomGenerator SUBSET ####
# Get a random number on Windows BusyBox alike, also works on most Unixes # Get a random number on Windows BusyBox alike, also works on most Unixes
function PoorMansRandomGenerator { function PoorMansRandomGenerator {
local digits="${1}" # The number of digits to generate local digits="${1}" # The number of digits to generate
local number
local minimum=1 # Some read bytes can't be used, se we read twice the number of required bytes
local maximum dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do
local n=0 number=$number$(printf "%d" "'$char")
if [ ${#number} -ge $digits ]; then
if [ "$digits" == "" ]; then echo ${number:0:$digits}
digits=5 break;
fi fi
done
# Minimum already has a digit
for n in $(seq 1 $((digits-1))); do
minimum=$minimum"0"
maximum=$maximum"9"
done
maximum=$maximum"9"
#n=0; while [ $n -lt $minimum ]; do n=$n$(dd if=/dev/urandom bs=100 count=1 2>/dev/null | tr -cd '0-9'); done; n=$(echo $n | sed -e 's/^0//')
# bs=19 since if real random strikes, having a 19 digits number is not supported
while [ $n -lt $minimum ] || [ $n -gt $maximum ]; do
if [ $n -lt $minimum ]; then
# Add numbers
n=$n$(dd if=/dev/urandom bs=19 count=1 2>/dev/null | tr -cd '0-9')
n=$(echo $n | sed -e 's/^0//')
if [ "$n" == "" ]; then
n=0
fi
elif [ $n -gt $maximum ]; then
n=$(echo $n | sed 's/.$//')
fi
done
echo $n
} }
#### PoorMansRandomGenerator SUBSET END #### #### PoorMansRandomGenerator SUBSET END ####
@ -1889,9 +1868,9 @@ function RsyncPatternsAdd {
rest="${rest#*$PATH_SEPARATOR_CHAR}" rest="${rest#*$PATH_SEPARATOR_CHAR}"
fi fi
if [ "$RSYNC_PATTERNS" == "" ]; then if [ "$RSYNC_PATTERNS" == "" ]; then
RSYNC_PATTERNS="--"$patternType"=\"$str\"" RSYNC_PATTERNS="--$patternType=\"$str\""
else else
RSYNC_PATTERNS="$RSYNC_PATTERNS --"$patternType"=\"$str\"" RSYNC_PATTERNS="$RSYNC_PATTERNS --$patternType=\"$str\""
fi fi
done done
set +f set +f
@ -1908,7 +1887,7 @@ function RsyncPatternsFromAdd {
fi fi
if [ -e "$patternFrom" ]; then if [ -e "$patternFrom" ]; then
RSYNC_PATTERNS="$RSYNC_PATTERNS --"$patternType"-from=\"$patternFrom\"" RSYNC_PATTERNS="$RSYNC_PATTERNS --$patternType-from=\"$patternFrom\""
fi fi
} }
@ -2232,7 +2211,7 @@ function VerComp () {
return 1 return 1
fi fi
if [[ $1 == $2 ]] if [[ "$1" == "$2" ]]
then then
echo 0 echo 0
return return

View File

@ -12,7 +12,7 @@ IS_STABLE=no
_OFUNCTIONS_VERSION=2.3.0-RC1 _OFUNCTIONS_VERSION=2.3.0-RC1
_OFUNCTIONS_BUILD=2018093003 _OFUNCTIONS_BUILD=2018100105
_OFUNCTIONS_BOOTSTRAP=true _OFUNCTIONS_BOOTSTRAP=true
## To use in a program, define the following variables: ## To use in a program, define the following variables:
@ -101,38 +101,17 @@ fi
#### PoorMansRandomGenerator SUBSET #### #### PoorMansRandomGenerator SUBSET ####
# Get a random number on Windows BusyBox alike, also works on most Unixes # Get a random number on Windows BusyBox alike, also works on most Unixes
function PoorMansRandomGenerator { function PoorMansRandomGenerator {
local digits="${1}" # The number of digits to generate local digits="${1}" # The number of digits to generate
local number
local minimum=1 # Some read bytes can't be used, se we read twice the number of required bytes
local maximum dd if=/dev/urandom bs=$digits count=2 2> /dev/null | while read -r -n1 char; do
local n=0 number=$number$(printf "%d" "'$char")
if [ ${#number} -ge $digits ]; then
if [ "$digits" == "" ]; then echo ${number:0:$digits}
digits=5 break;
fi fi
done
# Minimum already has a digit
for n in $(seq 1 $((digits-1))); do
minimum=$minimum"0"
maximum=$maximum"9"
done
maximum=$maximum"9"
#n=0; while [ $n -lt $minimum ]; do n=$n$(dd if=/dev/urandom bs=100 count=1 2>/dev/null | tr -cd '0-9'); done; n=$(echo $n | sed -e 's/^0//')
# bs=19 since if real random strikes, having a 19 digits number is not supported
while [ $n -lt $minimum ] || [ $n -gt $maximum ]; do
if [ $n -lt $minimum ]; then
# Add numbers
n=$n$(dd if=/dev/urandom bs=19 count=1 2>/dev/null | tr -cd '0-9')
n=$(echo $n | sed -e 's/^0//')
if [ "$n" == "" ]; then
n=0
fi
elif [ $n -gt $maximum ]; then
n=$(echo $n | sed 's/.$//')
fi
done
echo $n
} }
#### PoorMansRandomGenerator SUBSET END #### #### PoorMansRandomGenerator SUBSET END ####
@ -1750,9 +1729,9 @@ function RsyncPatternsAdd {
rest="${rest#*$PATH_SEPARATOR_CHAR}" rest="${rest#*$PATH_SEPARATOR_CHAR}"
fi fi
if [ "$RSYNC_PATTERNS" == "" ]; then if [ "$RSYNC_PATTERNS" == "" ]; then
RSYNC_PATTERNS="--"$patternType"=\"$str\"" RSYNC_PATTERNS="--$patternType=\"$str\""
else else
RSYNC_PATTERNS="$RSYNC_PATTERNS --"$patternType"=\"$str\"" RSYNC_PATTERNS="$RSYNC_PATTERNS --$patternType=\"$str\""
fi fi
done done
set +f set +f
@ -1768,7 +1747,7 @@ function RsyncPatternsFromAdd {
fi fi
if [ -e "$patternFrom" ]; then if [ -e "$patternFrom" ]; then
RSYNC_PATTERNS="$RSYNC_PATTERNS --"$patternType"-from=\"$patternFrom\"" RSYNC_PATTERNS="$RSYNC_PATTERNS --$patternType-from=\"$patternFrom\""
fi fi
} }
@ -2087,7 +2066,7 @@ function VerComp () {
return 1 return 1
fi fi
if [[ $1 == $2 ]] if [[ "$1" == "$2" ]]
then then
echo 0 echo 0
return return