applied patch to rdiff.helper, removed /etc/passwd from mysql handler.
[matthijs/upstream/backupninja.git] / handlers / rdiff.helper
index 2efbe11b04f2994b9f877c65d7557cb96ddc33ca..8be68ac71f5e5aed30b6908275270f9b9b9d48df 100644 (file)
@@ -1,10 +1,13 @@
+
+HELPERS="$HELPERS rdiff:incremental_remote_filesystem_backup"
+
 do_rdiff_dest() {
-   startForm "rdiff action wizard"
+   formBegin "rdiff action wizard"
      formItem "keep" "$rdiff_keep"
      formItem "dest_directory" "$rdiff_directory"
      formItem "dest_host" "$rdiff_host"
      formItem "dest_user" "$rdiff_user"
-   displayForm
+   formDisplay
    [ $? = 1 ] && return;
        
    set -- $REPLY
@@ -18,7 +21,7 @@ do_rdiff_dest() {
 }
 
 do_rdiff_src() {
-   startForm "rdiff action wizard: includes"
+   formBegin "rdiff action wizard: includes"
      formItem include /var/spool/cron/crontabs
      formItem include /var/backups
      formItem include /etc
@@ -29,7 +32,7 @@ do_rdiff_src() {
      formItem include 
      formItem include 
      formItem include 
-   displayForm
+   formDisplay
    [ $? = 1 ] && return;
 
    rdiff_includes=   
@@ -39,11 +42,11 @@ do_rdiff_src() {
    done
    set +o noglob
 
-   startForm "rdiff action wizard: excludes" 
+   formBegin "rdiff action wizard: excludes" 
      formItem exclude '/home/*/.gnupg'
      formItem exclude 
      formItem exclude 
-   displayForm
+   formDisplay
    [ $? = 1 ] && return;
 
    rdiff_excludes=
@@ -78,7 +81,14 @@ do_rdiff_con() {
     echo "Copying root's public ssh key to authorized_keys of $rdiff_user@$rdiff_host. Specify the password for user $rdiff_user@$rdiff_host."
     ssh-copy-id -i /root/.ssh/id_[rd]sa.pub $rdiff_user@$rdiff_host
     if [ $? -ne 0 ]; then
-      msgBox "rdiff action wizard: error" "Failed to connect to $rdiff_user@$rdiff_host. Make sure you have the username and password correct."
+      echo "Couldn't copy root's public ssh key to authorized_keys of $rdiff_user@$rdiff_host. This time, testing whether directory is writable."
+      ssh $rdiff_user@$rdiff_host 'test -w .ssh || test -w .'
+      case $? in
+        0 )   msgBox "rdiff action wizard: error" "Directories are writable: Probably just a typo the first time." ;;
+        1 )   msgBox "rdiff action wizard: error" "Connected successfully to $rdiff_user@$rdiff_host, but unable to write. Check ownership and modes of ~$rdiff_user on $rdiff_host." ;;
+        255 ) msgBox "rdiff action wizard: error" "Failed to connect to $rdiff_user@$rdiff_host. Check hostname, username, and password." ;;
+        * )   msgBox "rdiff action wizard: error" "Unexpected error." ;;
+      esac 
       return
     else
       echo "Done. hit return to continue"