X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=handlers%2Fdup.in;h=055531f3e3dd07ec88a2861d233b1f49532173ad;hb=18f6031a726c4e2e96049c8ca4f1fc3b5dcc7c00;hp=4b286a36c6003bf301e5e33cc645d549822a24b6;hpb=43ad2977002acb83ec56463212bd1f263f53442a;p=matthijs%2Fupstream%2Fbackupninja.git diff --git a/handlers/dup.in b/handlers/dup.in index 4b286a3..055531f 100644 --- a/handlers/dup.in +++ b/handlers/dup.in @@ -7,6 +7,7 @@ getconf options getconf testconnect yes getconf nicelevel 0 +getconf tmpdir setsection gpg getconf password @@ -78,7 +79,8 @@ duplicity_sub="`echo $duplicity_version | @AWK@ -F '.' '{print $3}'`" # 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 @@ -170,16 +172,28 @@ fi 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