diff --git a/dev/debug_obackup.sh b/dev/debug_obackup.sh index 91757b1..cc6ac67 100755 --- a/dev/debug_obackup.sh +++ b/dev/debug_obackup.sh @@ -7,7 +7,7 @@ PROGRAM="obackup" AUTHOR="(C) 2013-2017 by Orsiris de Jong" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" PROGRAM_VERSION=2.1-beta5 -PROGRAM_BUILD=2018083002 +PROGRAM_BUILD=2018083003 IS_STABLE=no #### Execution order #__WITH_PARANOIA_DEBUG @@ -2694,7 +2694,7 @@ function _ListRecursiveBackupDirectoriesLocal { # Make sure there is only one trailing slash directory="${directory%/}/" # No sudo here, assuming you should have all necessary rights for local checks - cmd="$FIND_CMD -L $directory/ -mindepth 1 -maxdepth 1 -type d >> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP 2> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" + cmd="$FIND_CMD -L $directory -mindepth 1 -maxdepth 1 -type d >> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP 2> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" Logger "Launching command [$cmd]." "DEBUG" eval "$cmd" retval=$? @@ -2863,7 +2863,7 @@ function _ListRecursiveBackupDirectoriesRemoteSub { for directory in "${directories[@]}"; do # Make sure there is only one trailing slash directory="${directory%/}/" - cmd="$REMOTE_FIND_CMD -L \"$directory\"/ -mindepth 1 -maxdepth 1 -type d" + cmd="$REMOTE_FIND_CMD -L \"$directory\" -mindepth 1 -maxdepth 1 -type d" Logger "Launching command [$cmd]." "DEBUG" eval $cmd retval=$? @@ -4217,10 +4217,10 @@ function FilesBackup { if [ "$KEEP_ABSOLUTE_PATHS" != "no" ]; then # Fix for backup of '/' - if [ "${backupTask#/}" == "/" ]; then - destinationDir="$FILE_STORAGE/${backupTask#/}" + if [ "${backupTask#/}/" == "/" ]; then + destinationDir="$FILE_STORAGE/" else - destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}") + destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}/") fi else destinationDir="$FILE_STORAGE" @@ -4252,10 +4252,10 @@ function FilesBackup { if [ "$KEEP_ABSOLUTE_PATHS" != "no" ]; then # Fix for backup of '/' - if [ "${backupTask#/}" == "/" ]; then - destinationDir="$FILE_STORAGE/${backupTask#/}" + if [ "${backupTask#/}/" == "/" ]; then + destinationDir="$FILE_STORAGE/" else - destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}") + destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}/") fi encryptDir="$FILE_STORAGE/${backupTask#/}" else @@ -4288,10 +4288,10 @@ function FilesBackup { if [ "$KEEP_ABSOLUTE_PATHS" != "no" ]; then # Fix for backup of '/' - if [ "${backupTask#/}" == "/" ]; then - destinationDir="$FILE_STORAGE/${backupTask#/}" + if [ "${backupTask#/}/" == "/" ]; then + destinationDir="$FILE_STORAGE/" else - destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}") + destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}/") fi else destinationDir="$FILE_STORAGE" diff --git a/obackup.sh b/obackup.sh index 069425a..1c5efe1 100755 --- a/obackup.sh +++ b/obackup.sh @@ -7,7 +7,7 @@ PROGRAM="obackup" AUTHOR="(C) 2013-2017 by Orsiris de Jong" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" PROGRAM_VERSION=2.1-beta5 -PROGRAM_BUILD=2018083002 +PROGRAM_BUILD=2018083003 IS_STABLE=no @@ -2542,7 +2542,7 @@ function _ListRecursiveBackupDirectoriesLocal { # Make sure there is only one trailing slash directory="${directory%/}/" # No sudo here, assuming you should have all necessary rights for local checks - cmd="$FIND_CMD -L $directory/ -mindepth 1 -maxdepth 1 -type d >> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP 2> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" + cmd="$FIND_CMD -L $directory -mindepth 1 -maxdepth 1 -type d >> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP 2> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" Logger "Launching command [$cmd]." "DEBUG" eval "$cmd" retval=$? @@ -2701,7 +2701,7 @@ function _ListRecursiveBackupDirectoriesRemoteSub { for directory in "${directories[@]}"; do # Make sure there is only one trailing slash directory="${directory%/}/" - cmd="$REMOTE_FIND_CMD -L \"$directory\"/ -mindepth 1 -maxdepth 1 -type d" + cmd="$REMOTE_FIND_CMD -L \"$directory\" -mindepth 1 -maxdepth 1 -type d" Logger "Launching command [$cmd]." "DEBUG" eval $cmd retval=$? @@ -4009,10 +4009,10 @@ function FilesBackup { if [ "$KEEP_ABSOLUTE_PATHS" != "no" ]; then # Fix for backup of '/' - if [ "${backupTask#/}" == "/" ]; then - destinationDir="$FILE_STORAGE/${backupTask#/}" + if [ "${backupTask#/}/" == "/" ]; then + destinationDir="$FILE_STORAGE/" else - destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}") + destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}/") fi else destinationDir="$FILE_STORAGE" @@ -4044,10 +4044,10 @@ function FilesBackup { if [ "$KEEP_ABSOLUTE_PATHS" != "no" ]; then # Fix for backup of '/' - if [ "${backupTask#/}" == "/" ]; then - destinationDir="$FILE_STORAGE/${backupTask#/}" + if [ "${backupTask#/}/" == "/" ]; then + destinationDir="$FILE_STORAGE/" else - destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}") + destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}/") fi encryptDir="$FILE_STORAGE/${backupTask#/}" else @@ -4080,10 +4080,10 @@ function FilesBackup { if [ "$KEEP_ABSOLUTE_PATHS" != "no" ]; then # Fix for backup of '/' - if [ "${backupTask#/}" == "/" ]; then - destinationDir="$FILE_STORAGE/${backupTask#/}" + if [ "${backupTask#/}/" == "/" ]; then + destinationDir="$FILE_STORAGE/" else - destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}") + destinationDir=$(dirname "$FILE_STORAGE/${backupTask#/}/") fi else destinationDir="$FILE_STORAGE"