From 33570bc3f1ebf37f2872183092c1666ef5c1ee89 Mon Sep 17 00:00:00 2001 From: deajan Date: Fri, 1 Apr 2016 21:22:18 +0200 Subject: [PATCH] Reversed some function args to make debug easier --- dev/debug_obackup.sh | 26 +++++++++++++------------- dev/ofunctions.sh | 26 +++++++++++++------------- obackup.sh | 24 ++++++++++++------------ 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/dev/debug_obackup.sh b/dev/debug_obackup.sh index 7d8b4fd..c5d9c2f 100755 --- a/dev/debug_obackup.sh +++ b/dev/debug_obackup.sh @@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre PROGRAM_BUILD=2016033101 IS_STABLE=no -## FUNC_BUILD=2016033105 +## FUNC_BUILD=2016040102 ## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode @@ -798,7 +798,7 @@ function __CheckArguments { local counted_arguments=$((iterate-4)) if [ $counted_arguments -ne $number_of_arguments ]; then - Logger "Function $function_name may have inconsistent number of arguments. Expected: $number_of_arguments, count: $counted_arguments, see log file." "ERROR" + Logger "Function $function_name may have inconsistent number of arguments. Expected: $number_of_arguments, count: $counted_arguments, bash seen: $number_of_given_arguments. see log file." "ERROR" Logger "Arguments passed: $arg_list" "ERROR" fi fi @@ -807,8 +807,8 @@ function __CheckArguments { #__END_WITH_PARANOIA_DEBUG function RsyncPatternsAdd { - local pattern="${1}" - local pattern_type="${2}" # exclude or include + local pattern_type="${1}" # exclude or include + local pattern="${2}" __CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG local rest= @@ -837,8 +837,8 @@ function RsyncPatternsAdd { } function RsyncPatternsFromAdd { - local pattern_from="${1}" - local pattern_type="${2}" + local pattern_type="${1}" + local pattern_from="${2}" __CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG local pattern_from= @@ -857,22 +857,22 @@ function RsyncPatterns { __CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then - RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" + RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" + RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM" fi RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include" + RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM" fi elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then - RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" + RsyncPatternsAdd "include" "$RSYNC_INCLUDE_PATTERN" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include" + RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM" fi - RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" + RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" + RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM" fi else Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN" diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index ab8f181..03fa60d 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -1,4 +1,4 @@ -## FUNC_BUILD=2016033105 +## FUNC_BUILD=2016040102 ## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode @@ -788,7 +788,7 @@ function __CheckArguments { local counted_arguments=$((iterate-4)) if [ $counted_arguments -ne $number_of_arguments ]; then - Logger "Function $function_name may have inconsistent number of arguments. Expected: $number_of_arguments, count: $counted_arguments, see log file." "ERROR" + Logger "Function $function_name may have inconsistent number of arguments. Expected: $number_of_arguments, count: $counted_arguments, bash seen: $number_of_given_arguments. see log file." "ERROR" Logger "Arguments passed: $arg_list" "ERROR" fi fi @@ -797,8 +797,8 @@ function __CheckArguments { #__END_WITH_PARANOIA_DEBUG function RsyncPatternsAdd { - local pattern="${1}" - local pattern_type="${2}" # exclude or include + local pattern_type="${1}" # exclude or include + local pattern="${2}" __CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG local rest= @@ -827,8 +827,8 @@ function RsyncPatternsAdd { } function RsyncPatternsFromAdd { - local pattern_from="${1}" - local pattern_type="${2}" + local pattern_type="${1}" + local pattern_from="${2}" __CheckArguments 2 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG local pattern_from= @@ -847,22 +847,22 @@ function RsyncPatterns { __CheckArguments 0 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then - RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" + RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" + RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM" fi RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include" + RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM" fi elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then - RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" + RsyncPatternsAdd "include" "$RSYNC_INCLUDE_PATTERN" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include" + RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM" fi - RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" + RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" + RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM" fi else Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN" diff --git a/obackup.sh b/obackup.sh index 487c219..f427c79 100755 --- a/obackup.sh +++ b/obackup.sh @@ -8,7 +8,7 @@ PROGRAM_VERSION=2.0-pre PROGRAM_BUILD=2016033101 IS_STABLE=no -## FUNC_BUILD=2016033105 +## FUNC_BUILD=2016040102 ## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr ## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode @@ -742,8 +742,8 @@ function CheckConnectivity3rdPartyHosts { #__END_WITH_PARANOIA_DEBUG function RsyncPatternsAdd { - local pattern="${1}" - local pattern_type="${2}" # exclude or include + local pattern_type="${1}" # exclude or include + local pattern="${2}" local rest= @@ -771,8 +771,8 @@ function RsyncPatternsAdd { } function RsyncPatternsFromAdd { - local pattern_from="${1}" - local pattern_type="${2}" + local pattern_type="${1}" + local pattern_from="${2}" local pattern_from= @@ -789,22 +789,22 @@ function RsyncPatternsFromAdd { function RsyncPatterns { if [ "$RSYNC_PATTERN_FIRST" == "exclude" ]; then - RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" + RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" + RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM" fi RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include" + RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM" fi elif [ "$RSYNC_PATTERN_FIRST" == "include" ]; then - RsyncPatternsAdd "$RSYNC_INCLUDE_PATTERN" "include" + RsyncPatternsAdd "include" "$RSYNC_INCLUDE_PATTERN" if [ "$RSYNC_INCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_INCLUDE_FROM" "include" + RsyncPatternsFromAdd "include" "$RSYNC_INCLUDE_FROM" fi - RsyncPatternsAdd "$RSYNC_EXCLUDE_PATTERN" "exclude" + RsyncPatternsAdd "exclude" "$RSYNC_EXCLUDE_PATTERN" if [ "$RSYNC_EXCLUDE_FROM" != "" ]; then - RsyncPatternsFromAdd "$RSYNC_EXCLUDE_FROM" "exclude" + RsyncPatternsFromAdd "exclude" "$RSYNC_EXCLUDE_FROM" fi else Logger "Bogus RSYNC_PATTERN_FIRST value in config file. Will not use rsync patterns." "WARN"