X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=handlers%2Fdup.in;h=055531f3e3dd07ec88a2861d233b1f49532173ad;hb=4af05505849d1fa2509899c52af7fb1c69c4897b;hp=9848cbc024e981acb5b6c0f09ea91e97de0c184d;hpb=f7f20cd4af2633f2fc4d72b221a974380981d29b;p=matthijs%2Fupstream%2Fbackupninja.git diff --git a/handlers/dup.in b/handlers/dup.in index 9848cbc..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 @@ -89,7 +91,7 @@ scpoptions="$sshoptions" execstr="$options --no-print-statistics " # < 0.4.2 : only uses ssh and scp -if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -le 2 ]; then +if [ "$duplicity_major" -le 0 -a "$duplicity_minor" -le 4 -a "$duplicity_sub" -lt 2 ]; then execstr="$execstr --scp-command 'scp $scpoptions' --ssh-command 'ssh $sshoptions' " # >= 0.4.2 : also uses sftp, --sftp-command option is now supported else @@ -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