diff --git a/dev/common_install.sh b/dev/common_install.sh index dd43d44..33c00ff 100755 --- a/dev/common_install.sh +++ b/dev/common_install.sh @@ -10,7 +10,7 @@ PROGRAM_BINARY=$PROGRAM".sh" PROGRAM_BATCH=$PROGRAM"-batch.sh" SSH_FILTER="ssh_filter.sh" -SCRIPT_BUILD=2018100201 +SCRIPT_BUILD=2018100206 INSTANCE_ID="installer-$SCRIPT_BUILD" ## osync / obackup / pmocr / zsnap install script @@ -144,9 +144,17 @@ function GetInit { function CreateDir { local dir="${1}" + local dirMask="${2}" + local dirUser="${3}" + local dirGroup="${4}" if [ ! -d "$dir" ]; then + ( + if [ $(IsInteger $dirMask) -eq 1 ]; then + umask $dirMask + fi mkdir -p "$dir" + ) if [ $? == 0 ]; then Logger "Created directory [$dir]." "SIMPLE" else @@ -154,6 +162,20 @@ function CreateDir { exit 1 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 { @@ -185,7 +207,7 @@ function CopyFile { exit 1 else Logger "Copied [$sourcePath/$sourceFileName] to [$destPath/$destFileName]." "SIMPLE" - if [ "$fileMod" != "" ]; then + if [ "$(IsInteger $fileMod)" -eq 1 ]; then chmod "$fileMod" "$destPath/$destFileName" if [ $? != 0 ]; then Logger "Cannot set file permissions of [$destPath/$destFileName] to [$fileMod]." "SIMPLE" @@ -193,6 +215,8 @@ function CopyFile { else Logger "Set file permissions to [$fileMod] on [$destPath/$destFileName]." "SIMPLE" fi + elif [ "$fileMod" != "" ]; then + Logger "Bogus filemod [$fileMod] for [$destPath] given." "SIMPLE" fi if [ "$fileUser" != "" ]; then @@ -371,6 +395,8 @@ else Logger "Script begin, logging to [$LOG_FILE]." "DEBUG" fi +# Set default umask +umask 0022 GetLocalOS SetLocalOSSettings diff --git a/dev/n_obackup.sh b/dev/n_obackup.sh index 2e63d52..87f4401 100644 --- a/dev/n_obackup.sh +++ b/dev/n_obackup.sh @@ -4,11 +4,11 @@ ###### Remote push/pull (or local) backup script for files & databases 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" PROGRAM_VERSION=2.1-RC1 PROGRAM_BUILD=2018110602 -IS_STABLE=no +IS_STABLE=yes #### Execution order #__WITH_PARANOIA_DEBUG # GetLocalOS #__WITH_PARANOIA_DEBUG diff --git a/host_backup.conf.example b/host_backup.conf.example index 8de7550..b15fccd 100644 --- a/host_backup.conf.example +++ b/host_backup.conf.example @@ -1,7 +1,7 @@ #!/usr/bin/env bash ###### 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 ###### GENERAL BACKUP OPTIONS