Skip to content

Commit e42fcaf

Browse files
edetersmitten
ede
authored andcommitted
release 2.5.4
1 parent 322301d commit e42fcaf

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

duply.sh

+23-20
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,18 @@
3333
# - remove url_encode, test for invalid chars n throw error instead
3434
#
3535
# 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+
#
3643
# 2.5.3 (10.7.2024)
3744
# - 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
3946
# - 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
4148
#
4249
# 2.5.2 (30.11.2023)
4350
# - bugfix #139: "ampersand (&) in gpg passphrase breaks gpg tests"
@@ -560,9 +567,9 @@ function lookup {
560567
# important definitions #######################################################
561568

562569
ME_LONG="$0"
563-
ME="$(basename $0)"
570+
ME="$(basename "$0")"
564571
ME_NAME="${ME%%.*}"
565-
ME_VERSION="2.5.3"
572+
ME_VERSION="2.5.4"
566573
ME_WEBSITE="https://duply.net"
567574

568575
# default config values
@@ -1918,8 +1925,8 @@ function gpg_version_compare {
19181925
}
19191926
GPGVERSION=( ${GPGVERSION//./ } )
19201927

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")
19231930
CMPVERSION=( ${CMPIN//./ } )
19241931

19251932
#echo ${GPGVERSION[@]} "/" ${CMPVERSION[@]} "/" $CMPMODE
@@ -2124,7 +2131,7 @@ eval "${TARGET_SPLIT_URL}"
21242131
cmds="$2"; shift 2
21252132

21262133
# complain if command(s) missing
2127-
[ -z $cmds ] && error " No command given.
2134+
[ -z "$cmds" ] && error " No command given.
21282135
21292136
Hint:
21302137
Use '$ME usage' to get usage help."
@@ -2555,22 +2562,22 @@ EXCLUDE="$EXCLUDE"
25552562
# since 0.7.03 --exclude-globbing-filelist is deprecated
25562563
EXCLUDE_PARAM="--exclude$(duplicity_version_lt 703 && echo -globbing)-filelist"
25572564

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 ' '
25592568
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);\
25642574
print cmds}")
25652575

2566-
# split commands by '_', preserve spaces even if not allowed :)
2567-
IFS='_' read -ra CMDS_IN <<< "$(tolower "$cmds")"
2568-
25692576
# convert cmds to array,
25702577
# post process, translate batch commands
25712578
# ATTENTION: commands are lowercase from here on out
25722579
declare -a CMDS
2573-
for cmd in "${CMDS_IN[@]}"; do
2580+
for cmd in $(tolower "$cmds"); do
25742581
case "$cmd" in
25752582
# backup -> [pre_bkp_post]
25762583
'backup')
@@ -2680,14 +2687,10 @@ if var_isset 'CMD_SKIP' && [ $CMD_SKIP -gt 0 ]; then
26802687
SKIP_NOW="yes"
26812688
elif ! var_isset 'PREVIEW' && [ "$cmd" == 'and' ] && [ "$CMD_ERR" -ne "0" ]; then
26822689
CMD_SKIP=$(get_cmd_skip_count)
2683-
# incl. this "cmd"
2684-
CMD_SKIP=$(( $CMD_SKIP + 1 ))
26852690
unset CMD_SKIPPED
26862691
SKIP_NOW="yes"
26872692
elif ! var_isset 'PREVIEW' && [ "$cmd" == 'or' ] && [ "$CMD_ERR" -eq "0" ]; then
26882693
CMD_SKIP=$(get_cmd_skip_count)
2689-
# incl. this "cmd"
2690-
CMD_SKIP=$(( $CMD_SKIP + 1 ))
26912694
unset CMD_SKIPPED
26922695
SKIP_NOW="yes"
26932696
elif is_condition "$cmd" || is_groupMarker "$cmd"; then

0 commit comments

Comments
 (0)