getconf options
getconf testconnect yes
getconf nicelevel 0
+getconf tmpdir
setsection gpg
getconf password
# 1. duplicity >= 0.4.2 needs --sftp-command (NB: sftp does not support the -l option)
# 2. duplicity >= 0.4.3 replaces --ssh-command with --ssh-options, which:
# - is passed to scp and sftp commands by duplicity
-# - has a special syntax we can not feed the command line with
+# - has a special syntax we can not directly feed the command line with
+# (e.g. "IdentityFile=/root/.ssh/id_dsa_backupninja Port=2222", without the -o)
# so we don't use it: since this version does not use the ssh command anymore,
# we keep compatibility with our previous config files by passing $sshoptions to
# --scp-command and --sftp-command ourselves
set +o noglob
+### deal with tmpdir ###
+precmd=
+if [ -n "$tmpdir" ]; then
+ if [ ! -d "$tmpdir" ]; then
+ info "Temporary directory ($tmpdir) does not exist, creating it."
+ mkdir -p "$tmpdir"
+ [ $? -eq 0 ] || fatal "Could not create temporary directory ($tmpdir)."
+ fi
+ info "Using $tmpdir as TMPDIR"
+ precmd="${precmd}TMPDIR=$tmpdir "
+fi
+
### EXECUTE ###
execstr=${execstr//\\*/\\\\\\*}
-debug "duplicity $execstr --exclude '**' / $execstr_serverpart"
+debug "$precmd duplicity $execstr --exclude '**' / $execstr_serverpart"
if [ ! $test ]; then
export PASSPHRASE=$password
output=`nice -n $nicelevel \
su -c \
- "duplicity $execstr --exclude '**' / $execstr_serverpart 2>&1"`
+ "$precmd duplicity $execstr --exclude '**' / $execstr_serverpart 2>&1"`
code=$?
if [ $code -eq 0 ]; then
debug $output