X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fbackupninja.git;a=blobdiff_plain;f=handlers%2Fdup.in;h=417b625d94df012e059589379440d14070231fcf;hp=4b286a36c6003bf301e5e33cc645d549822a24b6;hb=8ed22e66fed72343e87740a235b0544faddd1d33;hpb=440a0ef9b39e998c8ad0ca7c8a6e9d1644de23d1 diff --git a/handlers/dup.in b/handlers/dup.in index 4b286a3..417b625 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 @@ -170,16 +171,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