9
9
# changed from ftplicity to duply. #
10
10
# See http://duply.net or http://ftplicity.sourceforge.net/ for more info. #
11
11
# (c) 2006 Christiane Ruetten, Heise Zeitschriften Verlag, Germany #
12
- # (c) 2008-2022 Edgar Soldin (changes since version 1.3) #
12
+ # (c) 2008-2023 Edgar Soldin (changes since version 1.3) #
13
13
# ###############################################################################
14
14
# LICENSE: #
15
15
# This program is licensed under GPLv2. #
33
33
# - remove url_encode, test for invalid chars n throw error instead
34
34
#
35
35
# CHANGELOG:
36
+ # 2.5.1 (4.10.2023)
37
+ # - quotewrap only strings with quotes ('") or spaces from now on
38
+ # - add --verbosity only if set in profile conf
39
+ # - bugfix #138: fix quoting when filtering params, thx Eric
40
+ # - bugfix #137: relax version parsing regex
41
+ #
36
42
# 2.5.0 (25.09.2023)
37
- # - check for duplicity 2.1+ (2.0 broke implied commands),
43
+ # - bugfix #136: "not compatible with duplicity 2.x", thx tengel, lds, Rhomeo
44
+ # check for duplicity 2.1+ (2.0 broke implied commands),
38
45
# command line ui changed incompatibly
39
- # - filter in/excludes more strictly for mor duplicity commands now
46
+ # - filter in/excludes more strictly for more duplicity actions now
40
47
# - replace '--file-to-restore' with '--path-to-restore'
41
48
# - filter backup only params now
42
49
#
@@ -546,7 +553,7 @@ function lookup {
546
553
ME_LONG=" $0 "
547
554
ME=" $( basename $0 ) "
548
555
ME_NAME=" ${ME%% .* } "
549
- ME_VERSION=" 2.5.0 "
556
+ ME_VERSION=" 2.5.1 "
550
557
ME_WEBSITE=" https://duply.net"
551
558
552
559
# default config values
@@ -1183,7 +1190,7 @@ function duplicity_version_get {
1183
1190
CMD=" $PYTHON $( qw " $( which duplicity) " ) "
1184
1191
1185
1192
DUPL_VERSION_OUT=$( $CMD --version)
1186
- DUPL_VERSION=` echo $DUPL_VERSION_OUT | awk ' /^duplicity /{print $2; exit;}' `
1193
+ DUPL_VERSION=$( echo $DUPL_VERSION_OUT | awk ' /^duplicity/{print $2; exit;}' )
1187
1194
# DUPL_VERSION='1.2.3' #'0.7.03' #'0.6.08b' #,0.4.4.RC4,0.6.08b
1188
1195
DUPL_VERSION_VALUE=0
1189
1196
DUPL_VERSION_AWK=$( awk -v v=" $DUPL_VERSION " ' BEGIN{
@@ -1307,12 +1314,12 @@ function run_cmd {
1307
1314
return $CMD_ERR
1308
1315
}
1309
1316
1310
- function qw { quotewrap " $@ " ; }
1317
+ function qw { quotewrap $@ ; }
1311
1318
1312
1319
function quotewrap {
1313
1320
local param=" $@ "
1314
1321
# quote strings having non word chars (e.g. spaces)
1315
- if echo " $param " | awk ' /[^A-Za-z0-9_\.\-\/ ]/{exit 0}{exit 1}' ; then
1322
+ if echo " $param " | awk ' /[\047\042 ]/{exit 0}{exit 1}' ; then
1316
1323
echo " $param " | awk ' {\
1317
1324
gsub(/[\047]/,"\047\\\047\047",$0);\
1318
1325
gsub(/[\042]/,"\047\\\042\047",$0);\
@@ -1356,11 +1363,11 @@ function duplicity_params_global {
1356
1363
fi
1357
1364
fi
1358
1365
1359
- DUPL_PARAMS_GLOBAL=" ${DUPL_ARCHDIR} ${DUPL_PARAM_ENC} \
1360
- ${DUPL_PARAM_SIGN} --verbosity ' ${ VERBOSITY:- 4} ' \
1366
+ DUPL_PARAMS_GLOBAL=" ${DUPL_ARCHDIR} ${DUPL_PARAM_ENC} \
1367
+ ${DUPL_PARAM_SIGN} ${VERBOSITY : + --verbosity $ VERBOSITY} \
1361
1368
${GPG_OPTS} "
1362
1369
1363
- DUPL_VARS_GLOBAL=" TMPDIR='$TEMP_DIR ' \
1370
+ DUPL_VARS_GLOBAL=" TMPDIR='$TEMP_DIR '\
1364
1371
${DUPL_ARG_ENC} "
1365
1372
}
1366
1373
@@ -1372,8 +1379,8 @@ function duplicity_params_conf {
1372
1379
# # cleanup, status (collection_status), list (list_current_files), purge* (remove_*), fetch/restore
1373
1380
case $cmd in
1374
1381
cleanup | status | list | purge* | restore | fetch )
1375
- # filter exclude params from fetch/restore/status
1376
- OUT=" $( stripXcludes $OUT ) "
1382
+ # filter exclude params from fetch/restore/status
1383
+ OUT=$( eval stripXcludes $OUT )
1377
1384
;;
1378
1385
esac
1379
1386
@@ -1382,7 +1389,7 @@ function duplicity_params_conf {
1382
1389
# nothing to strip, we're backing up'
1383
1390
;;
1384
1391
* )
1385
- OUT=" $( stripBkpOnlyParams $OUT ) "
1392
+ OUT=$( eval stripBkpOnlyParams $OUT )
1386
1393
;;
1387
1394
esac
1388
1395
@@ -1394,6 +1401,7 @@ function duplicity_params_conf {
1394
1401
function stripXcludes {
1395
1402
local STRIPNEXT OUT;
1396
1403
for p in " $@ " ; do
1404
+ # echo "calc =$p="
1397
1405
if [ -n " $STRIPNEXT " ]; then
1398
1406
unset STRIPNEXT
1399
1407
# strip the value of previous parameter
@@ -1467,8 +1475,8 @@ function duplify { # the actual wrapper function
1467
1475
CMD=" $PYTHON $( qw " $( which duplicity) " ) "
1468
1476
1469
1477
$RUN " ${DUPL_VARS_GLOBAL} ${BACKEND_PARAMS} \
1470
- ${DUPL_PRECMD} $CMD $DUPL_CMD $DUPL_PARAMS_GLOBAL $( duplicity_params_conf) \
1471
- $GPG_USEAGENT $( gpg_custom_binary) $DUPL_CMD_PARAMS "
1478
+ ${DUPL_PRECMD} $CMD $DUPL_CMD $DUPL_PARAMS_GLOBAL $( duplicity_params_conf) \
1479
+ $GPG_USEAGENT $( gpg_custom_binary) $DUPL_CMD_PARAMS "
1472
1480
1473
1481
local ERR=$?
1474
1482
return $ERR
2312
2320
2313
2321
2314
2322
# get volsize, default duplicity volume size is 25MB since v0.5.07
2315
- VOLSIZE=${VOLSIZE:- 25}
2323
+ # VOLSIZE=${VOLSIZE:-25}
2316
2324
# double if asynch is on
2317
- echo $@ $DUPL_PARAMS | grep -q -e ' --asynchronous-upload' && FACTOR=2 || FACTOR=1
2325
+ # echo $@ $DUPL_PARAMS | grep -q -e '--asynchronous-upload' && FACTOR=2 || FACTOR=1
2318
2326
2319
2327
# TODO: check for enough (async= upload space and WARN only
2320
2328
# use function tmp_space
0 commit comments