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