|
33 | 33 | # - remove url_encode, test for invalid chars n throw error instead
|
34 | 34 | #
|
35 | 35 | # CHANGELOG:
|
| 36 | +# 2.5.4 (1.1.2025) |
| 37 | +# - bugfix #142: batch cmds with consecutive '_' fail, (hx Dominik Sommer |
| 38 | +# - allow undocumented space separated batch cmd list e.g. "pre bkp post" |
| 39 | +# - fix mawk incompatibility in gpg version detection |
| 40 | +# - fix and/or conditions skipped one too many commands |
| 41 | +# - simplify batch command parsing, remove superfluous 'read -ra' |
| 42 | +# |
36 | 43 | # 2.5.3 (10.7.2024)
|
37 | 44 | # - bugfix #140,141: "GPG_OPTS broken"
|
38 |
| -# see also https://duplicity.us/stable/duplicity.1.html#argparse-problem |
| 45 | +# see also https://duplicity.us/stable/duplicity.1.html#argparse-problem |
39 | 46 | # - detect gpg version and add '--pinentry-mode loopback' as duplicity does
|
40 |
| -# no need to it manually in GPG_OPTS anymore |
| 47 | +# no need to add it manually in GPG_OPTS anymore |
41 | 48 | #
|
42 | 49 | # 2.5.2 (30.11.2023)
|
43 | 50 | # - bugfix #139: "ampersand (&) in gpg passphrase breaks gpg tests"
|
@@ -560,9 +567,9 @@ function lookup {
|
560 | 567 | # important definitions #######################################################
|
561 | 568 |
|
562 | 569 | ME_LONG="$0"
|
563 |
| -ME="$(basename $0)" |
| 570 | +ME="$(basename "$0")" |
564 | 571 | ME_NAME="${ME%%.*}"
|
565 |
| -ME_VERSION="2.5.3" |
| 572 | +ME_VERSION="2.5.4" |
566 | 573 | ME_WEBSITE="https://duply.net"
|
567 | 574 |
|
568 | 575 | # default config values
|
@@ -1918,8 +1925,8 @@ function gpg_version_compare {
|
1918 | 1925 | }
|
1919 | 1926 | GPGVERSION=( ${GPGVERSION//./ } )
|
1920 | 1927 |
|
1921 |
| - CMPIN=$( awk '{sub(/[+\-]*$/,"");print}' <<< "$1" ) |
1922 |
| - CMPMODE=$( awk '{mode="-eq"}/-$/{mode="-le"}/+$/{mode="-ge"}{print mode;exit}' <<< "$1") |
| 1928 | + CMPIN=$( awk '{sub(/[\+\-]*$/,"");print}' <<< "$1" ) |
| 1929 | + CMPMODE=$( awk '{mode="-eq"}/-$/{mode="-le"}/\+$/{mode="-ge"}{print mode;exit}' <<< "$1") |
1923 | 1930 | CMPVERSION=( ${CMPIN//./ } )
|
1924 | 1931 |
|
1925 | 1932 | #echo ${GPGVERSION[@]} "/" ${CMPVERSION[@]} "/" $CMPMODE
|
@@ -2124,7 +2131,7 @@ eval "${TARGET_SPLIT_URL}"
|
2124 | 2131 | cmds="$2"; shift 2
|
2125 | 2132 |
|
2126 | 2133 | # complain if command(s) missing
|
2127 |
| -[ -z $cmds ] && error " No command given. |
| 2134 | +[ -z "$cmds" ] && error " No command given. |
2128 | 2135 |
|
2129 | 2136 | Hint:
|
2130 | 2137 | Use '$ME usage' to get usage help."
|
@@ -2555,22 +2562,22 @@ EXCLUDE="$EXCLUDE"
|
2555 | 2562 | # since 0.7.03 --exclude-globbing-filelist is deprecated
|
2556 | 2563 | EXCLUDE_PARAM="--exclude$(duplicity_version_lt 703 && echo -globbing)-filelist"
|
2557 | 2564 |
|
2558 |
| -# replace magic separators to command equivalents (+=and,-=or,[=groupIn,]=groupOut) |
| 2565 | +# replace |
| 2566 | +# - magic separators to command equivalents (+=and,-=or,[=groupIn,]=groupOut) |
| 2567 | +# - multiple separator chars '_ ' with a single ' ' |
2559 | 2568 | cmds=$(awk -v cmds="$cmds" "BEGIN{ \
|
2560 |
| - gsub(/\+/,\"_and_\",cmds);\ |
2561 |
| - gsub(/\-/,\"_or_\",cmds);\ |
2562 |
| - gsub(/\[/,\"_groupIn_\",cmds);\ |
2563 |
| - gsub(/\]/,\"_groupOut_\",cmds);\ |
| 2569 | + gsub(/\+/,\" and \",cmds);\ |
| 2570 | + gsub(/\-/,\" or \",cmds);\ |
| 2571 | + gsub(/\[/,\" groupIn \",cmds);\ |
| 2572 | + gsub(/\]/,\" groupOut \",cmds);\ |
| 2573 | + gsub(/[_ ]+/,\" \",cmds);\ |
2564 | 2574 | print cmds}")
|
2565 | 2575 |
|
2566 |
| -# split commands by '_', preserve spaces even if not allowed :) |
2567 |
| -IFS='_' read -ra CMDS_IN <<< "$(tolower "$cmds")" |
2568 |
| - |
2569 | 2576 | # convert cmds to array,
|
2570 | 2577 | # post process, translate batch commands
|
2571 | 2578 | # ATTENTION: commands are lowercase from here on out
|
2572 | 2579 | declare -a CMDS
|
2573 |
| -for cmd in "${CMDS_IN[@]}"; do |
| 2580 | +for cmd in $(tolower "$cmds"); do |
2574 | 2581 | case "$cmd" in
|
2575 | 2582 | # backup -> [pre_bkp_post]
|
2576 | 2583 | 'backup')
|
@@ -2680,14 +2687,10 @@ if var_isset 'CMD_SKIP' && [ $CMD_SKIP -gt 0 ]; then
|
2680 | 2687 | SKIP_NOW="yes"
|
2681 | 2688 | elif ! var_isset 'PREVIEW' && [ "$cmd" == 'and' ] && [ "$CMD_ERR" -ne "0" ]; then
|
2682 | 2689 | CMD_SKIP=$(get_cmd_skip_count)
|
2683 |
| - # incl. this "cmd" |
2684 |
| - CMD_SKIP=$(( $CMD_SKIP + 1 )) |
2685 | 2690 | unset CMD_SKIPPED
|
2686 | 2691 | SKIP_NOW="yes"
|
2687 | 2692 | elif ! var_isset 'PREVIEW' && [ "$cmd" == 'or' ] && [ "$CMD_ERR" -eq "0" ]; then
|
2688 | 2693 | CMD_SKIP=$(get_cmd_skip_count)
|
2689 |
| - # incl. this "cmd" |
2690 |
| - CMD_SKIP=$(( $CMD_SKIP + 1 )) |
2691 | 2694 | unset CMD_SKIPPED
|
2692 | 2695 | SKIP_NOW="yes"
|
2693 | 2696 | elif is_condition "$cmd" || is_groupMarker "$cmd"; then
|
|
0 commit comments