a887b8ed16a8276fc5e17c2c92d8cd0d9158bdcf
[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-2009  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.2.0beta1, released 5 Jan 2010.
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     CmdQueueNice        => "integer",
84
85     SshPath             => {type => "execPath", undefIfEmpty => 1},
86     NmbLookupPath       => {type => "execPath", undefIfEmpty => 1},
87     PingPath            => {type => "execPath", undefIfEmpty => 1},
88     DfPath              => {type => "execPath", undefIfEmpty => 1},
89     DfCmd               => "string",
90     SplitPath           => {type => "execPath", undefIfEmpty => 1},
91     ParPath             => {type => "execPath", undefIfEmpty => 1},
92     CatPath             => {type => "execPath", undefIfEmpty => 1},
93     GzipPath            => {type => "execPath", undefIfEmpty => 1},
94     Bzip2Path           => {type => "execPath", undefIfEmpty => 1},
95     DfMaxUsagePct       => "float",
96     TrashCleanSleepSec  => "integer",
97     DHCPAddressRanges   => {
98             type    => "list",
99             emptyOk => 1,
100             child   => {
101                 type      => "hash",
102                 noKeyEdit => 1,
103                 order     => [qw(ipAddrBase first last)],
104                 child     => {
105                     ipAddrBase => "string",
106                     first      => "integer",
107                     last       => "integer",
108                 },
109             },
110     },
111     BackupPCUser        => "string",
112     CgiDir              => "string",
113     InstallDir          => "string",
114     TopDir              => "string",
115     ConfDir             => "string",
116     LogDir              => "string",
117     BackupPCUserVerify  => "boolean",
118     HardLinkMax         => "integer",
119     PerlModuleLoad      => {
120             type    => "list",
121             emptyOk => 1,
122             undefIfEmpty => 1,
123             child   => "string",
124     },
125     ServerInitdPath     => {type => "string", undefIfEmpty => 1},
126     ServerInitdStartCmd => "string",
127
128     ######################################################################
129     # What to backup and when to do it
130     # (can be overridden in the per-PC config.pl)
131     ######################################################################
132     FullPeriod          => "float",
133     IncrPeriod          => "float",
134     FullKeepCnt         => {
135             type   => "shortlist",
136             child  => "integer",
137     },
138     FullKeepCntMin      => "integer",
139     FullAgeMax          => "float",
140     IncrKeepCnt         => "integer",
141     IncrKeepCntMin      => "integer",
142     IncrAgeMax          => "float",
143     IncrLevels          => {
144             type   => "shortlist",
145             child  => "integer",
146     },
147     PartialAgeMax       => "float",
148     BackupsDisable      => "integer",
149     IncrFill            => "boolean",
150     RestoreInfoKeepCnt  => "integer",
151     ArchiveInfoKeepCnt  => "integer",
152
153     BackupFilesOnly     => {
154             type      => "hash",
155             emptyOk   => 1,
156             childType => {
157                 type      => "list",
158                 emptyOk   => 1,
159                 child     => "string",
160             },
161     },
162     BackupFilesExclude  => {
163             type      => "hash",
164             emptyOk   => 1,
165             childType => {
166                 type      => "list",
167                 emptyOk   => 1,
168                 child     => "string",
169             },
170     },
171
172     BlackoutBadPingLimit => "integer",
173     BlackoutGoodCnt      => "integer",
174     BlackoutPeriods      => {
175             type    => "list",
176             emptyOk => 1,
177             child   => {
178                 type      => "hash",
179                 noKeyEdit => 1,
180                 child     => {
181                     hourBegin => "float",
182                     hourEnd   => "float",
183                     weekDays  => {
184                         type  => "shortlist",
185                         child => "integer",
186                     },
187                 },
188             },
189         },
190
191     BackupZeroFilesIsFatal => "boolean",
192
193     ######################################################################
194     # How to backup a client
195     ######################################################################
196     XferMethod => {
197             type   => "select",
198             values => [qw(archive ftp rsync rsyncd smb tar)],
199     },
200     XferLogLevel        => "integer",
201
202     ClientCharset       => "string",
203     ClientCharsetLegacy => "string",
204
205     ######################################################################
206     # Smb Configuration
207     ######################################################################
208     SmbShareName        => {
209             type   => "list",
210             child  => "string",
211     },
212     SmbShareUserName    => "string",
213     SmbSharePasswd      => "string",
214     SmbClientPath       => {type => "execPath", undefIfEmpty => 1},
215     SmbClientFullCmd    => "string",
216     SmbClientIncrCmd    => "string",
217     SmbClientRestoreCmd => {type => "string", undefIfEmpty => 1},
218
219     ######################################################################
220     # Tar Configuration
221     ######################################################################
222     TarShareName        => {
223             type   => "list",
224             child  => "string",
225     },
226     TarClientCmd        => "string",
227     TarFullArgs         => "string",
228     TarIncrArgs         => "string",
229     TarClientRestoreCmd => {type => "string", undefIfEmpty => 1},
230     TarClientPath       => {type => "string", undefIfEmpty => 1},
231
232     ######################################################################
233     # Rsync Configuration
234     ######################################################################
235     RsyncShareName      => {
236             type   => "list",
237             child  => "string",
238     },
239     RsyncClientPath     => {type => "string", undefIfEmpty => 1},
240     RsyncClientCmd      => "string",
241     RsyncClientRestoreCmd => "string",
242
243     ######################################################################
244     # Rsyncd Configuration
245     ######################################################################
246     RsyncdClientPort    => "integer",
247     RsyncdUserName      => "string",
248     RsyncdPasswd        => "string",
249     RsyncdAuthRequired  => "boolean",
250
251     ######################################################################
252     # Rsync(d) Options
253     ######################################################################
254     RsyncCsumCacheVerifyProb => "float",
255     RsyncArgs           => {
256             type         => "list",
257             emptyOk      => 1,
258             child        => "string",
259     },
260     RsyncArgsExtra       => {
261             type         => "list",
262             emptyOk      => 1,
263             child        => "string",
264     },
265     RsyncRestoreArgs    => {
266             type         => "list",
267             emptyOk      => 1,
268             undefIfEmpty => 1,
269             child        => "string",
270     },
271
272     ######################################################################
273     # FTP Configuration
274     ######################################################################
275     FtpShareName        => {
276             type  => "list",
277             child => "string",
278     },
279     FtpUserName         => "string",
280     FtpPasswd           => "string",
281     FtpPassive          => "boolean",
282     FtpBlockSize        => "integer",
283     FtpPort             => "integer",
284     FtpTimeout          => "integer",
285     FtpFollowSymlinks   => "boolean",
286
287     ######################################################################
288     # Archive Configuration
289     ######################################################################
290     ArchiveDest         => "string",
291     ArchiveComp         => {
292             type   => "select",
293             values => [qw(none bzip2 gzip)],
294     },
295     ArchivePar          => "boolean",
296     ArchiveSplit        => "float",
297     ArchiveClientCmd    => "string",
298
299     ######################################################################
300     # Other Client Configuration
301     ######################################################################
302     NmbLookupCmd        => "string",
303     NmbLookupFindHostCmd => "string",
304
305     FixedIPNetBiosNameCheck => "boolean",
306     PingCmd             => "string",
307     PingMaxMsec         => "float",
308
309     ClientTimeout       => "integer",
310
311     MaxOldPerPCLogFiles => "integer",
312
313     CompressLevel       => "integer",
314
315     DumpPreUserCmd      => {type => "string", undefIfEmpty => 1},
316     DumpPostUserCmd     => {type => "string", undefIfEmpty => 1},
317     DumpPreShareCmd     => {type => "string", undefIfEmpty => 1},
318     DumpPostShareCmd    => {type => "string", undefIfEmpty => 1},
319     RestorePreUserCmd   => {type => "string", undefIfEmpty => 1},
320     RestorePostUserCmd  => {type => "string", undefIfEmpty => 1},
321     ArchivePreUserCmd   => {type => "string", undefIfEmpty => 1},
322     ArchivePostUserCmd  => {type => "string", undefIfEmpty => 1},
323     UserCmdCheckStatus  => "boolean",
324
325     ClientNameAlias     => {type => "string", undefIfEmpty => 1},
326
327     ######################################################################
328     # Email reminders, status and messages
329     # (can be overridden in the per-PC config.pl)
330     ######################################################################
331     SendmailPath              => {type => "execPath", undefIfEmpty => 1},
332     EMailNotifyMinDays        => "float",
333     EMailFromUserName         => "string",
334     EMailAdminUserName        => "string",
335     EMailUserDestDomain       => "string",
336     EMailNoBackupEverSubj     => {type => "string",    undefIfEmpty => 1},
337     EMailNoBackupEverMesg     => {type => "bigstring", undefIfEmpty => 1},
338     EMailNotifyOldBackupDays  => "float",
339     EMailNoBackupRecentSubj   => {type => "string",    undefIfEmpty => 1},
340     EMailNoBackupRecentMesg   => {type => "bigstring", undefIfEmpty => 1},
341     EMailNotifyOldOutlookDays => "float",
342     EMailOutlookBackupSubj    => {type => "string",    undefIfEmpty => 1},
343     EMailOutlookBackupMesg    => {type => "bigstring", undefIfEmpty => 1},
344     EMailHeaders              => {type => "bigstring", undefIfEmpty => 1},
345
346     ######################################################################
347     # CGI user interface configuration settings
348     ######################################################################
349     CgiAdminUserGroup   => "string",
350     CgiAdminUsers       => "string",
351     CgiURL              => "string",
352     Language            => {
353             type   => "select",
354             values => [qw(de en es fr it nl pl pt_br zh_CN)],
355     },
356     CgiUserHomePageCheck => "string",
357     CgiUserUrlCreate    => "string",
358     CgiDateFormatMMDD   => "integer",
359     CgiNavBarAdminAllHosts => "boolean",
360     CgiSearchBoxEnable  => "boolean",
361     CgiNavBarLinks      => {
362             type    => "list",
363             emptyOk => 1,
364             child   => {
365                 type => "hash",
366                 noKeyEdit => 1,
367                 child => {
368                     link  => "string",
369                     lname => {type => "string", undefIfEmpty => 1},
370                     name  => {type => "string", undefIfEmpty => 1},
371                 },
372             },
373     },
374     CgiStatusHilightColor => {
375             type => "hash",
376             noKeyEdit => 1,
377             child => {
378                 Reason_backup_failed           => "string",
379                 Reason_backup_done             => "string",
380                 Reason_no_ping                 => "string",
381                 Reason_backup_canceled_by_user => "string",
382                 Status_backup_in_progress      => "string",
383                 Disabled_OnlyManualBackups     => "string", 
384                 Disabled_AllBackupsDisabled    => "string",  
385             },
386     },
387     CgiHeaders          => "bigstring",
388     CgiImageDir         => "string",
389     CgiExt2ContentType  => {
390             type      => "hash",
391             emptyOk   => 1,
392             childType => "string",
393         },
394     CgiImageDirURL      => "string",
395     CgiCSSFile          => "string",
396     CgiUserConfigEditEnable => "boolean",
397     CgiUserConfigEdit   => {
398             type => "hash",
399             noKeyEdit => 1,
400             child => {
401                 FullPeriod                => "boolean",
402                 IncrPeriod                => "boolean",
403                 FullKeepCnt               => "boolean",
404                 FullKeepCntMin            => "boolean",
405                 FullAgeMax                => "boolean",
406                 IncrKeepCnt               => "boolean",
407                 IncrKeepCntMin            => "boolean",
408                 IncrAgeMax                => "boolean",
409                 IncrLevels                => "boolean",
410                 PartialAgeMax             => "boolean",
411                 IncrFill                  => "boolean",
412                 RestoreInfoKeepCnt        => "boolean",
413                 ArchiveInfoKeepCnt        => "boolean",
414                 BackupFilesOnly           => "boolean",
415                 BackupFilesExclude        => "boolean",
416                 BackupsDisable            => "boolean",
417                 BlackoutBadPingLimit      => "boolean",
418                 BlackoutGoodCnt           => "boolean",
419                 BlackoutPeriods           => "boolean",
420                 BackupZeroFilesIsFatal    => "boolean",
421                 XferMethod                => "boolean",
422                 XferLogLevel              => "boolean",
423                 ClientCharset             => "boolean",
424                 ClientCharsetLegacy       => "boolean",
425                 SmbShareName              => "boolean",
426                 SmbShareUserName          => "boolean",
427                 SmbSharePasswd            => "boolean",
428                 SmbClientFullCmd          => "boolean",
429                 SmbClientIncrCmd          => "boolean",
430                 SmbClientRestoreCmd       => "boolean",
431                 TarShareName              => "boolean",
432                 TarFullArgs               => "boolean",
433                 TarIncrArgs               => "boolean",
434                 TarClientCmd              => "boolean",
435                 TarClientPath             => "boolean",
436                 TarClientRestoreCmd       => "boolean",
437                 RsyncShareName            => "boolean",
438                 RsyncdClientPort          => "boolean",
439                 RsyncdUserName            => "boolean",
440                 RsyncdPasswd              => "boolean",
441                 RsyncdAuthRequired        => "boolean",
442                 RsyncCsumCacheVerifyProb  => "boolean",
443                 RsyncArgs                 => "boolean",
444                 RsyncArgsExtra            => "boolean",
445                 RsyncRestoreArgs          => "boolean",
446                 RsyncClientCmd            => "boolean",
447                 RsyncClientPath           => "boolean",
448                 RsyncClientRestoreCmd     => "boolean",
449                 FtpShareName              => "boolean",
450                 FtpUserName               => "boolean",
451                 FtpPasswd                 => "boolean",
452                 FtpBlockSize              => "boolean",
453                 FtpPort                   => "boolean",
454                 FtpTimeout                => "boolean",
455                 FtpFollowSymlinks         => "boolean",
456                 FtpRestoreEnabled         => "boolean",
457                 ArchiveDest               => "boolean",
458                 ArchiveComp               => "boolean",
459                 ArchivePar                => "boolean",
460                 ArchiveSplit              => "boolean",
461                 ArchiveClientCmd          => "boolean",
462                 FixedIPNetBiosNameCheck   => "boolean",
463                 PingMaxMsec               => "boolean",
464                 NmbLookupCmd              => "boolean",
465                 NmbLookupFindHostCmd      => "boolean",
466                 PingCmd                   => "boolean",
467                 ClientTimeout             => "boolean",
468                 MaxOldPerPCLogFiles       => "boolean",
469                 CompressLevel             => "boolean",
470                 ClientNameAlias           => "boolean",
471                 DumpPreUserCmd            => "boolean",
472                 DumpPostUserCmd           => "boolean",
473                 RestorePreUserCmd         => "boolean",
474                 RestorePostUserCmd        => "boolean",
475                 ArchivePreUserCmd         => "boolean",
476                 ArchivePostUserCmd        => "boolean",
477                 DumpPostShareCmd          => "boolean",
478                 DumpPreShareCmd           => "boolean",
479                 UserCmdCheckStatus        => "boolean",
480                 EMailNotifyMinDays        => "boolean",
481                 EMailFromUserName         => "boolean",
482                 EMailAdminUserName        => "boolean",
483                 EMailUserDestDomain       => "boolean",
484                 EMailNoBackupEverSubj     => "boolean",
485                 EMailNoBackupEverMesg     => "boolean",
486                 EMailNotifyOldBackupDays  => "boolean",
487                 EMailNoBackupRecentSubj   => "boolean",
488                 EMailNoBackupRecentMesg   => "boolean",
489                 EMailNotifyOldOutlookDays => "boolean",
490                 EMailOutlookBackupSubj    => "boolean",
491                 EMailOutlookBackupMesg    => "boolean",
492                 EMailHeaders              => "boolean",
493             },
494     },
495
496     ######################################################################
497     # Fake config setting for editing the hosts
498     ######################################################################
499     Hosts => {
500             type    => "list",
501             emptyOk => 1,
502             child   => {
503                 type  => "horizHash",
504                 order => [qw(host dhcp user moreUsers)],
505                 noKeyEdit => 1,
506                 child => {
507                     host       => { type => "string", size => 20 },
508                     dhcp       => { type => "boolean"            },
509                     user       => { type => "string", size => 20 },
510                     moreUsers  => { type => "string", size => 30 },
511                 },
512             },
513     },
514 );
515
516 1;