* Added Simplified Chinese CGI translation from Youlin Feng.
[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.0, released 28 Jan 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
203     SmbShareName        => {
204             type   => "list",
205             child  => "string",
206     },
207     SmbShareUserName    => "string",
208     SmbSharePasswd      => "string",
209     SmbClientPath       => {type => "execPath", 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  => "boolean",
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 zh_CN)],
316     },
317     CgiUserHomePageCheck => "string",
318     CgiUserUrlCreate    => "string",
319     CgiDateFormatMMDD   => "integer",
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                 Disabled_OnlyManualBackups     => "string", 
345                 Disabled_AllBackupsDisabled    => "string",  
346             },
347     },
348     CgiHeaders          => "bigstring",
349     CgiImageDir         => "string",
350     CgiExt2ContentType  => {
351             type      => "hash",
352             emptyOk   => 1,
353             childType => "string",
354         },
355     CgiImageDirURL      => "string",
356     CgiCSSFile          => "string",
357     CgiUserConfigEditEnable => "boolean",
358     CgiUserConfigEdit   => {
359             type => "hash",
360             noKeyEdit => 1,
361             child => {
362                 FullPeriod                => "boolean",
363                 IncrPeriod                => "boolean",
364                 FullKeepCnt               => "boolean",
365                 FullKeepCntMin            => "boolean",
366                 FullAgeMax                => "boolean",
367                 IncrKeepCnt               => "boolean",
368                 IncrKeepCntMin            => "boolean",
369                 IncrAgeMax                => "boolean",
370                 IncrLevels                => "boolean",
371                 PartialAgeMax             => "boolean",
372                 IncrFill                  => "boolean",
373                 RestoreInfoKeepCnt        => "boolean",
374                 ArchiveInfoKeepCnt        => "boolean",
375                 BackupFilesOnly           => "boolean",
376                 BackupFilesExclude        => "boolean",
377                 BackupsDisable            => "boolean",
378                 BlackoutBadPingLimit      => "boolean",
379                 BlackoutGoodCnt           => "boolean",
380                 BlackoutPeriods           => "boolean",
381                 BackupZeroFilesIsFatal    => "boolean",
382                 XferMethod                => "boolean",
383                 XferLogLevel              => "boolean",
384                 ClientCharset             => "boolean",
385                 SmbShareName              => "boolean",
386                 SmbShareUserName          => "boolean",
387                 SmbSharePasswd            => "boolean",
388                 SmbClientFullCmd          => "boolean",
389                 SmbClientIncrCmd          => "boolean",
390                 SmbClientRestoreCmd       => "boolean",
391                 TarShareName              => "boolean",
392                 TarFullArgs               => "boolean",
393                 TarIncrArgs               => "boolean",
394                 TarClientCmd              => "boolean",
395                 TarClientPath             => "boolean",
396                 TarClientRestoreCmd       => "boolean",
397                 RsyncShareName            => "boolean",
398                 RsyncdClientPort          => "boolean",
399                 RsyncdUserName            => "boolean",
400                 RsyncdPasswd              => "boolean",
401                 RsyncdAuthRequired        => "boolean",
402                 RsyncCsumCacheVerifyProb  => "boolean",
403                 RsyncArgs                 => "boolean",
404                 RsyncRestoreArgs          => "boolean",
405                 RsyncClientCmd            => "boolean",
406                 RsyncClientPath           => "boolean",
407                 RsyncClientRestoreCmd     => "boolean",
408                 ArchiveDest               => "boolean",
409                 ArchiveComp               => "boolean",
410                 ArchivePar                => "boolean",
411                 ArchiveSplit              => "boolean",
412                 ArchiveClientCmd          => "boolean",
413                 FixedIPNetBiosNameCheck   => "boolean",
414                 PingMaxMsec               => "boolean",
415                 NmbLookupCmd              => "boolean",
416                 NmbLookupFindHostCmd      => "boolean",
417                 PingCmd                   => "boolean",
418                 ClientTimeout             => "boolean",
419                 MaxOldPerPCLogFiles       => "boolean",
420                 CompressLevel             => "boolean",
421                 ClientNameAlias           => "boolean",
422                 DumpPreUserCmd            => "boolean",
423                 DumpPostUserCmd           => "boolean",
424                 RestorePreUserCmd         => "boolean",
425                 RestorePostUserCmd        => "boolean",
426                 ArchivePreUserCmd         => "boolean",
427                 ArchivePostUserCmd        => "boolean",
428                 DumpPostShareCmd          => "boolean",
429                 DumpPreShareCmd           => "boolean",
430                 UserCmdCheckStatus        => "boolean",
431                 EMailNotifyMinDays        => "boolean",
432                 EMailFromUserName         => "boolean",
433                 EMailAdminUserName        => "boolean",
434                 EMailUserDestDomain       => "boolean",
435                 EMailNoBackupEverSubj     => "boolean",
436                 EMailNoBackupEverMesg     => "boolean",
437                 EMailNotifyOldBackupDays  => "boolean",
438                 EMailNoBackupRecentSubj   => "boolean",
439                 EMailNoBackupRecentMesg   => "boolean",
440                 EMailNotifyOldOutlookDays => "boolean",
441                 EMailOutlookBackupSubj    => "boolean",
442                 EMailOutlookBackupMesg    => "boolean",
443                 EMailHeaders              => "boolean",
444             },
445     },
446
447     ######################################################################
448     # Fake config setting for editing the hosts
449     ######################################################################
450     Hosts => {
451             type    => "list",
452             emptyOk => 1,
453             child   => {
454                 type  => "horizHash",
455                 order => [qw(host dhcp user moreUsers)],
456                 noKeyEdit => 1,
457                 child => {
458                     host       => { type => "string", size => 20 },
459                     dhcp       => { type => "boolean"            },
460                     user       => { type => "string", size => 20 },
461                     moreUsers  => { type => "string", size => 30 },
462                 },
463             },
464     },
465 );
466
467 1;