* Added multi-level incrementals. Still needs testing.
[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     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  => "integer",
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                 PartialAgeMax             => "boolean",
369                 IncrFill                  => "boolean",
370                 RestoreInfoKeepCnt        => "boolean",
371                 ArchiveInfoKeepCnt        => "boolean",
372                 BackupFilesOnly           => "boolean",
373                 BackupFilesExclude        => "boolean",
374                 BlackoutBadPingLimit      => "boolean",
375                 BlackoutGoodCnt           => "boolean",
376                 BlackoutPeriods           => "boolean",
377                 BackupZeroFilesIsFatal    => "boolean",
378                 XferMethod                => "boolean",
379                 XferLogLevel              => "boolean",
380                 ClientCharset             => "boolean",
381                 SmbShareName              => "boolean",
382                 SmbShareUserName          => "boolean",
383                 SmbSharePasswd            => "boolean",
384                 SmbClientFullCmd          => "boolean",
385                 SmbClientIncrCmd          => "boolean",
386                 SmbClientRestoreCmd       => "boolean",
387                 TarShareName              => "boolean",
388                 TarFullArgs               => "boolean",
389                 TarIncrArgs               => "boolean",
390                 TarClientCmd              => "boolean",
391                 TarClientRestoreCmd       => "boolean",
392                 RsyncShareName            => "boolean",
393                 RsyncdClientPort          => "boolean",
394                 RsyncdPasswd              => "boolean",
395                 RsyncdAuthRequired        => "boolean",
396                 RsyncCsumCacheVerifyProb  => "boolean",
397                 RsyncArgs                 => "boolean",
398                 RsyncRestoreArgs          => "boolean",
399                 RsyncClientCmd            => "boolean",
400                 RsyncClientRestoreCmd     => "boolean",
401                 ArchiveDest               => "boolean",
402                 ArchiveComp               => "boolean",
403                 ArchivePar                => "boolean",
404                 ArchiveSplit              => "boolean",
405                 ArchiveClientCmd          => "boolean",
406                 FixedIPNetBiosNameCheck   => "boolean",
407                 PingMaxMsec               => "boolean",
408                 NmbLookupCmd              => "boolean",
409                 NmbLookupFindHostCmd      => "boolean",
410                 PingCmd                   => "boolean",
411                 ClientTimeout             => "boolean",
412                 MaxOldPerPCLogFiles       => "boolean",
413                 CompressLevel             => "boolean",
414                 ClientNameAlias           => "boolean",
415                 DumpPreUserCmd            => "boolean",
416                 DumpPostUserCmd           => "boolean",
417                 RestorePreUserCmd         => "boolean",
418                 RestorePostUserCmd        => "boolean",
419                 ArchivePreUserCmd         => "boolean",
420                 ArchivePostUserCmd        => "boolean",
421                 DumpPostShareCmd          => "boolean",
422                 DumpPreShareCmd           => "boolean",
423                 EMailNotifyMinDays        => "boolean",
424                 EMailFromUserName         => "boolean",
425                 EMailAdminUserName        => "boolean",
426                 EMailUserDestDomain       => "boolean",
427                 EMailNoBackupEverSubj     => "boolean",
428                 EMailNoBackupEverMesg     => "boolean",
429                 EMailNotifyOldBackupDays  => "boolean",
430                 EMailNoBackupRecentSubj   => "boolean",
431                 EMailNoBackupRecentMesg   => "boolean",
432                 EMailNotifyOldOutlookDays => "boolean",
433                 EMailOutlookBackupSubj    => "boolean",
434                 EMailOutlookBackupMesg    => "boolean",
435             },
436     },
437
438     ######################################################################
439     # Fake config setting for editing the hosts
440     ######################################################################
441     Hosts => {
442             type    => "list",
443             emptyOk => 1,
444             child   => {
445                 type  => "horizHash",
446                 order => [qw(host dhcp user moreUsers)],
447                 noKeyEdit => 1,
448                 child => {
449                     host       => { type => "string", size => 20 },
450                     dhcp       => { type => "boolean"            },
451                     user       => { type => "string", size => 20 },
452                     moreUsers  => { type => "string", size => 30 },
453                 },
454             },
455     },
456 );
457
458 1;