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