Skip to content

Commit cf78d1e

Browse files
edetersmitten
ede
authored andcommitted
release 2.5.0
1 parent 2137e14 commit cf78d1e

File tree

1 file changed

+71
-24
lines changed

1 file changed

+71
-24
lines changed

duply.sh

+71-24
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@
3333
# - remove url_encode, test for invalid chars n throw error instead
3434
#
3535
# CHANGELOG:
36+
# 2.5.0 (25.09.2023)
37+
# - check for duplicity 2.1+ (2.0 broke implied commands),
38+
# command line ui changed incompatibly
39+
# - filter in/excludes more strictly for mor duplicity commands now
40+
# - replace '--file-to-restore' with '--path-to-restore'
41+
# - filter backup only params now
42+
#
3643
# 2.4.3 (05.05.2023)
37-
# - bugfix #134: workaround bash 4.2 and earlier read bug
44+
# - bugfix #134: workaround bash 4.2 and earlier read bug (thx Tavio Wong)
3845
#
3946
# 2.4.2 (19.01.2023)
4047
# - featreq #55: change to purgeAuto in systemd unit files (thx B.Foresman)
@@ -539,7 +546,7 @@ function lookup {
539546
ME_LONG="$0"
540547
ME="$(basename $0)"
541548
ME_NAME="${ME%%.*}"
542-
ME_VERSION="2.4.3"
549+
ME_VERSION="2.5.0"
543550
ME_WEBSITE="https://duply.net"
544551

545552
# default config values
@@ -1177,7 +1184,7 @@ function duplicity_version_get {
11771184

11781185
DUPL_VERSION_OUT=$($CMD --version)
11791186
DUPL_VERSION=`echo $DUPL_VERSION_OUT | awk '/^duplicity /{print $2; exit;}'`
1180-
#DUPL_VERSION='0.7.03' #'0.6.08b' #,0.4.4.RC4,0.6.08b
1187+
#DUPL_VERSION='1.2.3' #'0.7.03' #'0.6.08b' #,0.4.4.RC4,0.6.08b
11811188
DUPL_VERSION_VALUE=0
11821189
DUPL_VERSION_AWK=$(awk -v v="$DUPL_VERSION" 'BEGIN{
11831190
if (match(v,/[^\.0-9]+[0-9]*$/)){
@@ -1202,8 +1209,12 @@ resulted in
12021209
"
12031210
elif [ $DUPL_VERSION_VALUE -le 404 ] && [ ${DUPL_VERSION_RC:-4} -lt 4 ]; then
12041211
error "The installed version $DUPL_VERSION is incompatible with $ME_NAME v$ME_VERSION.
1205-
You should upgrade your version of duplicity to at least v0.4.4RC4 or
1212+
You should upgrade your version of $ME_NAME to at least v0.4.4RC4 or
12061213
use the older ftplicity version 1.1.1 from $ME_WEBSITE."
1214+
elif [ $DUPL_VERSION_VALUE -le 20100 ] ; then
1215+
error "The installed version $DUPL_VERSION is incompatible with $ME_NAME v$ME_VERSION.
1216+
You should upgrade your version of duplicity to at least v2.1.0 or
1217+
use the older $ME_NAME version 2.4.3 from $ME_WEBSITE."
12071218
fi
12081219
}
12091220

@@ -1355,16 +1366,28 @@ DUPL_VARS_GLOBAL="TMPDIR='$TEMP_DIR' \
13551366

13561367
# function to filter the DUPL_PARAMS var from user conf
13571368
function duplicity_params_conf {
1369+
local OUT="$DUPL_PARAMS"
13581370
# reuse cmd var from main loop
1359-
## in/exclude parameters are currently not supported on restores
1360-
if [ "$cmd" = "fetch" ] || [ "$cmd" = "restore" ] || [ "$cmd" = "status" ]; then
1371+
## in/exclude parameters are currently not supported on
1372+
## cleanup, status (collection_status), list (list_current_files), purge* (remove_*), fetch/restore
1373+
case $cmd in
1374+
cleanup | status | list | purge* | restore | fetch )
13611375
# filter exclude params from fetch/restore/status
1362-
eval "stripXcludes $DUPL_PARAMS"
1363-
return
1364-
fi
1376+
OUT="$(stripXcludes $OUT)"
1377+
;;
1378+
esac
13651379

1366-
# nothing done, print unchanged
1367-
echo "$DUPL_PARAMS"
1380+
case $cmd in
1381+
bkp | incr | full )
1382+
# nothing to strip, we're backing up'
1383+
;;
1384+
*)
1385+
OUT="$(stripBkpOnlyParams $OUT)"
1386+
;;
1387+
esac
1388+
1389+
# print result
1390+
echo "$OUT"
13681391
}
13691392

13701393
# strip in/exclude parameters from param string
@@ -1375,15 +1398,40 @@ function stripXcludes {
13751398
unset STRIPNEXT
13761399
# strip the value of previous parameter
13771400
continue
1378-
elif echo "$p" | awk '/^\-\-(in|ex)clude(\-[a-zA-Z]+)?$/{exit 0;}{exit 1;}'; then
1401+
elif echo "$p" | awk '/^\-\-(in|ex)clude(\-[a-zA-Z\-]+)?$/{exit 0;}{exit 1;}'; then
13791402
# strips e.g. --include /foo/bar
13801403
STRIPNEXT="yes"
13811404
continue
1382-
elif echo "$p" | awk '/^\-\-(in|ex)clude(\-[a-zA-Z]+)?=/{exit 0;}{exit 1;}'; then
1405+
elif echo "$p" | awk '/^\-\-(in|ex)clude(\-[a-zA-Z\-]+)?=/{exit 0;}{exit 1;}'; then
13831406
# strips e.g. --include=/foo/bar
13841407
continue
13851408
fi
1386-
1409+
1410+
OUT="$OUT $(qw "$p")"
1411+
done
1412+
echo "$OUT"
1413+
}
1414+
1415+
# strip backup only parameters from param string
1416+
function stripBkpOnlyParams {
1417+
local STRIPNEXT OUT;
1418+
1419+
for p in "$@"; do
1420+
if [ -n "$STRIPNEXT" ]; then
1421+
unset STRIPNEXT
1422+
# strip the value of previous parameter
1423+
continue
1424+
elif echo "$p" | awk '/^\-\-(allow-source-mismatch|asynchronous-upload|dry-run)$/{exit 0;}{exit 1;}'; then
1425+
continue
1426+
elif echo "$p" | awk '/^\-\-(volsize)$/{exit 0;}{exit 1;}'; then
1427+
# strips e.g. --volsize 100
1428+
STRIPNEXT="yes"
1429+
continue
1430+
elif echo "$p" | awk '/^\-\-volsize=/{exit 0;}{exit 1;}'; then
1431+
# strips e.g. --volsize=100
1432+
continue
1433+
fi
1434+
13871435
OUT="$OUT $(qw "$p")"
13881436
done
13891437
echo "$OUT"
@@ -2605,11 +2653,11 @@ case "$(tolower $cmd)" in
26052653
( run_script "$script" )
26062654
;;
26072655
'bkp')
2608-
duplify -- "${dupl_opts[@]}" $EXCLUDE_PARAM "$EXCLUDE" \
2656+
duplify backup -- "${dupl_opts[@]}" $EXCLUDE_PARAM "$EXCLUDE" \
26092657
"$SOURCE" "$BACKEND_URL"
26102658
;;
26112659
'incr')
2612-
duplify incr -- "${dupl_opts[@]}" $EXCLUDE_PARAM "$EXCLUDE" \
2660+
duplify incremental -- "${dupl_opts[@]}" $EXCLUDE_PARAM "$EXCLUDE" \
26132661
"$SOURCE" "$BACKEND_URL"
26142662
;;
26152663
'full')
@@ -2630,7 +2678,7 @@ case "$(tolower $cmd)" in
26302678
Syntax is -> $ME <profile> verifyPath <rel_bkp_path> <local_path> [<age>]"
26312679

26322680
duplify verify -- $TIME "${dupl_opts[@]}" $EXCLUDE_PARAM "$EXCLUDE" \
2633-
--file-to-restore "$IN_PATH" "$BACKEND_URL" "$OUT_PATH"
2681+
--path-to-restore "$IN_PATH" "$BACKEND_URL" "$OUT_PATH"
26342682
;;
26352683
'list')
26362684
# time param exists since 0.5.10+
@@ -2667,20 +2715,19 @@ case "$(tolower $cmd)" in
26672715
26682716
Hint:
26692717
Syntax is -> $ME <profile> restore <target_path> [<age>]"
2670-
2671-
duplify -- -t "$TIME" "${dupl_opts[@]}" "$BACKEND_URL" "$OUT_PATH"
2718+
2719+
duplify restore -- -t "$TIME" "${dupl_opts[@]}" "$BACKEND_URL" "$OUT_PATH"
26722720
;;
26732721
'fetch')
26742722
IN_PATH="${ftpl_pars[0]}"; OUT_PATH="${ftpl_pars[1]}";
26752723
TIME="${ftpl_pars[2]:-now}";
26762724
( [ -z "$IN_PATH" ] || [ -z "$OUT_PATH" ] ) && error " Missing parameter <src_path> or <target_path> for fetch.
2677-
2725+
26782726
Hint:
26792727
Syntax is -> $ME <profile> fetch <src_path> <target_path> [<age>]"
2680-
2681-
# duplicity 0.4.7 doesnt like cmd restore in combination with --file-to-restore
2682-
duplify -- --restore-time "$TIME" "${dupl_opts[@]}" \
2683-
--file-to-restore "$IN_PATH" "$BACKEND_URL" "$OUT_PATH"
2728+
2729+
duplify restore -- --restore-time "$TIME" "${dupl_opts[@]}" \
2730+
--path-to-restore "$IN_PATH" "$BACKEND_URL" "$OUT_PATH"
26842731
;;
26852732
'status')
26862733
duplify collection-status -- "${dupl_opts[@]}" "$BACKEND_URL"

0 commit comments

Comments
 (0)