4
use Debconf::Client::ConfModule ':all';
9
my $capb=capb('backup');
13
# Step 1: Put the current settings into the DebConf database
14
if (open(CONFIG, '/etc/calamaris.conf')) {
18
my ($when, $mail, $web, $task, $title) = split(/:/);
19
$title =~ s/^'(.*)'$/$1/;
20
print STDERR "daily = ($when, $mail, $web, $task, $title)\n",
22
set('calamaris/daily/mail', $mail);
23
set('calamaris/daily/html', $web);
24
set('calamaris/daily/title', $title);
25
set('calamaris/daily/task', $task);
28
my ($when, $mail, $web, $task, $title) = split(/:/);
29
$title =~ s/^'(.*)'$/$1/;
30
print STDERR "weekly = ($when, $mail, $web, $task, $title)\n",
32
set('calamaris/weekly/mail', $mail);
33
set('calamaris/weekly/html', $web);
34
set('calamaris/weekly/title', $title);
35
set('calamaris/weekly/task', $task);
38
my ($when, $mail, $web, $task, $title) = split(/:/);
39
$title =~ s/^'(.*)'$/$1/;
40
print STDERR "monthly = ($when, $mail, $web, $task, $title)\n",
42
set('calamaris/monthly/mail', $mail);
43
set('calamaris/monthly/html', $web);
44
set('calamaris/monthly/title', $title);
45
set('calamaris/monthly/task', $task);
49
set('calamaris/cache_type', $_);
56
while (($state >= 0) && ($state <= 5)) {
58
input("high", "calamaris/transition");
63
@ret = input("low", "calamaris/cache_type");
64
print STDERR "ret = ", @ret, "\n", if ($debug);
71
@ret = input("medium", "calamaris/daily/task");
72
print STDERR "ret = ", @ret, "\n", if ($debug);
73
@ret = input("medium", "calamaris/weekly/task");
74
print STDERR "ret = ", @ret, "\n", if ($debug);
75
@ret = input("medium", "calamaris/monthly/task");
76
print STDERR "ret = ", @ret, "\n", if ($debug);
83
if (get('calamaris/daily/task') ne 'nothing') {
85
if (get('calamaris/daily/task') ne 'web') {
86
@ret = input("medium", "calamaris/daily/mail");
87
print STDERR "ret = ", @ret, "\n", if ($debug);
89
if (get('calamaris/daily/task') ne 'mail') {
90
@ret = input("medium", "calamaris/daily/html");
91
print STDERR "ret = ", @ret, "\n", if ($debug);
93
@ret = input("medium", "calamaris/daily/title");
94
print STDERR "ret = ", @ret, "\n", if ($debug);
103
if (get('calamaris/weekly/task') ne 'nothing') {
105
if ( (get('calamaris/daily/task') eq 'mail') ||
106
(get('calamaris/daily/task') eq 'both')) {
107
my $mail = get('calamaris/daily/mail');
108
set('calamaris/weekly/mail', $mail);
110
if (get('calamaris/weekly/task') ne 'web') {
111
input("medium", "calamaris/weekly/mail");
113
if (get('calamaris/weekly/task') ne 'mail') {
114
input("medium", "calamaris/weekly/html");
116
input("medium", "calamaris/weekly/title");
124
if (get('calamaris/monthly/task') ne 'nothing') {
126
if ( (get('calamaris/daily/task') eq 'mail') ||
127
(get('calamaris/daily/task') eq 'both')) {
128
my $mail = get('calamaris/daily/mail');
129
set('calamaris/monthly/mail', $mail);
131
if ( (get('calamaris/weekly/task') eq 'mail') ||
132
(get('calamaris/weekly/task') eq 'both')) {
133
my $mail = get('calamaris/weekly/mail');
134
set('calamaris/monthly/mail', $mail);
136
if (get('calamaris/monthly/task') ne 'web') {
137
input("medium", "calamaris/monthly/mail");
139
if (get('calamaris/monthly/task') ne 'mail') {
140
input("medium", "calamaris/monthly/html");
142
input("medium", "calamaris/monthly/title");
148
print STDERR "ret = ", @ret, "\n", if ($debug);
156
open(CONF, "> /etc/calamaris.conf");
157
print CONF <<'ENDOFTEXT'
158
# configuration file for calamaris
159
# by Philipp Frauenfelder <pfrauenf@debian.org>
162
# There are three categories: daily, weekly and monthly. For each of these
163
# one line is responsible. There must be a line for each category but only
166
# cat: [daily|weekly|monthly]
167
# mailto: mailaddress, eg. root
168
# webto: path incl. file name, eg. /var/www/calamaris/daily.html.
169
# The script does currently not check wether the directory
170
# exists and fails with a rather ugly error.
171
# todo: [nothing|mail|web|both]
174
# cat:mailto:webto:todo:title
178
print CONF 'daily:' .
179
get('calamaris/daily/mail') . ':' .
180
get('calamaris/daily/html') . ':' .
181
get('calamaris/daily/task') . ':' .
182
"'" . get('calamaris/daily/title') . "'\n";
183
print CONF 'weekly:' .
184
get('calamaris/weekly/mail') . ':' .
185
get('calamaris/weekly/html') . ':' .
186
get('calamaris/weekly/task') . ':' .
187
"'" . get('calamaris/weekly/title') . "'\n";
188
print CONF 'monthly:' .
189
get('calamaris/monthly/mail') . ':' .
190
get('calamaris/monthly/html') . ':' .
191
get('calamaris/monthly/task') . ':' .
192
"'" . get('calamaris/monthly/title') . "'\n";
194
print CONF <<'ENDOFTEXT'
195
# what log files should be parsed: [auto|squid|oops]
196
# auto: tries to find the log files in this order: squid, oops
197
# squid: parses a squid log file if available
198
# oops: parses a oops log file if available
202
print CONF 'cache=' . get('calamaris/cache_type') . "\n";