* Various changes for 3.0.0beta1
[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.0beta1, released 30 Jul 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     IncrLevels          => {
143             type   => "shortlist",
144             child  => "integer",
145     },
146     PartialAgeMax       => "float",
147     BackupsDisable      => "integer",
148     IncrFill            => "boolean",
149     RestoreInfoKeepCnt  => "integer",
150     ArchiveInfoKeepCnt  => "integer",
151
152     BackupFilesOnly     => {
153             type      => "hash",
154             emptyOk   => 1,
155             childType => {
156                 type      => "list",
157                 emptyOk   => 1,
158                 child     => "string",
159             },
160     },
161     BackupFilesExclude  => {
162             type      => "hash",
163             emptyOk   => 1,
164             childType => {
165                 type      => "list",
166                 emptyOk   => 1,
167                 child     => "string",
168             },
169     },
170
171     BlackoutBadPingLimit => "integer",
172     BlackoutGoodCnt      => "integer",
173     BlackoutPeriods      => {
174             type    => "list",
175             emptyOk => 1,
176             child   => {
177                 type      => "hash",
178                 noKeyEdit => 1,
179                 child     => {
180                     hourBegin => "float",
181                     hourEnd   => "float",
182                     weekDays  => {
183                         type  => "shortlist",
184                         child => "integer",
185                     },
186                 },
187             },
188         },
189
190     BackupZeroFilesIsFatal => "boolean",
191
192     ######################################################################
193     # How to backup a client
194     ######################################################################
195     XferMethod => {
196             type   => "select",
197             values => [qw(archive rsync rsyncd smb tar)],
198     },
199     XferLogLevel        => "integer",
200
201     ClientCharset       => "string",
202
203     SmbShareName        => {
204             type   => "list",
205             child  => "string",
206     },
207     SmbShareUserName    => "string",
208     SmbSharePasswd      => "string",
209     SmbClientPath       => {type => "string", undefIfEmpty => 1},
210     SmbClientFullCmd    => "string",
211     SmbClientIncrCmd    => "string",
212     SmbClientRestoreCmd => "string",
213
214     TarShareName        => {
215             type   => "list",
216             child  => "string",
217     },
218     TarClientCmd        => "string",
219     TarFullArgs         => "string",
220     TarIncrArgs         => "string",
221     TarClientRestoreCmd => "string",
222     TarClientPath       => {type => "string", undefIfEmpty => 1},
223
224     RsyncShareName      => {
225             type   => "list",
226             child  => "string",
227     },
228     RsyncClientPath     => {type => "string", undefIfEmpty => 1},
229     RsyncClientCmd      => "string",
230     RsyncClientRestoreCmd => "string",
231
232     RsyncdClientPort    => "integer",
233     RsyncdUserName      => "string",
234     RsyncdPasswd        => "string",
235     RsyncdAuthRequired  => "boolean",
236
237     RsyncCsumCacheVerifyProb => "float",
238     RsyncArgs           => {
239             type   => "list",
240             emptyOk => 1,
241             child  => "string",
242     },
243     RsyncRestoreArgs    => {
244             type   => "list",
245             emptyOk => 1,
246             child  => "string",
247     },
248
249     BackupPCdCmd        => "string",
250     BackupPCdPath       => "string",
251     BackupPCdShareName  => "string",
252     BackupPCdRestoreCmd => "string",
253
254     ArchiveDest         => "string",
255     ArchiveComp         => {
256             type   => "select",
257             values => [qw(none bzip2 gzip)],
258     },
259     ArchivePar          => "boolean",
260     ArchiveSplit        => "float",
261     ArchiveClientCmd    => "string",
262
263     NmbLookupCmd        => "string",
264     NmbLookupFindHostCmd => "string",
265
266     FixedIPNetBiosNameCheck => "boolean",
267     PingCmd             => "string",
268     PingMaxMsec         => "float",
269
270     ClientTimeout       => "integer",
271
272     MaxOldPerPCLogFiles => "integer",
273
274     CompressLevel       => "integer",
275
276     DumpPreUserCmd      => {type => "string", undefIfEmpty => 1},
277     DumpPostUserCmd     => {type => "string", undefIfEmpty => 1},
278     DumpPreShareCmd     => {type => "string", undefIfEmpty => 1},
279     DumpPostShareCmd    => {type => "string", undefIfEmpty => 1},
280     RestorePreUserCmd   => {type => "string", undefIfEmpty => 1},
281     RestorePostUserCmd  => {type => "string", undefIfEmpty => 1},
282     ArchivePreUserCmd   => {type => "string", undefIfEmpty => 1},
283     ArchivePostUserCmd  => {type => "string", undefIfEmpty => 1},
284     UserCmdCheckStatus  => "boolean",
285
286     ClientNameAlias     => {type => "string", undefIfEmpty => 1},
287
288     ######################################################################
289     # Email reminders, status and messages
290     # (can be overridden in the per-PC config.pl)
291     ######################################################################
292     SendmailPath              => {type => "execPath", undefIfEmpty => 1},
293     EMailNotifyMinDays        => "float",
294     EMailFromUserName         => "string",
295     EMailAdminUserName        => "string",
296     EMailUserDestDomain       => "string",
297     EMailNoBackupEverSubj     => {type => "string",    undefIfEmpty => 1},
298     EMailNoBackupEverMesg     => {type => "bigstring", undefIfEmpty => 1},
299     EMailNotifyOldBackupDays  => "float",
300     EMailNoBackupRecentSubj   => {type => "string",    undefIfEmpty => 1},
301     EMailNoBackupRecentMesg   => {type => "bigstring", undefIfEmpty => 1},
302     EMailNotifyOldOutlookDays => "float",
303     EMailOutlookBackupSubj    => {type => "string",    undefIfEmpty => 1},
304     EMailOutlookBackupMesg    => {type => "bigstring", undefIfEmpty => 1},
305     EMailHeaders              => {type => "bigstring", undefIfEmpty => 1},
306
307     ######################################################################
308     # CGI user interface configuration settings
309     ######################################################################
310     CgiAdminUserGroup   => "string",
311     CgiAdminUsers       => "string",
312     CgiURL              => "string",
313     Language            => {
314             type   => "select",
315             values => [qw(de en es fr it nl pt_br)],
316     },
317     CgiUserHomePageCheck => "string",
318     CgiUserUrlCreate    => "string",
319     CgiDateFormatMMDD   => "boolean",
320     CgiNavBarAdminAllHosts => "boolean",
321     CgiSearchBoxEnable  => "boolean",
322     CgiNavBarLinks      => {
323             type    => "list",
324             emptyOk => 1,
325             child   => {
326                 type => "hash",
327                 noKeyEdit => 1,
328                 child => {
329                     link  => "string",
330                     lname => {type => "string", undefIfEmpty => 1},
331                     name  => {type => "string", undefIfEmpty => 1},
332                 },
333             },
334     },
335     CgiStatusHilightColor => {
336             type => "hash",
337             noKeyEdit => 1,
338             child => {
339                 Reason_backup_failed           => "string",
340                 Reason_backup_done             => "string",
341                 Reason_no_ping                 => "string",
342                 Reason_backup_canceled_by_user => "string",
343                 Status_backup_in_progress      => "string",
344             },
345     },
346     CgiHeaders          => "bigstring",
347     CgiImageDir         => "string",
348     CgiExt2ContentType  => {
349             type      => "hash",
350             emptyOk   => 1,
351             childType => "string",
352         },
353     CgiImageDirURL      => "string",
354     CgiCSSFile          => "string",
355     CgiUserConfigEditEnable => "boolean",
356     CgiUserConfigEdit   => {
357             type => "hash",
358             noKeyEdit => 1,
359             child => {
360                 FullPeriod                => "boolean",
361                 IncrPeriod                => "boolean",
362                 FullKeepCnt               => "boolean",
363                 FullKeepCntMin            => "boolean",
364                 FullAgeMax                => "boolean",
365                 IncrKeepCnt               => "boolean",
366                 IncrKeepCntMin            => "boolean",
367                 IncrAgeMax                => "boolean",
368                 IncrLevels                => "boolean",
369                 PartialAgeMax             => "boolean",
370                 IncrFill                  => "boolean",
371                 RestoreInfoKeepCnt        => "boolean",
372                 ArchiveInfoKeepCnt        => "boolean",
373                 BackupFilesOnly           => "boolean",
374                 BackupFilesExclude        => "boolean",
375                 BlackoutBadPingLimit      => "boolean",
376                 BlackoutGoodCnt           => "boolean",
377                 BlackoutPeriods           => "boolean",
378                 BackupZeroFilesIsFatal    => "boolean",
379                 XferMethod                => "boolean",
380                 XferLogLevel              => "boolean",
381                 ClientCharset             => "boolean",
382                 SmbShareName              => "boolean",
383                 SmbShareUserName          => "boolean",
384                 SmbSharePasswd            => "boolean",
385                 SmbClientFullCmd          => "boolean",
386                 SmbClientIncrCmd          => "boolean",
387                 SmbClientRestoreCmd       => "boolean",
388                 TarShareName              => "boolean",
389                 TarFullArgs               => "boolean",
390                 TarIncrArgs               => "boolean",
391                 TarClientCmd              => "boolean",
392                 TarClientRestoreCmd       => "boolean",
393                 RsyncShareName            => "boolean",
394                 RsyncdClientPort          => "boolean",
395                 RsyncdPasswd              => "boolean",
396                 RsyncdAuthRequired        => "boolean",
397                 RsyncCsumCacheVerifyProb  => "boolean",
398                 RsyncArgs                 => "boolean",
399                 RsyncRestoreArgs          => "boolean",
400                 RsyncClientCmd            => "boolean",
401                 RsyncClientRestoreCmd     => "boolean",
402                 ArchiveDest               => "boolean",
403                 ArchiveComp               => "boolean",
404                 ArchivePar                => "boolean",
405                 ArchiveSplit              => "boolean",
406                 ArchiveClientCmd          => "boolean",
407                 FixedIPNetBiosNameCheck   => "boolean",
408                 PingMaxMsec               => "boolean",
409                 NmbLookupCmd              => "boolean",
410                 NmbLookupFindHostCmd      => "boolean",
411                 PingCmd                   => "boolean",
412                 ClientTimeout             => "boolean",
413                 MaxOldPerPCLogFiles       => "boolean",
414                 CompressLevel             => "boolean",
415                 ClientNameAlias           => "boolean",
416                 DumpPreUserCmd            => "boolean",
417                 DumpPostUserCmd           => "boolean",
418                 RestorePreUserCmd         => "boolean",
419                 RestorePostUserCmd        => "boolean",
420                 ArchivePreUserCmd         => "boolean",
421                 ArchivePostUserCmd        => "boolean",
422                 DumpPostShareCmd          => "boolean",
423                 DumpPreShareCmd           => "boolean",
424                 UserCmdCheckStatus        => "boolean",
425                 EMailNotifyMinDays        => "boolean",
426                 EMailFromUserName         => "boolean",
427                 EMailAdminUserName        => "boolean",
428                 EMailUserDestDomain       => "boolean",
429                 EMailNoBackupEverSubj     => "boolean",
430                 EMailNoBackupEverMesg     => "boolean",
431                 EMailNotifyOldBackupDays  => "boolean",
432                 EMailNoBackupRecentSubj   => "boolean",
433                 EMailNoBackupRecentMesg   => "boolean",
434                 EMailNotifyOldOutlookDays => "boolean",
435                 EMailOutlookBackupSubj    => "boolean",
436                 EMailOutlookBackupMesg    => "boolean",
437                 EMailHeaders              => "boolean",
438             },
439     },
440
441     ######################################################################
442     # Fake config setting for editing the hosts
443     ######################################################################
444     Hosts => {
445             type    => "list",
446             emptyOk => 1,
447             child   => {
448                 type  => "horizHash",
449                 order => [qw(host dhcp user moreUsers)],
450                 noKeyEdit => 1,
451                 child => {
452                     host       => { type => "string", size => 20 },
453                     dhcp       => { type => "boolean"            },
454                     user       => { type => "string", size => 20 },
455                     moreUsers  => { type => "string", size => 30 },
456                 },
457             },
458     },
459 );
460
461 1;