dup.helper: do not propose to exclude /home/*/.gnupg twice anymore (Closes: #563044)
[matthijs/upstream/backupninja.git] / handlers / dup.helper.in
index eee025666b562a9fa10b6242a097e8b25be78e39..2fafb99dbcbf9a10790a6c5dbeda99cdd5248fac 100644 (file)
@@ -1,4 +1,5 @@
 # -*- mode: sh; sh-basic-offset: 3; indent-tabs-mode: nil; -*-
+# vim: set filetype=sh sw=3 sts=3 expandtab autoindent:
 
 HELPERS="$HELPERS dup:incremental_encrypted_remote_filesystem_backup"
 
@@ -13,11 +14,11 @@ do_dup_host_includes() {
          [ -z "$dup_includes" ] && dup_includes="$dup_default_includes"
          for i in $dup_includes; do
             formItem include "$i"
-        done
-        formItem include ""
-        formItem include ""
-        formItem include ""
-        formDisplay
+         done
+         formItem include ""
+         formItem include ""
+         formItem include ""
+         formDisplay
       [ $? = 0 ] || return 1
       dup_includes="$REPLY"
    done
@@ -37,10 +38,10 @@ do_dup_vserver() {
          [ -z "$dup_vsincludes" ] && dup_vsincludes="$dup_default_includes"
          for i in $dup_vsincludes; do
             formItem include "$i"
-        done
-        formItem include ""
-        formItem include ""
-        formItem include ""
+         done
+         formItem include ""
+         formItem include ""
+         formItem include ""
       formDisplay
       [ $? = 0 ] || return 1
       dup_vsincludes="$REPLY"
@@ -69,26 +70,26 @@ do_dup_src() {
    [ $? = 0 ] || return 1
    case $host_or_vservers in
       'host')
-        do_dup_host_includes
-        [ $? = 0 ] || return 1
-        ;;
+         do_dup_host_includes
+         [ $? = 0 ] || return 1
+         ;;
       'vservers')
-        do_dup_vserver
-        [ $? = 0 ] || return 1
-        ;;
+         do_dup_vserver
+         [ $? = 0 ] || return 1
+         ;;
       'both')
-        do_dup_host_includes
-        [ $? = 0 ] || return 1
-        do_dup_vserver
-        [ $? = 0 ] || return 1
-        ;;
+         do_dup_host_includes
+         [ $? = 0 ] || return 1
+         do_dup_vserver
+         [ $? = 0 ] || return 1
+         ;;
       *)
-        return 1
-        ;;
+         return 1
+         ;;
    esac
    do_dup_excludes
    [ $? = 0 ] || return 1
-   
+
    _src_done="(DONE)"
    setDefault dest
 }
@@ -102,13 +103,13 @@ do_dup_dest() {
    REPLY=
    while [ -z "$REPLY" -o -z "$dup_destdir" -o -z "$dup_desthost" -o -z "$dup_destuser" ]; do
       formBegin "$dup_title - destination: first three items are compulsory"
-       formItem "desthost" "$dup_desthost"
-       formItem "destuser" "$dup_destuser"
-       formItem "destdir" "$dup_destdir"
-       formItem "keep" "$dup_keep"
+        formItem "desthost" "$dup_desthost"
+        formItem "destuser" "$dup_destuser"
+        formItem "destdir" "$dup_destdir"
+        formItem "keep" "$dup_keep"
         formItem "incremental" "$dup_incremental"
-       formItem "bandwidthlimit" "$dup_bandwidth"
-       formItem "sshoptions" "$dup_sshoptions"
+        formItem "bandwidthlimit" "$dup_bandwidth"
+        formItem "sshoptions" "$dup_sshoptions"
       formDisplay
       [ $? = 0 ] || return 1
 
@@ -117,7 +118,7 @@ do_dup_dest() {
       IFS=$':'
       thereply=($replyconverted)
       IFS=$' \t\n'
-      
+
       dup_desthost=${thereply[0]}
       dup_destuser=${thereply[1]}
       dup_destdir=${thereply[2]}
@@ -165,9 +166,9 @@ do_dup_gpg_signkey() {
       # signkey ?
       REPLY=
       while [ -z "$REPLY" -o -z "$dup_gpg_signkey" ]; do
-        inputBox "$dup_title - GnuPG" "Enter the ID of the private GnuPG key to be used to sign the backups:" "$dup_gpg_signkey"
-        [ $? = 0 ] || return 1
-        dup_gpg_signkey="$REPLY"
+         inputBox "$dup_title - GnuPG" "Enter the ID of the private GnuPG key to be used to sign the backups:" "$dup_gpg_signkey"
+         [ $? = 0 ] || return 1
+         dup_gpg_signkey="$REPLY"
       done
    fi
 }
@@ -183,7 +184,7 @@ do_dup_gpg_passphrase() {
 }
 
 do_dup_gpg() {
-   
+
    # symmetric or public key encryption ?
    booleanBox "$dup_title - GnuPG" "Use public key encryption? Otherwise, symmetric encryption will be used, and data signing will be impossible." "$dup_gpg_asymmetric_encryption"
    if [ $? = 0 ]; then
@@ -197,7 +198,7 @@ do_dup_gpg() {
       do_dup_gpg_encryptkey ; [ $? = 0 ] || return 1
       do_dup_gpg_sign ; [ $? = 0 ] || return 1
       if [ "$dup_gpg_sign" == yes ]; then
-        do_dup_gpg_signkey ; [ $? = 0 ] || return 1
+         do_dup_gpg_signkey ; [ $? = 0 ] || return 1
       fi
    else
       dup_gpg_sign=no
@@ -334,7 +335,7 @@ EOF
    if [ "$host_or_vservers" == host -o "$host_or_vservers" == both ]; then
       set -o noglob
       for i in $dup_includes; do
-        echo "include = $i" >> $next_filename
+         echo "include = $i" >> $next_filename
       done
       set +o noglob
    fi
@@ -397,6 +398,12 @@ incremental = $dup_incremental
 #keep = yes
 keep = $dup_keep
 
+# full destination URL, in duplicity format; if set, desturl overrides
+# sshoptions, destdir, desthost and destuser; it also disables testconnect and
+# bandwithlimit. For details, see duplicity manpage, section "URL FORMAT".
+#desturl = file:///usr/local/backup
+#desturl = rsync://user@other.host//var/backup/bla
+
 # bandwith limit, in kbit/s ; default is 0, i.e. no limit
 #bandwidthlimit = 128
 bandwidthlimit = $dup_bandwidth
@@ -426,49 +433,49 @@ EOF
 
 dup_main_menu() {
 
-  while true; do
-     srcitem="choose files to include & exclude $_src_done"
-     destitem="configure backup destination $_dest_done"
-     gpgitem="configure GnuPG encryption/signing $_gpg_done"
-     conitem="set up ssh keys and test remote connection $_con_done"
-     advitem="edit advanced settings $_adv_done"
-     # TODO: add the following to the menu when do_dup_conn is written
-     # conn "$conitem" \
-     menuBox "$dup_title" "choose a step:" \
-        src "$srcitem" \
-        dest "$destitem" \
-        gpg "$gpgitem" \
-       adv "$advitem" \
-        finish "finish and create config file"
-     [ $? = 0 ] || return 1
-     result="$REPLY"
-
-     case "$result" in
-       "src") do_dup_src;;
-       "dest") do_dup_dest;;
-       "gpg") do_dup_gpg;;
-       # TODO: enable the following when do_dup_conn is written
-       # "conn") do_dup_conn;;
-       "adv") do_dup_adv;;
-       "finish")
-           if [[ "$_dest_done$_gpg_done$_src_done" != "(DONE)(DONE)(DONE)" ]]; then
-          # TODO: replace the previous test by the following when do_dup_conn is written
-           # if [[ "$_con_done$_dest_done$_gpg_done$_src_done" != "(DONE)(DONE)(DONE)(DONE)" ]]; then
-              msgBox "$dup_title" "You cannot create the configuration file until the four first steps are completed."
-           else
-              do_dup_finish
-              break
-           fi
-           ;;
-     esac
-
-  done
+   while true; do
+      srcitem="choose files to include & exclude $_src_done"
+      destitem="configure backup destination $_dest_done"
+      gpgitem="configure GnuPG encryption/signing $_gpg_done"
+      conitem="set up ssh keys and test remote connection $_con_done"
+      advitem="edit advanced settings $_adv_done"
+      # TODO: add the following to the menu when do_dup_conn is written
+      # conn "$conitem" \
+      menuBox "$dup_title" "choose a step:" \
+         src "$srcitem" \
+         dest "$destitem" \
+         gpg "$gpgitem" \
+         adv "$advitem" \
+         finish "finish and create config file"
+      [ $? = 0 ] || return 1
+      result="$REPLY"
+
+      case "$result" in
+         "src") do_dup_src;;
+         "dest") do_dup_dest;;
+         "gpg") do_dup_gpg;;
+         # TODO: enable the following when do_dup_conn is written
+         # "conn") do_dup_conn;;
+         "adv") do_dup_adv;;
+         "finish")
+            if [[ "$_dest_done$_gpg_done$_src_done" != "(DONE)(DONE)(DONE)" ]]; then
+            # TODO: replace the previous test by the following when do_dup_conn is written
+            # if [[ "$_con_done$_dest_done$_gpg_done$_src_done" != "(DONE)(DONE)(DONE)(DONE)" ]]; then
+               msgBox "$dup_title" "You cannot create the configuration file until the four first steps are completed."
+            else
+               do_dup_finish
+               break
+            fi
+            ;;
+      esac
+
+   done
 }
 
 ### Main function
 
 dup_wizard() {
-   
+
    require_packages duplicity
 
    # Global variables
@@ -501,7 +508,7 @@ dup_wizard() {
    # Global variables whose '*' shall not be expanded
    set -o noglob
    dup_default_includes="/var/spool/cron/crontabs /var/backups /etc /root /home /usr/local/*bin /var/lib/dpkg/status*"
-   dup_default_excludes="/home/*/.gnupg /home/*/.gnupg /home/*/.local/share/Trash /home/*/.Trash /home/*/.thumbnails /home/*/.beagle /home/*/.aMule /home/*/gtk-gnutella-downloads"
+   dup_default_excludes="/home/*/.gnupg /home/*/.local/share/Trash /home/*/.Trash /home/*/.thumbnails /home/*/.beagle /home/*/.aMule /home/*/gtk-gnutella-downloads"
    set +o noglob
 
    dup_main_menu