Rebuilt targets

This commit is contained in:
deajan 2018-10-06 20:03:58 +02:00
parent 58e5c654d3
commit eb8c780d84
3 changed files with 98 additions and 62 deletions

View File

@ -9,7 +9,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(C) 2013-2018 by Orsiris de Jong" AUTHOR="(C) 2013-2018 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.3.0-beta1 PROGRAM_VERSION=1.3.0-beta1
PROGRAM_BUILD=2018100201 PROGRAM_BUILD=2018100202
IS_STABLE=no IS_STABLE=no
##### Execution order #__WITH_PARANOIA_DEBUG ##### Execution order #__WITH_PARANOIA_DEBUG
@ -43,7 +43,7 @@ IS_STABLE=no
# CleanUp no #__WITH_PARANOIA_DEBUG # CleanUp no #__WITH_PARANOIA_DEBUG
_OFUNCTIONS_VERSION=2.3.0-RC2 _OFUNCTIONS_VERSION=2.3.0-RC2
_OFUNCTIONS_BUILD=2018100204 _OFUNCTIONS_BUILD=2018100205
_OFUNCTIONS_BOOTSTRAP=true _OFUNCTIONS_BOOTSTRAP=true
if ! type "$BASH" > /dev/null; then if ! type "$BASH" > /dev/null; then
@ -349,6 +349,26 @@ function Logger {
fi fi
} }
# Function is busybox compatible since busybox ash does not understand direct regex, we use expr
function IsInteger {
local value="${1}"
if type expr > /dev/null 2>&1; then
expr "$value" : "^[0-9]\+$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo 1
else
echo 0
fi
else
if [[ $value =~ ^[0-9]+$ ]]; then
echo 1
else
echo 0
fi
fi
}
# Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X # Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X
function KillChilds { function KillChilds {
local pid="${1}" # Parent pid to kill childs local pid="${1}" # Parent pid to kill childs
@ -1312,31 +1332,6 @@ function IsNumericExpand {
eval "local value=\"${1}\"" # Needed eval so variable variables can be processed eval "local value=\"${1}\"" # Needed eval so variable variables can be processed
echo $(IsNumeric "$value") echo $(IsNumeric "$value")
# if [[ $value =~ ^-?[0-9]+([.][0-9]+)?$ ]]; then
# echo 1
#else
# echo 0
#fi
}
# Function is busybox compatible since busybox ash does not understand direct regex, we use expr
function IsInteger {
local value="${1}"
if type expr > /dev/null 2>&1; then
expr "$value" : "^[0-9]\+$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo 1
else
echo 0
fi
else
if [[ $value =~ ^[0-9]+$ ]]; then
echo 1
else
echo 0
fi
fi
} }
# Converts human readable sizes into integer kilobyte sizes # Converts human readable sizes into integer kilobyte sizes
@ -3612,7 +3607,7 @@ function conflictList {
retval=$? retval=$?
#WIP #WIP
if [ $TRAVIS_RUN == true ]; then if [ "$TRAVIS_RUN" == true ]; then
echo "conflictList debug retval=$retval" echo "conflictList debug retval=$retval"
cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.${INITIATOR[$__type]}.$SCRIPT_PID.$TSTAMP" cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.${INITIATOR[$__type]}.$SCRIPT_PID.$TSTAMP"
cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.${TARGET[$__type]}.$SCRIPT_PID.$TSTAMP" cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.${TARGET[$__type]}.$SCRIPT_PID.$TSTAMP"
@ -5209,7 +5204,7 @@ function LogConflicts {
local body local body
#WIP #WIP
if [ $TRAVIS_RUN == true ]; then if [ "$TRAVIS_RUN" == true ]; then
cat "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" cat "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP"
fi fi

View File

@ -10,7 +10,7 @@ PROGRAM_BINARY=$PROGRAM".sh"
PROGRAM_BATCH=$PROGRAM"-batch.sh" PROGRAM_BATCH=$PROGRAM"-batch.sh"
SSH_FILTER="ssh_filter.sh" SSH_FILTER="ssh_filter.sh"
SCRIPT_BUILD=2018100201 SCRIPT_BUILD=2018100206
INSTANCE_ID="installer-$SCRIPT_BUILD" INSTANCE_ID="installer-$SCRIPT_BUILD"
## osync / obackup / pmocr / zsnap install script ## osync / obackup / pmocr / zsnap install script
@ -18,7 +18,7 @@ INSTANCE_ID="installer-$SCRIPT_BUILD"
## Please adapt this to fit your distro needs ## Please adapt this to fit your distro needs
_OFUNCTIONS_VERSION=2.3.0-RC2 _OFUNCTIONS_VERSION=2.3.0-RC2
_OFUNCTIONS_BUILD=2018100204 _OFUNCTIONS_BUILD=2018100205
_OFUNCTIONS_BOOTSTRAP=true _OFUNCTIONS_BOOTSTRAP=true
if ! type "$BASH" > /dev/null; then if ! type "$BASH" > /dev/null; then
@ -310,6 +310,26 @@ function Logger {
fi fi
} }
# Function is busybox compatible since busybox ash does not understand direct regex, we use expr
function IsInteger {
local value="${1}"
if type expr > /dev/null 2>&1; then
expr "$value" : "^[0-9]\+$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo 1
else
echo 0
fi
else
if [[ $value =~ ^[0-9]+$ ]]; then
echo 1
else
echo 0
fi
fi
}
# Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X # Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X
function KillChilds { function KillChilds {
local pid="${1}" # Parent pid to kill childs local pid="${1}" # Parent pid to kill childs
@ -662,9 +682,17 @@ function GetInit {
function CreateDir { function CreateDir {
local dir="${1}" local dir="${1}"
local dirMask="${2}"
local dirUser="${3}"
local dirGroup="${4}"
if [ ! -d "$dir" ]; then if [ ! -d "$dir" ]; then
(
if [ $(IsInteger $dirMask) -eq 1 ]; then
umask $dirMask
fi
mkdir -p "$dir" mkdir -p "$dir"
)
if [ $? == 0 ]; then if [ $? == 0 ]; then
Logger "Created directory [$dir]." "SIMPLE" Logger "Created directory [$dir]." "SIMPLE"
else else
@ -672,6 +700,20 @@ function CreateDir {
exit 1 exit 1
fi fi
fi fi
if [ "$dirUser" != "" ]; then
userGroup="$dirUser"
if [ "$dirGroup" != "" ]; then
userGroup="$userGroup"":$dirGroup"
fi
chown "$userGroup" "$dir"
if [ $? != 0 ]; then
Logger "Could not set directory ownership on [$dir] to [$userGroup]." "SIMPLE"
exit 1
else
Logger "Set file ownership on [$dir] to [$userGroup]." "SIMPLE"
fi
fi
} }
function CopyFile { function CopyFile {
@ -703,7 +745,7 @@ function CopyFile {
exit 1 exit 1
else else
Logger "Copied [$sourcePath/$sourceFileName] to [$destPath/$destFileName]." "SIMPLE" Logger "Copied [$sourcePath/$sourceFileName] to [$destPath/$destFileName]." "SIMPLE"
if [ "$fileMod" != "" ]; then if [ "$(IsInteger $fileMod)" -eq 1 ]; then
chmod "$fileMod" "$destPath/$destFileName" chmod "$fileMod" "$destPath/$destFileName"
if [ $? != 0 ]; then if [ $? != 0 ]; then
Logger "Cannot set file permissions of [$destPath/$destFileName] to [$fileMod]." "SIMPLE" Logger "Cannot set file permissions of [$destPath/$destFileName] to [$fileMod]." "SIMPLE"
@ -711,6 +753,8 @@ function CopyFile {
else else
Logger "Set file permissions to [$fileMod] on [$destPath/$destFileName]." "SIMPLE" Logger "Set file permissions to [$fileMod] on [$destPath/$destFileName]." "SIMPLE"
fi fi
elif [ "$fileMod" != "" ]; then
Logger "Bogus filemod [$fileMod] for [$destPath] given." "SIMPLE"
fi fi
if [ "$fileUser" != "" ]; then if [ "$fileUser" != "" ]; then
@ -889,6 +933,8 @@ else
Logger "Script begin, logging to [$LOG_FILE]." "DEBUG" Logger "Script begin, logging to [$LOG_FILE]." "DEBUG"
fi fi
# Set default umask
umask 0022
GetLocalOS GetLocalOS
SetLocalOSSettings SetLocalOSSettings
@ -907,7 +953,7 @@ else
if [ "$PROGRAM" == "osync" ] || [ "$PROGRAM" == "pmocr" ]; then if [ "$PROGRAM" == "osync" ] || [ "$PROGRAM" == "pmocr" ]; then
CopyServiceFiles CopyServiceFiles
fi fi
Logger "$PROGRAM installed. Use with $BIN_DIR/$PROGRAM" "SIMPLE" Logger "$PROGRAM installed. Use with $BIN_DIR/$PROGRAM_BINARY" "SIMPLE"
if [ "$PROGRAM" == "osync" ] || [ "$PROGRAM" == "obackup" ]; then if [ "$PROGRAM" == "osync" ] || [ "$PROGRAM" == "obackup" ]; then
echo "" echo ""
Logger "If connecting remotely, consider setup ssh filter to enhance security." "SIMPLE" Logger "If connecting remotely, consider setup ssh filter to enhance security." "SIMPLE"

View File

@ -9,12 +9,12 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(C) 2013-2018 by Orsiris de Jong" AUTHOR="(C) 2013-2018 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.3.0-beta1 PROGRAM_VERSION=1.3.0-beta1
PROGRAM_BUILD=2018100201 PROGRAM_BUILD=2018100202
IS_STABLE=no IS_STABLE=no
_OFUNCTIONS_VERSION=2.3.0-RC2 _OFUNCTIONS_VERSION=2.3.0-RC2
_OFUNCTIONS_BUILD=2018100204 _OFUNCTIONS_BUILD=2018100205
_OFUNCTIONS_BOOTSTRAP=true _OFUNCTIONS_BOOTSTRAP=true
if ! type "$BASH" > /dev/null; then if ! type "$BASH" > /dev/null; then
@ -306,6 +306,26 @@ function Logger {
fi fi
} }
# Function is busybox compatible since busybox ash does not understand direct regex, we use expr
function IsInteger {
local value="${1}"
if type expr > /dev/null 2>&1; then
expr "$value" : "^[0-9]\+$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo 1
else
echo 0
fi
else
if [[ $value =~ ^[0-9]+$ ]]; then
echo 1
else
echo 0
fi
fi
}
# Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X # Portable child (and grandchild) kill function tester under Linux, BSD and MacOS X
function KillChilds { function KillChilds {
local pid="${1}" # Parent pid to kill childs local pid="${1}" # Parent pid to kill childs
@ -1235,31 +1255,6 @@ function IsNumericExpand {
eval "local value=\"${1}\"" # Needed eval so variable variables can be processed eval "local value=\"${1}\"" # Needed eval so variable variables can be processed
echo $(IsNumeric "$value") echo $(IsNumeric "$value")
# if [[ $value =~ ^-?[0-9]+([.][0-9]+)?$ ]]; then
# echo 1
#else
# echo 0
#fi
}
# Function is busybox compatible since busybox ash does not understand direct regex, we use expr
function IsInteger {
local value="${1}"
if type expr > /dev/null 2>&1; then
expr "$value" : "^[0-9]\+$" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo 1
else
echo 0
fi
else
if [[ $value =~ ^[0-9]+$ ]]; then
echo 1
else
echo 0
fi
fi
} }
# Converts human readable sizes into integer kilobyte sizes # Converts human readable sizes into integer kilobyte sizes
@ -3426,7 +3421,7 @@ function conflictList {
retval=$? retval=$?
#WIP #WIP
if [ $TRAVIS_RUN == true ]; then if [ "$TRAVIS_RUN" == true ]; then
echo "conflictList debug retval=$retval" echo "conflictList debug retval=$retval"
cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.${INITIATOR[$__type]}.$SCRIPT_PID.$TSTAMP" cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.${INITIATOR[$__type]}.$SCRIPT_PID.$TSTAMP"
cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.${TARGET[$__type]}.$SCRIPT_PID.$TSTAMP" cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.${TARGET[$__type]}.$SCRIPT_PID.$TSTAMP"
@ -4988,7 +4983,7 @@ function LogConflicts {
local body local body
#WIP #WIP
if [ $TRAVIS_RUN == true ]; then if [ "$TRAVIS_RUN" == true ]; then
cat "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" cat "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP"
fi fi