]> gitweb.fluxo.info Git - backupninja.git/commitdiff
dup: add precmd to every duplicity call.
authorintrigeri <intrigeri@boum.org>
Sun, 29 Jan 2012 13:39:10 +0000 (14:39 +0100)
committerintrigeri <intrigeri@boum.org>
Sun, 29 Jan 2012 14:09:37 +0000 (15:09 +0100)
handlers/dup.in

index b358406a5b385a532af4fce337ebb58cab29961a..6fbb27a042f3cefaf38a7855d9e53d6c4048da15 100644 (file)
@@ -95,6 +95,7 @@ fi
 ### COMMAND-LINE MANGLING ######################################################
 
 ### initialize $execstr*
+execstr_precmd=
 execstr_command=
 execstr_options="$options --no-print-statistics"
 execstr_source=
@@ -261,13 +262,13 @@ fi
 ### Cleanup commands (duplicity >= 0.4.4)
 
 # cleanup
-debug "duplicity cleanup --force $execstr_options $execstr_serverpart"
+debug "$execstr_precmd duplicity cleanup --force $execstr_options $execstr_serverpart"
 if [ ! $test ]; then
    export PASSPHRASE=$password
    export FTP_PASSWORD=$ftp_password
    output=`nice -n $nicelevel \
              su -c \
-             "duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
+             "$execstr_precmd duplicity cleanup --force $execstr_options $execstr_serverpart 2>&1"`
    exit_code=$?
    if [ $exit_code -eq 0 ]; then
       debug $output
@@ -280,13 +281,13 @@ fi
 
 # remove-older-than
 if [ "$keep" != "yes" ]; then
-   debug "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart"
+   debug "$execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart"
    if [ ! $test ]; then
       export PASSPHRASE=$password
       export FTP_PASSWORD=$ftp_password
       output=`nice -n $nicelevel \
                 su -c \
-                "duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
+                "$execstr_precmd duplicity remove-older-than $keep --force $execstr_options $execstr_serverpart 2>&1"`
       exit_code=$?
       if [ $exit_code -eq 0 ]; then
          debug $output
@@ -302,13 +303,13 @@ fi
 if [ "$keep" != "yes" ]; then
    if [ "$keepincroffulls" != "all" ]; then
       if [ "$duplicity_major" -ge 0 -a "$duplicity_minor" -ge 6 -a "$duplicity_sub" -ge 10 ]; then
-         debug "$precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart"
+         debug "$execstr_precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart"
          if [ ! $test ]; then
             export PASSPHRASE=$password
             export FTP_PASSWORD=$ftp_password
             output=`nice -n $nicelevel \
                su -c \
-               "$precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart 2>&1"`
+               "$execstr_precmd duplicity remove-all-inc-of-but-n-full $keepincroffulls --force $execstr_options $execstr_serverpart 2>&1"`
             exit_code=$?
             if [ $exit_code -eq 0 ]; then
                debug $output
@@ -323,14 +324,14 @@ if [ "$keep" != "yes" ]; then
 fi
 
 ### Backup command
-debug "duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart"
+debug "$execstr_precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart"
 if [ ! $test ]; then
    outputfile=`maketemp backupout`
    export PASSPHRASE=$password
    export FTP_PASSWORD=$ftp_password
    output=`nice -n $nicelevel \
              su -c \
-                "duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"`
+                "$execstr_precmd duplicity $execstr_command $execstr_options $execstr_source --exclude '**' / $execstr_serverpart >$outputfile 2>&1"`
    exit_code=$?
    debug $output
    cat $outputfile | (while read output ; do