- various fixes to configure.pl and lib/BackupPC/Lib.pm
[BackupPC.git] / lib / BackupPC / Config / Meta.pm
1 #============================================================= -*-perl-*-
2 #
3 # BackupPC::Config::Meta package
4 #
5 # DESCRIPTION
6 #
7 #   This library defines a BackupPC::Config::Meta class.
8 #
9 # AUTHOR
10 #   Craig Barratt  <cbarratt@users.sourceforge.net>
11 #
12 # COPYRIGHT
13 #   Copyright (C) 2004  Craig Barratt
14 #
15 #   This program is free software; you can redistribute it and/or modify
16 #   it under the terms of the GNU General Public License as published by
17 #   the Free Software Foundation; either version 2 of the License, or
18 #   (at your option) any later version.
19 #
20 #   This program is distributed in the hope that it will be useful,
21 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
22 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23 #   GNU General Public License for more details.
24 #
25 #   You should have received a copy of the GNU General Public License
26 #   along with this program; if not, write to the Free Software
27 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
28 #
29 #========================================================================
30 #
31 # Version 3.0.0alpha, released 23 Jan 2006.
32 #
33 # See http://backuppc.sourceforge.net.
34 #
35 #========================================================================
36
37 package BackupPC::Config::Meta;
38
39 use strict;
40
41 require Exporter;
42
43 use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS );
44
45 use vars qw(%ConfigMeta);
46
47 @ISA = qw(Exporter);
48
49 @EXPORT    = qw( );
50
51 @EXPORT_OK = qw(
52                     %ConfigMeta
53              );
54
55 %EXPORT_TAGS = (
56     'all'    => [ @EXPORT_OK ],
57 );
58
59 #
60 # Define the data types for all the config variables
61 #
62
63 %ConfigMeta = (
64
65     ######################################################################
66     # General server configuration
67     ######################################################################
68     ServerHost          => "string",
69     ServerPort          => "integer",
70     ServerMesgSecret    => "string",
71     MyPath              => {type => "string", undefIfEmpty => 1},
72     UmaskMode           => "integer",
73     WakeupSchedule => {
74             type  => "shortlist",
75             child => "float",
76         },
77     MaxBackups          => "integer",
78     MaxUserBackups      => "integer",
79     MaxPendingCmds      => "integer",
80     MaxBackupPCNightlyJobs => "integer",
81     BackupPCNightlyPeriod  => "integer",
82     MaxOldLogFiles      => "integer",
83
84     SshPath             => {type => "execPath", undefIfEmpty => 1},
85     NmbLookupPath       => {type => "execPath", undefIfEmpty => 1},
86     PingPath            => {type => "execPath", undefIfEmpty => 1},
87     DfPath              => {type => "execPath", undefIfEmpty => 1},
88     DfCmd               => "string",
89     SplitPath           => {type => "execPath", undefIfEmpty => 1},
90     ParPath             => {type => "execPath", undefIfEmpty => 1},
91     CatPath             => {type => "execPath", undefIfEmpty => 1},
92     GzipPath            => {type => "execPath", undefIfEmpty => 1},
93     Bzip2Path           => {type => "execPath", undefIfEmpty => 1},
94     DfMaxUsagePct       => "float",
95     TrashCleanSleepSec  => "integer",
96     DHCPAddressRanges   => {
97             type    => "list",
98             emptyOk => 1,
99             child   => {
100                 type      => "hash",
101                 noKeyEdit => 1,
102                 order     => [qw(ipAddrBase first last)],
103                 child     => {
104                     ipAddrBase => "string",
105                     first      => "integer",
106                     last       => "integer",
107                 },
108             },
109     },
110     BackupPCUser        => "string",
111     CgiDir              => "string",
112     InstallDir          => "string",
113     TopDir              => "string",
114     ConfDir             => "string",
115     LogDir              => "string",
116     BackupPCUserVerify  => "boolean",
117     HardLinkMax         => "integer",
118     PerlModuleLoad      => {
119             type    => "list",
120             emptyOk => 1,
121             undefIfEmpty => 1,
122             child   => "string",
123     },
124     ServerInitdPath     => {type => "string", undefIfEmpty => 1},
125     ServerInitdStartCmd => "string",
126
127     ######################################################################
128     # What to backup and when to do it
129     # (can be overridden in the per-PC config.pl)
130     ######################################################################
131     FullPeriod          => "float",
132     IncrPeriod          => "float",
133     FullKeepCnt         => {
134             type   => "shortlist",
135             child  => "integer",
136     },
137     FullKeepCntMin      => "integer",
138     FullAgeMax          => "float",
139     IncrKeepCnt         => "integer",
140     IncrKeepCntMin      => "integer",
141     IncrAgeMax          => "float",
142     PartialAgeMax       => "float",
143     IncrFill            => "boolean",
144     RestoreInfoKeepCnt  => "integer",
145     ArchiveInfoKeepCnt  => "integer",
146
147     BackupFilesOnly     => {
148             type      => "hash",
149             emptyOk   => 1,
150             childType => {
151                 type      => "list",
152                 emptyOk   => 1,
153                 child     => "string",
154             },
155     },
156     BackupFilesExclude  => {
157             type      => "hash",
158             emptyOk   => 1,
159             childType => {
160                 type      => "list",
161                 emptyOk   => 1,
162                 child     => "string",
163             },
164     },
165
166     BlackoutBadPingLimit => "integer",
167     BlackoutGoodCnt      => "integer",
168     BlackoutPeriods      => {
169             type    => "list",
170             emptyOk => 1,
171             child   => {
172                 type      => "hash",
173                 noKeyEdit => 1,
174                 child     => {
175                     hourBegin => "float",
176                     hourEnd   => "float",
177                     weekDays  => {
178                         type  => "shortlist",
179                         child => "integer",
180                     },
181                 },
182             },
183         },
184
185     BackupZeroFilesIsFatal => "boolean",
186
187     ######################################################################
188     # How to backup a client
189     ######################################################################
190     XferMethod => {
191             type   => "select",
192             values => [qw(archive rsync rsyncd smb tar)],
193     },
194     XferLogLevel        => "integer",
195
196     ClientCharset       => "string",
197
198     SmbShareName        => {
199             type   => "list",
200             child  => "string",
201     },
202     SmbShareUserName    => "string",
203     SmbSharePasswd      => "string",
204     SmbClientPath       => {type => "string", undefIfEmpty => 1},
205     SmbClientFullCmd    => "string",
206     SmbClientIncrCmd    => "string",
207     SmbClientRestoreCmd => "string",
208
209     TarShareName        => {
210             type   => "list",
211             child  => "string",
212     },
213     TarClientCmd        => "string",
214     TarFullArgs         => "string",
215     TarIncrArgs         => "string",
216     TarClientRestoreCmd => "string",
217     TarClientPath       => {type => "string", undefIfEmpty => 1},
218
219     RsyncShareName      => {
220             type   => "list",
221             child  => "string",
222     },
223     RsyncClientPath     => {type => "string", undefIfEmpty => 1},
224     RsyncClientCmd      => "string",
225     RsyncClientRestoreCmd => "string",
226
227     RsyncdClientPort    => "integer",
228     RsyncdPasswd        => "string",
229     RsyncdAuthRequired  => "boolean",
230
231     RsyncCsumCacheVerifyProb => "float",
232     RsyncArgs           => {
233             type   => "list",
234             emptyOk => 1,
235             child  => "string",
236     },
237     RsyncRestoreArgs    => {
238             type   => "list",
239             emptyOk => 1,
240             child  => "string",
241     },
242
243     ArchiveDest         => "string",
244     ArchiveComp         => {
245             type   => "select",
246             values => [qw(none bzip2 gzip)],
247     },
248     ArchivePar          => "boolean",
249     ArchiveSplit        => "float",
250     ArchiveClientCmd    => "string",
251
252     NmbLookupCmd        => "string",
253     NmbLookupFindHostCmd => "string",
254
255     FixedIPNetBiosNameCheck => "boolean",
256     PingCmd             => "string",
257     PingMaxMsec         => "float",
258
259     ClientTimeout       => "integer",
260
261     MaxOldPerPCLogFiles => "integer",
262
263     CompressLevel       => "integer",
264
265     DumpPreUserCmd      => {type => "string", undefIfEmpty => 1},
266     DumpPostUserCmd     => {type => "string", undefIfEmpty => 1},
267     DumpPreShareCmd     => {type => "string", undefIfEmpty => 1},
268     DumpPostShareCmd    => {type => "string", undefIfEmpty => 1},
269     RestorePreUserCmd   => {type => "string", undefIfEmpty => 1},
270     RestorePostUserCmd  => {type => "string", undefIfEmpty => 1},
271     ArchivePreUserCmd   => {type => "string", undefIfEmpty => 1},
272     ArchivePostUserCmd  => {type => "string", undefIfEmpty => 1},
273
274     ClientNameAlias     => {type => "string", undefIfEmpty => 1},
275
276     ######################################################################
277     # Email reminders, status and messages
278     # (can be overridden in the per-PC config.pl)
279     ######################################################################
280     SendmailPath              => {type => "execPath", undefIfEmpty => 1},
281     EMailNotifyMinDays        => "float",
282     EMailFromUserName         => "string",
283     EMailAdminUserName        => "string",
284     EMailUserDestDomain       => "string",
285     EMailNoBackupEverSubj     => {type => "string",    undefIfEmpty => 1},
286     EMailNoBackupEverMesg     => {type => "bigstring", undefIfEmpty => 1},
287     EMailNotifyOldBackupDays  => "float",
288     EMailNoBackupRecentSubj   => {type => "string",    undefIfEmpty => 1},
289     EMailNoBackupRecentMesg   => {type => "bigstring", undefIfEmpty => 1},
290     EMailNotifyOldOutlookDays => "float",
291     EMailOutlookBackupSubj    => {type => "string",    undefIfEmpty => 1},
292     EMailOutlookBackupMesg    => {type => "bigstring", undefIfEmpty => 1},
293     EMailHeaders              => {type => "bigstring", undefIfEmpty => 1},
294
295     ######################################################################
296     # CGI user interface configuration settings
297     ######################################################################
298     CgiAdminUserGroup   => "string",
299     CgiAdminUsers       => "string",
300     CgiURL              => "string",
301     Language            => {
302             type   => "select",
303             values => [qw(de en es fr it nl pt_br)],
304     },
305     CgiUserHomePageCheck => "string",
306     CgiUserUrlCreate    => "string",
307     CgiDateFormatMMDD   => "boolean",
308     CgiNavBarAdminAllHosts => "boolean",
309     CgiSearchBoxEnable  => "boolean",
310     CgiNavBarLinks      => {
311             type    => "list",
312             emptyOk => 1,
313             child   => {
314                 type => "hash",
315                 noKeyEdit => 1,
316                 child => {
317                     link  => "string",
318                     lname => {type => "string", undefIfEmpty => 1},
319                     name  => {type => "string", undefIfEmpty => 1},
320                 },
321             },
322     },
323     CgiStatusHilightColor => {
324             type => "hash",
325             noKeyEdit => 1,
326             child => {
327                 Reason_backup_failed           => "string",
328                 Reason_backup_done             => "string",
329                 Reason_no_ping                 => "string",
330                 Reason_backup_canceled_by_user => "string",
331                 Status_backup_in_progress      => "string",
332             },
333     },
334     CgiHeaders          => "bigstring",
335     CgiImageDir         => "string",
336     CgiExt2ContentType  => {
337             type      => "hash",
338             emptyOk   => 1,
339             childType => "string",
340         },
341     CgiImageDirURL      => "string",
342     CgiCSSFile          => "string",
343     CgiUserConfigEditEnable => "boolean",
344     CgiUserConfigEdit   => {
345             type => "hash",
346             noKeyEdit => 1,
347             child => {
348                 FullPeriod                => "boolean",
349                 IncrPeriod                => "boolean",
350                 FullKeepCnt               => "boolean",
351                 FullKeepCntMin            => "boolean",
352                 FullAgeMax                => "boolean",
353                 IncrKeepCnt               => "boolean",
354                 IncrKeepCntMin            => "boolean",
355                 IncrAgeMax                => "boolean",
356                 PartialAgeMax             => "boolean",
357                 IncrFill                  => "boolean",
358                 RestoreInfoKeepCnt        => "boolean",
359                 ArchiveInfoKeepCnt        => "boolean",
360                 BackupFilesOnly           => "boolean",
361                 BackupFilesExclude        => "boolean",
362                 BlackoutBadPingLimit      => "boolean",
363                 BlackoutGoodCnt           => "boolean",
364                 BlackoutPeriods           => "boolean",
365                 BackupZeroFilesIsFatal    => "boolean",
366                 XferMethod                => "boolean",
367                 XferLogLevel              => "boolean",
368                 ClientCharset             => "boolean",
369                 SmbShareName              => "boolean",
370                 SmbShareUserName          => "boolean",
371                 SmbSharePasswd            => "boolean",
372                 SmbClientFullCmd          => "boolean",
373                 SmbClientIncrCmd          => "boolean",
374                 SmbClientRestoreCmd       => "boolean",
375                 TarShareName              => "boolean",
376                 TarFullArgs               => "boolean",
377                 TarIncrArgs               => "boolean",
378                 TarClientCmd              => "boolean",
379                 TarClientRestoreCmd       => "boolean",
380                 RsyncShareName            => "boolean",
381                 RsyncdClientPort          => "boolean",
382                 RsyncdPasswd              => "boolean",
383                 RsyncdAuthRequired        => "boolean",
384                 RsyncCsumCacheVerifyProb  => "boolean",
385                 RsyncArgs                 => "boolean",
386                 RsyncRestoreArgs          => "boolean",
387                 RsyncClientCmd            => "boolean",
388                 RsyncClientRestoreCmd     => "boolean",
389                 ArchiveDest               => "boolean",
390                 ArchiveComp               => "boolean",
391                 ArchivePar                => "boolean",
392                 ArchiveSplit              => "boolean",
393                 ArchiveClientCmd          => "boolean",
394                 FixedIPNetBiosNameCheck   => "boolean",
395                 PingMaxMsec               => "boolean",
396                 NmbLookupCmd              => "boolean",
397                 NmbLookupFindHostCmd      => "boolean",
398                 PingCmd                   => "boolean",
399                 ClientTimeout             => "boolean",
400                 MaxOldPerPCLogFiles       => "boolean",
401                 CompressLevel             => "boolean",
402                 ClientNameAlias           => "boolean",
403                 DumpPreUserCmd            => "boolean",
404                 DumpPostUserCmd           => "boolean",
405                 RestorePreUserCmd         => "boolean",
406                 RestorePostUserCmd        => "boolean",
407                 ArchivePreUserCmd         => "boolean",
408                 ArchivePostUserCmd        => "boolean",
409                 DumpPostShareCmd          => "boolean",
410                 DumpPreShareCmd           => "boolean",
411                 EMailNotifyMinDays        => "boolean",
412                 EMailFromUserName         => "boolean",
413                 EMailAdminUserName        => "boolean",
414                 EMailUserDestDomain       => "boolean",
415                 EMailNoBackupEverSubj     => "boolean",
416                 EMailNoBackupEverMesg     => "boolean",
417                 EMailNotifyOldBackupDays  => "boolean",
418                 EMailNoBackupRecentSubj   => "boolean",
419                 EMailNoBackupRecentMesg   => "boolean",
420                 EMailNotifyOldOutlookDays => "boolean",
421                 EMailOutlookBackupSubj    => "boolean",
422                 EMailOutlookBackupMesg    => "boolean",
423             },
424     },
425
426     ######################################################################
427     # Fake config setting for editing the hosts
428     ######################################################################
429     Hosts => {
430             type    => "list",
431             emptyOk => 1,
432             child   => {
433                 type  => "horizHash",
434                 order => [qw(host dhcp user moreUsers)],
435                 noKeyEdit => 1,
436                 child => {
437                     host       => { type => "string", size => 20 },
438                     dhcp       => { type => "boolean"            },
439                     user       => { type => "string", size => 20 },
440                     moreUsers  => { type => "string", size => 30 },
441                 },
442             },
443     },
444 );
445
446 1;