Fixed some typos in include exclude functions

This commit is contained in:
deajan 2015-11-28 12:57:23 +01:00
parent da37a9a4ac
commit 0cc9667d64
3 changed files with 73 additions and 55 deletions

View File

@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong" AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.1-pre PROGRAM_VERSION=1.1-pre
PROGRAM_BUILD=2015112804 PROGRAM_BUILD=2015112805
IS_STABLE=no IS_STABLE=no
FUNC_BUILD=2015111901 FUNC_BUILD=2015111901
@ -1202,33 +1202,39 @@ function RsyncPatternsFromAdd {
local pattern_from="${1}" local pattern_from="${1}"
local pattern_type="${2}" local pattern_type="${2}"
__CheckArguments 2 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG __CheckArguments 2 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
if [ ! "$pattern_from" == "" ]; then ## Check if the exclude list has a full path, and if not, add the config file path if there is one
## Check if the exclude list has a full path, and if not, add the config file path if there is one if [ "$(basename $pattern_from)" == "$pattern_from" ]; then
if [ "$(basename $pattern_from)" == "$pattern_from" ]; then pattern_from="$(dirname $CONFIG_FILE)/$pattern_from"
pattern_from=$(dirname $ConfigFile)/$pattern_ffrom fi
fi
if [ -e "$pattern_from" ]; then if [ -e "$pattern_from" ]; then
RSYNC_PATTERNS="$RSYNC_PATTERNS --"$pattern_type"-from=\"$pattern_from\"" RSYNC_PATTERNS="$RSYNC_PATTERNS --"$pattern_type"-from=\"$pattern_from\""
fi
fi fi
} }
function RsyncPatterns { function RsyncPatterns {
__CheckArguments 0 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG __CheckArguments 0 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
fi
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
fi
elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "include" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
fi
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
fi
else else
Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN" Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN"
fi fi

View File

@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong" AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.1-pre PROGRAM_VERSION=1.1-pre
PROGRAM_BUILD=2015112804 PROGRAM_BUILD=2015112805
IS_STABLE=no IS_STABLE=no
source "./ofunctions.sh" source "./ofunctions.sh"
@ -311,39 +311,45 @@ function RsyncPatternsAdd {
} }
function RsyncPatternsFromAdd { function RsyncPatternsFromAdd {
local pattern_from="${1}" local pattern_from="${1}"
local pattern_type="${2}" local pattern_type="${2}"
__CheckArguments 2 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG __CheckArguments 2 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
if [ ! "$pattern_from" == "" ]; then ## Check if the exclude list has a full path, and if not, add the config file path if there is one
## Check if the exclude list has a full path, and if not, add the config file path if there is one if [ "$(basename $pattern_from)" == "$pattern_from" ]; then
if [ "$(basename $pattern_from)" == "$pattern_from" ]; then pattern_from="$(dirname $CONFIG_FILE)/$pattern_from"
pattern_from=$(dirname $ConfigFile)/$pattern_ffrom fi
fi
if [ -e "$pattern_from" ]; then if [ -e "$pattern_from" ]; then
RSYNC_PATTERNS="$RSYNC_PATTERNS --"$pattern_type"-from=\"$pattern_from\"" RSYNC_PATTERNS="$RSYNC_PATTERNS --"$pattern_type"-from=\"$pattern_from\""
fi fi
fi
} }
function RsyncPatterns { function RsyncPatterns {
__CheckArguments 0 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG __CheckArguments 0 $# $FUNCNAME "$@" #__WITH_PARANOIA_DEBUG
if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include" fi
elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "include" RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" fi
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then
else RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
fi RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
fi
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
fi
else
Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN"
fi
} }
function _WriteLockFilesLocal { function _WriteLockFilesLocal {

View File

@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong" AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.1-pre PROGRAM_VERSION=1.1-pre
PROGRAM_BUILD=2015112804 PROGRAM_BUILD=2015112805
IS_STABLE=no IS_STABLE=no
FUNC_BUILD=2015111901 FUNC_BUILD=2015111901
@ -1090,15 +1090,13 @@ function RsyncPatternsFromAdd {
local pattern_type="${2}" local pattern_type="${2}"
if [ ! "$pattern_from" == "" ]; then ## Check if the exclude list has a full path, and if not, add the config file path if there is one
## Check if the exclude list has a full path, and if not, add the config file path if there is one if [ "$(basename $pattern_from)" == "$pattern_from" ]; then
if [ "$(basename $pattern_from)" == "$pattern_from" ]; then pattern_from="$(dirname $CONFIG_FILE)/$pattern_from"
pattern_from=$(dirname $ConfigFile)/$pattern_ffrom fi
fi
if [ -e "$pattern_from" ]; then if [ -e "$pattern_from" ]; then
RSYNC_PATTERNS="$RSYNC_PATTERNS --"$pattern_type"-from=\"$pattern_from\"" RSYNC_PATTERNS="$RSYNC_PATTERNS --"$pattern_type"-from=\"$pattern_from\""
fi
fi fi
} }
@ -1106,14 +1104,22 @@ function RsyncPatterns {
if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
fi
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
fi
elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then
RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include"
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "include" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include"
fi
RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude"
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then
RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude"
fi
else else
Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN" Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN"
fi fi