aboutsummaryrefslogtreecommitdiff
path: root/handlers/rdiff.helper
blob: 83549ecaa3af9fdc6e8a088982defb84da2c154a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
rdiff_wizard() {
   require_packages rdiff-backup
   startForm "rdiff action wizard"
     formItem "keep" "60D"
     formItem "dest_directory" "/backups/mybackup"
     formItem "dest_host" "backuphost"
     formItem "dest_user" "backupuser"
   displayForm

   [ $? = 1 ] && return;
       
   set -- $REPLY
	keep=$1
	directory=$2
	host=$3
	user=$4
	
   startForm "rdiff action wizard: includes"
     formItem include /var/spool/cron/crontabs
     formItem include /var/backups
     formItem include /etc
     formItem include /root
     formItem include /home
     formItem include '/usr/local/*bin'
     formItem include '/var/lib/dpkg/status*'
     formItem include 
     formItem include 
     formItem include 
   displayForm

   [ $? = 1 ] && return;
   includes=   
   set -o noglob
   for i in $REPLY; do
      [ "$i" != "_empty_" ] && includes="$includes\ninclude = $i"
   done
   set +o noglob
   
   startForm "rdiff action wizard: excludes" 
     formItem exclude '/home/*/.gnupg'
     formItem exclude 
     formItem exclude 
   displayForm

   [ $? = 1 ] && return;

   excludes=
   set -o noglob
   for i in $REPLY; do
      [ "$i" != "_empty_" ] && excludes="$excludes\nexclude = $i"
   done
   set +o noglob
      
   get_next_filename $configdirectory/90.rdiff
   cat > $next_filename <<EOF
[source]
type = local
keep = $keep
EOF
   echo -e "$includes" >> $next_filename
   echo -e "$excludes" >> $next_filename
   cat >> $next_filename <<EOF

[dest]
type = remote
directory = $directory
host = $host
user = $user
EOF
   chmod 000 $next_filename
}