c7258f14da482d4c9103cc22d311d9c4049aab69
[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     RsyncdUserName      => "string",
229     RsyncdPasswd        => "string",
230     RsyncdAuthRequired  => "boolean",
231
232     RsyncCsumCacheVerifyProb => "float",
233     RsyncArgs           => {
234             type   => "list",
235             emptyOk => 1,
236             child  => "string",
237     },
238     RsyncRestoreArgs    => {
239             type   => "list",
240             emptyOk => 1,
241             child  => "string",
242     },
243
244     BackupPCdCmd        => "string",
245     BackupPCdPath       => "string",
246     BackupPCdShareName  => "string",
247     BackupPCdRestoreCmd => "string",
248
249     ArchiveDest         => "string",
250     ArchiveComp         => {
251             type   => "select",
252             values => [qw(none bzip2 gzip)],
253     },
254     ArchivePar          => "boolean",
255     ArchiveSplit        => "float",
256     ArchiveClientCmd    => "string",
257
258     NmbLookupCmd        => "string",
259     NmbLookupFindHostCmd => "string",
260
261     FixedIPNetBiosNameCheck => "boolean",
262     PingCmd             => "string",
263     PingMaxMsec         => "float",
264
265     ClientTimeout       => "integer",
266
267     MaxOldPerPCLogFiles => "integer",
268
269     CompressLevel       => "integer",
270
271     DumpPreUserCmd      => {type => "string", undefIfEmpty => 1},
272     DumpPostUserCmd     => {type => "string", undefIfEmpty => 1},
273     DumpPreShareCmd     => {type => "string", undefIfEmpty => 1},
274     DumpPostShareCmd    => {type => "string", undefIfEmpty => 1},
275     RestorePreUserCmd   => {type => "string", undefIfEmpty => 1},
276     RestorePostUserCmd  => {type => "string", undefIfEmpty => 1},
277     ArchivePreUserCmd   => {type => "string", undefIfEmpty => 1},
278     ArchivePostUserCmd  => {type => "string", undefIfEmpty => 1},
279
280     ClientNameAlias     => {type => "string", undefIfEmpty => 1},
281
282     ######################################################################
283     # Email reminders, status and messages
284     # (can be overridden in the per-PC config.pl)
285     ######################################################################
286     SendmailPath              => {type => "execPath", undefIfEmpty => 1},
287     EMailNotifyMinDays        => "float",
288     EMailFromUserName         => "string",
289     EMailAdminUserName        => "string",
290     EMailUserDestDomain       => "string",
291     EMailNoBackupEverSubj     => {type => "string",    undefIfEmpty => 1},
292     EMailNoBackupEverMesg     => {type => "bigstring", undefIfEmpty => 1},
293     EMailNotifyOldBackupDays  => "float",
294     EMailNoBackupRecentSubj   => {type => "string",    undefIfEmpty => 1},
295     EMailNoBackupRecentMesg   => {type => "bigstring", undefIfEmpty => 1},
296     EMailNotifyOldOutlookDays => "float",
297     EMailOutlookBackupSubj    => {type => "string",    undefIfEmpty => 1},
298     EMailOutlookBackupMesg    => {type => "bigstring", undefIfEmpty => 1},
299     EMailHeaders              => {type => "bigstring", undefIfEmpty => 1},
300
301     ######################################################################
302     # CGI user interface configuration settings
303     ######################################################################
304     CgiAdminUserGroup   => "string",
305     CgiAdminUsers       => "string",
306     CgiURL              => "string",
307     Language            => {
308             type   => "select",
309             values => [qw(de en es fr it nl pt_br)],
310     },
311     CgiUserHomePageCheck => "string",
312     CgiUserUrlCreate    => "string",
313     CgiDateFormatMMDD   => "boolean",
314     CgiNavBarAdminAllHosts => "boolean",
315     CgiSearchBoxEnable  => "boolean",
316     CgiNavBarLinks      => {
317             type    => "list",
318             emptyOk => 1,
319             child   => {
320                 type => "hash",
321                 noKeyEdit => 1,
322                 child => {
323                     link  => "string",
324                     lname => {type => "string", undefIfEmpty => 1},
325                     name  => {type => "string", undefIfEmpty => 1},
326                 },
327             },
328     },
329     CgiStatusHilightColor => {
330             type => "hash",
331             noKeyEdit => 1,
332             child => {
333                 Reason_backup_failed           => "string",
334                 Reason_backup_done             => "string",
335                 Reason_no_ping                 => "string",
336                 Reason_backup_canceled_by_user => "string",
337                 Status_backup_in_progress      => "string",
338             },
339     },
340     CgiHeaders          => "bigstring",
341     CgiImageDir         => "string",
342     CgiExt2ContentType  => {
343             type      => "hash",
344             emptyOk   => 1,
345             childType => "string",
346         },
347     CgiImageDirURL      => "string",
348     CgiCSSFile          => "string",
349     CgiUserConfigEditEnable => "boolean",
350     CgiUserConfigEdit   => {
351             type => "hash",
352             noKeyEdit => 1,
353             child => {
354                 FullPeriod                => "boolean",
355                 IncrPeriod                => "boolean",
356                 FullKeepCnt               => "boolean",
357                 FullKeepCntMin            => "boolean",
358                 FullAgeMax                => "boolean",
359                 IncrKeepCnt               => "boolean",
360                 IncrKeepCntMin            => "boolean",
361                 IncrAgeMax                => "boolean",
362                 PartialAgeMax             => "boolean",
363                 IncrFill                  => "boolean",
364                 RestoreInfoKeepCnt        => "boolean",
365                 ArchiveInfoKeepCnt        => "boolean",
366                 BackupFilesOnly           => "boolean",
367                 BackupFilesExclude        => "boolean",
368                 BlackoutBadPingLimit      => "boolean",
369                 BlackoutGoodCnt           => "boolean",
370                 BlackoutPeriods           => "boolean",
371                 BackupZeroFilesIsFatal    => "boolean",
372                 XferMethod                => "boolean",
373                 XferLogLevel              => "boolean",
374                 ClientCharset             => "boolean",
375                 SmbShareName              => "boolean",
376                 SmbShareUserName          => "boolean",
377                 SmbSharePasswd            => "boolean",
378                 SmbClientFullCmd          => "boolean",
379                 SmbClientIncrCmd          => "boolean",
380                 SmbClientRestoreCmd       => "boolean",
381                 TarShareName              => "boolean",
382                 TarFullArgs               => "boolean",
383                 TarIncrArgs               => "boolean",
384                 TarClientCmd              => "boolean",
385                 TarClientRestoreCmd       => "boolean",
386                 RsyncShareName            => "boolean",
387                 RsyncdClientPort          => "boolean",
388                 RsyncdPasswd              => "boolean",
389                 RsyncdAuthRequired        => "boolean",
390                 RsyncCsumCacheVerifyProb  => "boolean",
391                 RsyncArgs                 => "boolean",
392                 RsyncRestoreArgs          => "boolean",
393                 RsyncClientCmd            => "boolean",
394                 RsyncClientRestoreCmd     => "boolean",
395                 ArchiveDest               => "boolean",
396                 ArchiveComp               => "boolean",
397                 ArchivePar                => "boolean",
398                 ArchiveSplit              => "boolean",
399                 ArchiveClientCmd          => "boolean",
400                 FixedIPNetBiosNameCheck   => "boolean",
401                 PingMaxMsec               => "boolean",
402                 NmbLookupCmd              => "boolean",
403                 NmbLookupFindHostCmd      => "boolean",
404                 PingCmd                   => "boolean",
405                 ClientTimeout             => "boolean",
406                 MaxOldPerPCLogFiles       => "boolean",
407                 CompressLevel             => "boolean",
408                 ClientNameAlias           => "boolean",
409                 DumpPreUserCmd            => "boolean",
410                 DumpPostUserCmd           => "boolean",
411                 RestorePreUserCmd         => "boolean",
412                 RestorePostUserCmd        => "boolean",
413                 ArchivePreUserCmd         => "boolean",
414                 ArchivePostUserCmd        => "boolean",
415                 DumpPostShareCmd          => "boolean",
416                 DumpPreShareCmd           => "boolean",
417                 EMailNotifyMinDays        => "boolean",
418                 EMailFromUserName         => "boolean",
419                 EMailAdminUserName        => "boolean",
420                 EMailUserDestDomain       => "boolean",
421                 EMailNoBackupEverSubj     => "boolean",
422                 EMailNoBackupEverMesg     => "boolean",
423                 EMailNotifyOldBackupDays  => "boolean",
424                 EMailNoBackupRecentSubj   => "boolean",
425                 EMailNoBackupRecentMesg   => "boolean",
426                 EMailNotifyOldOutlookDays => "boolean",
427                 EMailOutlookBackupSubj    => "boolean",
428                 EMailOutlookBackupMesg    => "boolean",
429             },
430     },
431
432     ######################################################################
433     # Fake config setting for editing the hosts
434     ######################################################################
435     Hosts => {
436             type    => "list",
437             emptyOk => 1,
438             child   => {
439                 type  => "horizHash",
440                 order => [qw(host dhcp user moreUsers)],
441                 noKeyEdit => 1,
442                 child => {
443                     host       => { type => "string", size => 20 },
444                     dhcp       => { type => "boolean"            },
445                     user       => { type => "string", size => 20 },
446                     moreUsers  => { type => "string", size => 30 },
447                 },
448             },
449     },
450 );
451
452 1;