33
33
# - remove url_encode, test for invalid chars n throw error instead
34
34
#
35
35
# 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
+ #
36
43
# 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)
38
45
#
39
46
# 2.4.2 (19.01.2023)
40
47
# - featreq #55: change to purgeAuto in systemd unit files (thx B.Foresman)
@@ -539,7 +546,7 @@ function lookup {
539
546
ME_LONG=" $0 "
540
547
ME=" $( basename $0 ) "
541
548
ME_NAME=" ${ME%% .* } "
542
- ME_VERSION=" 2.4.3 "
549
+ ME_VERSION=" 2.5.0 "
543
550
ME_WEBSITE=" https://duply.net"
544
551
545
552
# default config values
@@ -1177,7 +1184,7 @@ function duplicity_version_get {
1177
1184
1178
1185
DUPL_VERSION_OUT=$( $CMD --version)
1179
1186
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
1181
1188
DUPL_VERSION_VALUE=0
1182
1189
DUPL_VERSION_AWK=$( awk -v v=" $DUPL_VERSION " ' BEGIN{
1183
1190
if (match(v,/[^\.0-9]+[0-9]*$/)){
@@ -1202,8 +1209,12 @@ resulted in
1202
1209
"
1203
1210
elif [ $DUPL_VERSION_VALUE -le 404 ] && [ ${DUPL_VERSION_RC:- 4} -lt 4 ]; then
1204
1211
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
1206
1213
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 ."
1207
1218
fi
1208
1219
}
1209
1220
@@ -1355,16 +1366,28 @@ DUPL_VARS_GLOBAL="TMPDIR='$TEMP_DIR' \
1355
1366
1356
1367
# function to filter the DUPL_PARAMS var from user conf
1357
1368
function duplicity_params_conf {
1369
+ local OUT=" $DUPL_PARAMS "
1358
1370
# 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 )
1361
1375
# filter exclude params from fetch/restore/status
1362
- eval " stripXcludes $DUPL_PARAMS "
1363
- return
1364
- fi
1376
+ OUT= " $( stripXcludes $OUT ) "
1377
+ ;;
1378
+ esac
1365
1379
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 "
1368
1391
}
1369
1392
1370
1393
# strip in/exclude parameters from param string
@@ -1375,15 +1398,40 @@ function stripXcludes {
1375
1398
unset STRIPNEXT
1376
1399
# strip the value of previous parameter
1377
1400
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
1379
1402
# strips e.g. --include /foo/bar
1380
1403
STRIPNEXT=" yes"
1381
1404
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
1383
1406
# strips e.g. --include=/foo/bar
1384
1407
continue
1385
1408
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
+
1387
1435
OUT=" $OUT $( qw " $p " ) "
1388
1436
done
1389
1437
echo " $OUT "
@@ -2605,11 +2653,11 @@ case "$(tolower $cmd)" in
2605
2653
( run_script " $script " )
2606
2654
;;
2607
2655
' bkp' )
2608
- duplify -- " ${dupl_opts[@]} " $EXCLUDE_PARAM " $EXCLUDE " \
2656
+ duplify backup -- " ${dupl_opts[@]} " $EXCLUDE_PARAM " $EXCLUDE " \
2609
2657
" $SOURCE " " $BACKEND_URL "
2610
2658
;;
2611
2659
' incr' )
2612
- duplify incr -- " ${dupl_opts[@]} " $EXCLUDE_PARAM " $EXCLUDE " \
2660
+ duplify incremental -- " ${dupl_opts[@]} " $EXCLUDE_PARAM " $EXCLUDE " \
2613
2661
" $SOURCE " " $BACKEND_URL "
2614
2662
;;
2615
2663
' full' )
@@ -2630,7 +2678,7 @@ case "$(tolower $cmd)" in
2630
2678
Syntax is -> $ME <profile> verifyPath <rel_bkp_path> <local_path> [<age>]"
2631
2679
2632
2680
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 "
2634
2682
;;
2635
2683
' list' )
2636
2684
# time param exists since 0.5.10+
@@ -2667,20 +2715,19 @@ case "$(tolower $cmd)" in
2667
2715
2668
2716
Hint:
2669
2717
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 "
2672
2720
;;
2673
2721
' fetch' )
2674
2722
IN_PATH=" ${ftpl_pars[0]} " ; OUT_PATH=" ${ftpl_pars[1]} " ;
2675
2723
TIME=" ${ftpl_pars[2]:- now} " ;
2676
2724
( [ -z " $IN_PATH " ] || [ -z " $OUT_PATH " ] ) && error " Missing parameter <src_path> or <target_path> for fetch.
2677
-
2725
+
2678
2726
Hint:
2679
2727
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 "
2684
2731
;;
2685
2732
' status' )
2686
2733
duplify collection-status -- " ${dupl_opts[@]} " " $BACKEND_URL "
0 commit comments