94
95
function using_info {
96
lookup duplicity && duplicity_version_get
97
local NOTFOUND="[not found]"
96
98
# freebsd awk (--version only), debian mawk (-W version only), deliver '' so awk does not wait for input
97
AWK_VERSION=$((awk --version '' 2>/dev/null || awk -W version '' 2>/dev/null) | awk '/.+/{sub(/^[Aa][Ww][Kk][ \t]*/,"",$0);print $0;exit}')
98
PYTHON_VERSION=$(python -V 2>&1| awk '{print tolower($0);exit}')
99
GPG_INFO=`gpg --version 2>/dev/null| awk '/^gpg/{v=$1" "$3};/^Home/{print v" ("$0")"}'`
100
BASH_VERSION=$(bash --version | awk '/^GNU bash, version/{sub(/GNU bash, version[ ]+/,"",$0);print $0}')
101
echo -e "Using installed duplicity version ${DUPL_VERSION:-(not found)}${PYTHON_VERSION+, $PYTHON_VERSION}\
102
${GPG_INFO:+, $GPG_INFO}${AWK_VERSION:+, awk '${AWK_VERSION}'}${BASH_VERSION:+, bash '${BASH_VERSION}'}."
99
local AWK_VERSION=$( lookup awk && (awk --version '' 2>/dev/null || awk -W version '' 2>/dev/null) |\
100
awk '/.+/{sub(/^[Aa][Ww][Kk][ \t]*/,"",$0);print $0;exit}' \
101
|| echo "[MISSING]" )
102
local PYTHON_VERSION=$(lookup python && python -V 2>&1| awk '{print tolower($0);exit}' || echo "python $NOTFOUND" )
103
local GPG_INFO=$(gpg_avail && gpg --version 2>&1| awk 'NR==1{v=$1" "$3};/^Home:/{print v" ("$0")"}' || echo "gpg $NOTFOUND")
104
local BASH_VERSION=$(bash --version | awk 'NR==1{IGNORECASE=1;sub(/GNU bash, version[ ]+/,"",$0);print $0}')
105
local GREP_VERSION=$(lookup grep && grep --version | awk 'NR==1{IGNORECASE=1;sub(/grep[ ]+/,"",$0);print $0}' || echo "$NOTFOUND")
106
echo -e "Using installed duplicity version ${DUPL_VERSION:-$NOTFOUND}\
107
${PYTHON_VERSION+, $PYTHON_VERSION${PYTHONPATH:+ 'PYTHONPATH=$PYTHONPATH'}}\
108
${GPG_INFO:+, $GPG_INFO}${AWK_VERSION:+, awk '${AWK_VERSION}'}${GREP_VERSION:+, grep '${GREP_VERSION}'}\
109
${BASH_VERSION:+, bash '${BASH_VERSION}'}."
105
112
function usage_info { # print usage information
247
254
# NOTE: available since duplicity 0.6.14, translates to SIGN_PASSPHRASE
248
255
#GPG_PW_SIGN='<signpass>'
257
# uncomment and set a file path or name force duply to use this gpg executable
258
# available in duplicity 0.7.04 and above (currently unreleased 06/2015)
259
#GPG='/usr/local/gpg-2.1/bin/gpg'
250
261
# gpg options passed from duplicity to gpg process (default='')
251
262
# e.g. "--trust-model pgp|classic|direct|always"
252
263
# or "--compress-algo=bzip2 --bzip2-compress-level=9"
253
264
# or "--personal-cipher-preferences AES256,AES192,AES..."
254
265
# or "--homedir ~/.duply" - keep keyring and gpg settings duply specific
266
# or "--pinentry-mode loopback" - needed for GPG 2.1+ _and_
267
# also enable allow-loopback-pinentry in your .gnupg/gpg-agent.conf
257
270
# disable preliminary tests with the following setting
258
271
#GPG_TEST='disabled'
260
# credentials & server address of the backup target (URL-Format)
262
# scheme://[user:password@]host[:port]/[/]path
263
# for details see duplicity manpage, section URL Format
264
# http://duplicity.nongnu.org/duplicity.1.html#sect8
265
# probably one out of
266
# # for cloudfiles backend user id is CLOUDFILES_USERNAME, password is
267
# # CLOUDFILES_APIKEY, you might need to set CLOUDFILES_AUTHURL manually
268
# cf+http://[user:password@]container_name
270
# file://[relative|/absolute]/local/path
271
# ftp[s]://user[:password]@other.host[:port]/some_dir
272
# gdocs://user[:password]@other.host/some_dir
273
# # for the google cloud storage (since duplicity 0.6.22)
274
# # user/password are GS_ACCESS_KEY_ID/GS_SECRET_ACCESS_KEY
275
# gs://bucket[/prefix]
276
# hsi://user[:password]@other.host/some_dir
277
# imap[s]://user[:password]@host.com[/from_address_prefix]
278
# mega://user[:password]@mega.co.nz/some_dir
279
# rsync://user[:password]@host.com[:port]::[/]module/some_dir
280
# # rsync over ssh (only keyauth)
281
# rsync://user@host.com[:port]/[relative|/absolute]_path
282
# # for the s3 user/password are AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY
283
# s3://[user:password@]host/bucket_name[/prefix]
284
# s3+http://[user:password@]bucket_name[/prefix]
285
# # scp and sftp are aliases for the ssh backend
286
# ssh://user[:password]@other.host[:port]/[/]some_dir
287
# # for authenticated swift define TARGET_USER or SWIFT_USERNAME,
288
# # TARGET_PASS or SWIFT_PASSWORD, SWIFT_AUTHURL (mandatory, the path to
289
# # your identity service, omitting leads to an error with swift),
290
# # optionally SWIFT_AUTHVERSION (which defaults to "1")
291
# swift://container_name
292
# tahoe://alias/directory
293
# webdav[s]://user[:password]@other.host/some_dir
294
# ATTENTION: characters other than A-Za-z0-9.-_.~ in the URL have
295
# to be replaced by their url encoded pendants, see
296
# http://en.wikipedia.org/wiki/Url_encoding
297
# if you define the credentials as TARGET_USER, TARGET_PASS below
298
# duply will try to url_encode them for you if the need arises
273
# backend, credentials & location of the backup target (URL-Format)
275
# scheme://[user[:password]@]host[:port]/[/]path
277
# sftp://bob:secret@backupserver.com//home/bob/dupbkp
278
# for details and available backends see duplicity manpage, section URL Format
279
# http://duplicity.nongnu.org/duplicity.1.html#sect7
281
# some backends (eg. cloudfiles) need additional env vars to be set to
282
# work properly, when in doubt consult the man page mentioned above.
284
# characters other than A-Za-z0-9.-_.~ in the URL have to be
285
# replaced by their url encoded pendants, see
286
# http://en.wikipedia.org/wiki/Url_encoding
287
# if you define the credentials as TARGET_USER, TARGET_PASS below $ME
288
# will try to url_encode them for you if the need arises.
299
289
TARGET='${DEFAULT_TARGET}'
300
290
# optionally the username/password can be defined as extra variables
301
291
# setting them here _and_ in TARGET results in an error
874
875
with the command \"trust\" to \"ultimate\" (5) now.
875
876
Exit the edit mode of gpg with \"quit\"."
876
877
CMD_MSG="Running gpg to manually edit key '$KEY_ID'"
877
run_cmd sleep 5\; "$GPG" $GPG_OPTS --edit-key "$KEY_ID"
878
run_cmd sleep 5\; gpg $GPG_OPTS --edit-key "$KEY_ID"
882
883
# see 'How to specify a user ID' on gpg manpage
883
884
function gpg_fingerprint {
884
local PRINT=$("$GPG" $GPG_OPTS --fingerprint "$1" 2>&1|awk -F= 'NR==2{gsub(/ /,"",$2);$2=toupper($2); if ( $2 ~ /^[A-F0-9]+$/ && length($2) == 40 ) print $2; else exit 1}') \
885
local PRINT=$(gpg $GPG_OPTS --fingerprint "$1" 2>&1|awk -F= 'NR==2{gsub(/ /,"",$2);$2=toupper($2); if ( $2 ~ /^[A-F0-9]+$/ && length($2) == 40 ) print $2; else exit 1}') \
885
886
&& [ -n "$PRINT" ] && echo $PRINT && return 0
1703
1729
echo; separator "Start running command $(toupper $cmd) at $(date_from_nsecs $RUN_START)"
1731
# with duplicity v0.7.03 old option exclude-globbing-filelist
1732
# is deprecated in favour of option exclude-filelist
1733
GLOBB="--exclude-filelist"
1734
DUBV=$(duplicity -V | cut -d' ' -f2)
1735
if [ -n "$DUBV" ]; then
1736
DUBVA=$(echo "$DUBV" | cut -d'.' -f1)
1737
DUBVB=$(echo "$DUBV" | cut -d'.' -f2)
1738
DUBVC=$(echo "$DUBV" | cut -d'.' -f3)
1739
if [ $DUBVA -eq 0 -a $DUBVB -eq 6 ]; then
1740
GLOBB="--exclude-globbing-filelist"
1741
elif [ $DUBVA -eq 0 -a $DUBVB -eq 7 ]; then
1742
if [ $(($DUBVC + 0)) -le 2 ]; then
1743
GLOBB="--exclude-globbing-filelist"
1705
1748
case "$(tolower $cmd)" in
1707
1750
if [ "$cmd" == 'pre' ]; then