Added default umask

This commit is contained in:
deajan 2018-10-02 23:20:26 +02:00
parent 6c1b7a541b
commit 4de784d90f
1 changed files with 10 additions and 15 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=2018100205 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,12 +144,17 @@ function GetInit {
function CreateDir { function CreateDir {
local dir="${1}" local dir="${1}"
local dirMod="${2}" local dirMask="${2}"
local dirUser="${3}" local dirUser="${3}"
local dirGroup="${4}" 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
@ -158,18 +163,6 @@ function CreateDir {
fi fi
fi fi
if [ "$(IsInteger $dirMod)" -eq 1 ]; then
chmod -R "$dirMod" "$dir"
if [ $? != 0 ]; then
Logger "Cannot set directory permissions of [$dir] to [$dirMod]." "SIMPLE"
exit 1
else
Logger "Set directory permissions to [$dirMod] on [$dir]." "SIMPLE"
fi
elif [ "$fileMod" != "" ]; then
Logger "Bogus filemod [$fileMod] for [$destPath] given." "SIMPLE"
fi
if [ "$dirUser" != "" ]; then if [ "$dirUser" != "" ]; then
userGroup="$dirUser" userGroup="$dirUser"
if [ "$dirGroup" != "" ]; then if [ "$dirGroup" != "" ]; then
@ -402,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
@ -414,7 +409,7 @@ if [ "$ACTION" == "uninstall" ]; then
Logger "$PROGRAM uninstalled." "SIMPLE" Logger "$PROGRAM uninstalled." "SIMPLE"
else else
CreateDir "$CONF_DIR" CreateDir "$CONF_DIR"
CreateDir "$BIN_DIR" 755 CreateDir "$BIN_DIR"
CopyExampleFiles CopyExampleFiles
CopyProgram CopyProgram
if [ "$PROGRAM" == "osync" ] || [ "$PROGRAM" == "pmocr" ]; then if [ "$PROGRAM" == "osync" ] || [ "$PROGRAM" == "pmocr" ]; then