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

Updated installer logic

This commit is contained in:
deajan 2019-01-03 10:09:29 +01:00
parent 69590167d8
commit 45464074ef
3 changed files with 31 additions and 5 deletions

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
@ -144,9 +144,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
@ -154,6 +162,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 {
@ -185,7 +207,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"
@ -193,6 +215,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
@ -371,6 +395,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

View File

@ -4,11 +4,11 @@
###### Remote push/pull (or local) backup script for files & databases ###### Remote push/pull (or local) backup script for files & databases
PROGRAM="obackup" PROGRAM="obackup"
AUTHOR="(C) 2013-2018 by Orsiris de Jong" AUTHOR="(C) 2013-2019 by Orsiris de Jong"
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
PROGRAM_VERSION=2.1-RC1 PROGRAM_VERSION=2.1-RC1
PROGRAM_BUILD=2018110602 PROGRAM_BUILD=2018110602
IS_STABLE=no IS_STABLE=yes
#### Execution order #__WITH_PARANOIA_DEBUG #### Execution order #__WITH_PARANOIA_DEBUG
# GetLocalOS #__WITH_PARANOIA_DEBUG # GetLocalOS #__WITH_PARANOIA_DEBUG

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
###### obackup - Local or Remote, push or pull backup script for files & mysql databases ###### obackup - Local or Remote, push or pull backup script for files & mysql databases
###### (C) 2013-2016 by Orsiris de Jong (www.netpower.fr) ###### (C) 2013-2019 by Orsiris de Jong (www.netpower.fr)
###### obackup v2.1x config file rev 2017020901 ###### obackup v2.1x config file rev 2017020901
###### GENERAL BACKUP OPTIONS ###### GENERAL BACKUP OPTIONS