Skip to content

Commit 387c41e

Browse files
edetersmitten
ede
authored andcommitted
release 2.5.1
1 parent cf78d1e commit 387c41e

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

duply.sh

+25-17
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# changed from ftplicity to duply. #
1010
# See http://duply.net or http://ftplicity.sourceforge.net/ for more info. #
1111
# (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) #
1313
################################################################################
1414
# LICENSE: #
1515
# This program is licensed under GPLv2. #
@@ -33,10 +33,17 @@
3333
# - remove url_encode, test for invalid chars n throw error instead
3434
#
3535
# 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+
#
3642
# 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),
3845
# 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
4047
# - replace '--file-to-restore' with '--path-to-restore'
4148
# - filter backup only params now
4249
#
@@ -546,7 +553,7 @@ function lookup {
546553
ME_LONG="$0"
547554
ME="$(basename $0)"
548555
ME_NAME="${ME%%.*}"
549-
ME_VERSION="2.5.0"
556+
ME_VERSION="2.5.1"
550557
ME_WEBSITE="https://duply.net"
551558

552559
# default config values
@@ -1183,7 +1190,7 @@ function duplicity_version_get {
11831190
CMD="$PYTHON $(qw "$(which duplicity)")"
11841191

11851192
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;}')
11871194
#DUPL_VERSION='1.2.3' #'0.7.03' #'0.6.08b' #,0.4.4.RC4,0.6.08b
11881195
DUPL_VERSION_VALUE=0
11891196
DUPL_VERSION_AWK=$(awk -v v="$DUPL_VERSION" 'BEGIN{
@@ -1307,12 +1314,12 @@ function run_cmd {
13071314
return $CMD_ERR
13081315
}
13091316

1310-
function qw { quotewrap "$@"; }
1317+
function qw { quotewrap $@; }
13111318

13121319
function quotewrap {
13131320
local param="$@"
13141321
# 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
13161323
echo "$param" | awk '{\
13171324
gsub(/[\047]/,"\047\\\047\047",$0);\
13181325
gsub(/[\042]/,"\047\\\042\047",$0);\
@@ -1356,11 +1363,11 @@ function duplicity_params_global {
13561363
fi
13571364
fi
13581365

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}\
13611368
${GPG_OPTS}"
13621369

1363-
DUPL_VARS_GLOBAL="TMPDIR='$TEMP_DIR' \
1370+
DUPL_VARS_GLOBAL="TMPDIR='$TEMP_DIR'\
13641371
${DUPL_ARG_ENC}"
13651372
}
13661373

@@ -1372,8 +1379,8 @@ function duplicity_params_conf {
13721379
## cleanup, status (collection_status), list (list_current_files), purge* (remove_*), fetch/restore
13731380
case $cmd in
13741381
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)
13771384
;;
13781385
esac
13791386

@@ -1382,7 +1389,7 @@ function duplicity_params_conf {
13821389
# nothing to strip, we're backing up'
13831390
;;
13841391
*)
1385-
OUT="$(stripBkpOnlyParams $OUT)"
1392+
OUT=$(eval stripBkpOnlyParams $OUT)
13861393
;;
13871394
esac
13881395

@@ -1394,6 +1401,7 @@ function duplicity_params_conf {
13941401
function stripXcludes {
13951402
local STRIPNEXT OUT;
13961403
for p in "$@"; do
1404+
#echo "calc =$p="
13971405
if [ -n "$STRIPNEXT" ]; then
13981406
unset STRIPNEXT
13991407
# strip the value of previous parameter
@@ -1467,8 +1475,8 @@ function duplify { # the actual wrapper function
14671475
CMD="$PYTHON $(qw "$(which duplicity)")"
14681476

14691477
$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"
14721480

14731481
local ERR=$?
14741482
return $ERR
@@ -2312,9 +2320,9 @@ fi
23122320

23132321

23142322
# get volsize, default duplicity volume size is 25MB since v0.5.07
2315-
VOLSIZE=${VOLSIZE:-25}
2323+
#VOLSIZE=${VOLSIZE:-25}
23162324
# 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
23182326

23192327
# TODO: check for enough (async= upload space and WARN only
23202328
# use function tmp_space

0 commit comments

Comments
 (0)