From 758f074d65ffbabb856d83dcb59c526c6b79fcb8 Mon Sep 17 00:00:00 2001 From: deajan Date: Thu, 1 Sep 2016 17:27:53 +0200 Subject: [PATCH] Fixed typo --- dev/n_obackup.sh | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/dev/n_obackup.sh b/dev/n_obackup.sh index 0fe6c9a..5d5374c 100755 --- a/dev/n_obackup.sh +++ b/dev/n_obackup.sh @@ -566,6 +566,12 @@ function CreateStorageDirectories { CAN_BACKUP_FILES=false fi fi + if [ "$ENCRYPTION" == "yes" ]; then + _CreateDirectoryLocal "$CRYPT_STORAGE" + if [ $? != 0 ]; then + CAN_BACKUP_FILES=false + fi + fi elif [ "$BACKUP_TYPE" == "push" ]; then if [ "$SQL_BACKUP" != "no" ]; then _CreateDirectoryRemote "$SQL_STORAGE" @@ -739,7 +745,7 @@ function CheckDiskSpace { fi else if [ $((CRYPT_DISK_SPACE)) -lt $((TOTAL_DATABASES_SIZE)) ]; then - Logger "Disk spae in [$CRYPT_STORAGE] may be insufficient to encrypt SQL ($CRYPT_DISK_SPACE Ko available in $CRYPT_DRIVE) (non compressed databases calculation)." "WARN" + Logger "Disk space in [$CRYPT_STORAGE] may be insufficient to encrypt SQL ($CRYPT_DISK_SPACE Ko available in $CRYPT_DRIVE) (non compressed databases calculation)." "WARN" fi fi fi @@ -751,7 +757,7 @@ function CheckDiskSpace { fi else if [ $((CRYPT_DISK_SPACE)) -lt $((TOTAL_FILES_SIZE)) ]; then - Logger "Disk spae in [$CRYPT_STORAGE] may be insufficient to encrypt files ($CRYPT_DISK_SPACE Ko available in $CRYPT_DRIVE)." "WARN" + Logger "Disk space in [$CRYPT_STORAGE] may be insufficient to encrypt files ($CRYPT_DISK_SPACE Ko available in $CRYPT_DRIVE)." "WARN" fi fi fi @@ -933,18 +939,6 @@ function BackupDatabases { done } -function PrepareEncryptFiles { - local tmpPath="${1}" - - __CheckArguments 1 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG - - if [ "$BACKUP_TYPE" == "local" ] || [ "$BACKUP_TYPE" == "pull" ]; then - _CreateDirectoryLocal "$tmpPath" - elif [ "$BACKUP_TYPE" == "push" ]; then - _CreateDirectoryRemote "$tmpPath" - fi -} - #TODO: add ParallelExec here ? Also rework ParallelExec to use files or variables, vars are max 4M, if cannot be combined, create ParallelExecFromFile function EncryptFiles { local filePath="${1}" # Path of files to encrypt @@ -954,9 +948,6 @@ function EncryptFiles { __CheckArguments 4 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG - #TOOD: move this to prior checks - PrepareEncryptFiles "$tmpPath" - local successCounter=0 local errorCounter=0 local cryptFileExtension="$CRYPT_FILE_EXTENSION" @@ -1047,7 +1038,7 @@ function DecryptFiles { function Rsync { local backupDirectory="${1}" # Which directory to backup - local Recursive="${2:-true}" # Backup only files at toplevel of directory + local recursive="${2:-true}" # Backup only files at toplevel of directory __CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG @@ -1062,7 +1053,7 @@ function Rsync { fi ## Manage to backup recursive directories lists files only (not recursing into subdirectories) - if [ $Recursive == false ]; then + if [ $recursive == false ]; then # Fixes symlinks to directories in target cannot be deleted when backing up root directory without recursion, and excludes subdirectories RSYNC_NO_RECURSE_ARGS=" -k --exclude=*/*/" else @@ -1123,7 +1114,7 @@ function FilesBackup { EncryptFiles "$backupTask" true fi else - Rsync "$backuptask" true + Rsync "$backupTask" true fi CheckTotalExecutionTime done @@ -1144,7 +1135,7 @@ function FilesBackup { EncryptFiles "$backupTask" false fi else - Rsync "$backuptask" false + Rsync "$backupTask" false fi CheckTotalExecutionTime done @@ -1166,7 +1157,7 @@ function FilesBackup { EncryptFiles "$backupTask" true fi else - Rsync "$backuptask" true + Rsync "$backupTask" true fi CheckTotalExecutionTime done