2 HELPERS="$HELPERS rdiff:incremental_remote_filesystem_backup"
4 declare -a rdiff_includes
5 declare -a rdiff_excludes
9 formBegin "rdiff action wizard"
10 formItem "keep" "$rdiff_keep"
11 formItem "dest_directory" "$rdiff_directory"
12 formItem "dest_host" "$rdiff_host"
13 formItem "dest_user" "$rdiff_user"
18 replyconverted=`echo $REPLY | tr '\n' :`
20 thereply=($replyconverted)
23 rdiff_keep=${thereply[0]}
24 rdiff_directory=${thereply[1]}
25 rdiff_host=${thereply[2]}
26 rdiff_user=${thereply[3]}
34 #echo ${rdiff_includes[@]}
36 formBegin "rdiff action wizard: includes"
37 for ((i=0; i < ${#rdiff_includes[@]} ; i++)); do
38 formItem include ${rdiff_includes[$i]}
47 rdiff_includes=($REPLY)
49 formBegin "rdiff action wizard: excludes"
50 for ((i=0; i < ${#rdiff_excludes[@]} ; i++)); do
51 formItem exclude ${rdiff_excludes[$i]}
59 rdiff_excludes=($REPLY)
68 if [ "$_dest_done" = "" ]; then
69 msgBox "rdiff action wizard: error" "You must first configure the destination."
71 elif [ "$rdiff_user" = "" ]; then
72 msgBox "rdiff action wizard: error" "You must first configure the destination user."
74 elif [ "$rdiff_host" = "" ]; then
75 msgBox "rdiff action wizard: error" "You must first configure the destination host."
78 booleanBox "rdiff action wizard" "This step will create a ssh key for the local root user with no passphrase (if one does not already exist), and attempt to copy root's public ssh key to authorized_keys file of $rdiff_user@$rdiff_host. This will allow the local root to make unattended backups to $rdiff_user@$rdiff_host. Are you sure you want to continue?"
82 if [ ! -f /root/.ssh/id_dsa.pub -a ! -f /root/.ssh/id_rsa.pub ]; then
83 echo "Creating local root's ssh key"
84 ssh-keygen -t dsa -f /root/.ssh/id_dsa -N ""
85 echo "Done. hit return to continue"
89 ssh -o PreferredAuthentications=publickey $rdiff_host -l $rdiff_user "exit" 2> /dev/null
91 echo "Copying root's public ssh key to authorized_keys of $rdiff_user@$rdiff_host. When prompted, specify the password for user $rdiff_user@$rdiff_host."
92 ssh-copy-id -i /root/.ssh/id_[rd]sa.pub $rdiff_user@$rdiff_host
94 echo "FAILED: Couldn't copy root's public ssh key to authorized_keys of $rdiff_user@$rdiff_host."
95 ssh $rdiff_user@$rdiff_host 'test -w .ssh || test -w .'
97 echo "Hit return to continue."
100 0 ) msgBox "rdiff action wizard: error" "Directories are writable: Probably just a typo the first time." ;;
101 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." ;;
102 255 ) msgBox "rdiff action wizard: error" "Failed to connect to $rdiff_user@$rdiff_host. Check hostname, username, and password. Also, make sure sshd is running on the destination host." ;;
103 * ) msgBox "rdiff action wizard: error" "Unexpected error." ;;
107 echo "Done. hit return to continue"
111 echo "root@localhost is already in authorized_keys of $rdiff_user@$rdiff_host. hit return to continue"
119 get_next_filename $configdirectory/90.rdiff
120 cat > $next_filename <<EOF
122 # when = everyday at 02
129 for ((i=0; i < ${#rdiff_includes[@]} ; i++)); do
130 echo include = ${rdiff_includes[$i]}
132 for ((i=0; i < ${#rdiff_includes[@]} ; i++)); do
133 echo exclude = ${rdiff_excludes[$i]}
136 cat >> $next_filename <<EOF
140 directory = $rdiff_directory
144 chmod 000 $next_filename
150 srcitem="choose files to include & exclude $_src_done"
151 destitem="configure backup destination $_dest_done"
152 conitem="set up ssh keys and test remote connection $_con_done"
153 advitem="edit advanced settings $_adv_done"
154 menuBox "rdiff action wizard" "choose a step:" \
158 finish "finish and create config file"
159 [ $? = 1 ] && return;
163 "src") do_rdiff_src;;
164 "dest") do_rdiff_dest;;
165 "conn") do_rdiff_con;;
166 "adv") do_rdiff_adv;;
168 if [[ "$_con_done$_dest_done$_src_done" != "(DONE)(DONE)(DONE)" ]]; then
169 msgBox "rdiff action wizard" "You cannot create the configuration file until the other steps are completed."
181 require_packages rdiff-backup
187 rdiff_directory=/backup/`hostname`
190 rdiff_includes=(/var/spool/cron/crontabs /var/backups /etc /root /home /usr/local/*bin /var/lib/dpkg/status*)
191 rdiff_excludes=(/home/*/.gnupg)