* Fixed encoding of email subject header in bin/BackupPC_sendEmail as
[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.2.0, released 31 Dec 2008.
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     RsyncRestoreArgs    => {
261             type         => "list",
262             emptyOk      => 1,
263             undefIfEmpty => 1,
264             child        => "string",
265     },
266
267     ######################################################################
268     # FTP Configuration
269     ######################################################################
270     FtpShareName        => {
271             type  => "list",
272             child => "string",
273     },
274     FtpUserName         => "string",
275     FtpPasswd           => "string",
276     FtpBlockSize        => "integer",
277     FtpPort             => "integer",
278     FtpTimeout          => "integer",
279     FtpFollowSymlinks   => "boolean",
280     
281     ######################################################################
282     # Archive Configuration
283     ######################################################################
284     ArchiveDest         => "string",
285     ArchiveComp         => {
286             type   => "select",
287             values => [qw(none bzip2 gzip)],
288     },
289     ArchivePar          => "boolean",
290     ArchiveSplit        => "float",
291     ArchiveClientCmd    => "string",
292
293     ######################################################################
294     # Other Client Configuration
295     ######################################################################
296     NmbLookupCmd        => "string",
297     NmbLookupFindHostCmd => "string",
298
299     FixedIPNetBiosNameCheck => "boolean",
300     PingCmd             => "string",
301     PingMaxMsec         => "float",
302
303     ClientTimeout       => "integer",
304
305     MaxOldPerPCLogFiles => "integer",
306
307     CompressLevel       => "integer",
308
309     DumpPreUserCmd      => {type => "string", undefIfEmpty => 1},
310     DumpPostUserCmd     => {type => "string", undefIfEmpty => 1},
311     DumpPreShareCmd     => {type => "string", undefIfEmpty => 1},
312     DumpPostShareCmd    => {type => "string", undefIfEmpty => 1},
313     RestorePreUserCmd   => {type => "string", undefIfEmpty => 1},
314     RestorePostUserCmd  => {type => "string", undefIfEmpty => 1},
315     ArchivePreUserCmd   => {type => "string", undefIfEmpty => 1},
316     ArchivePostUserCmd  => {type => "string", undefIfEmpty => 1},
317     UserCmdCheckStatus  => "boolean",
318
319     ClientNameAlias     => {type => "string", undefIfEmpty => 1},
320
321     ######################################################################
322     # Email reminders, status and messages
323     # (can be overridden in the per-PC config.pl)
324     ######################################################################
325     SendmailPath              => {type => "execPath", undefIfEmpty => 1},
326     EMailNotifyMinDays        => "float",
327     EMailFromUserName         => "string",
328     EMailAdminUserName        => "string",
329     EMailUserDestDomain       => "string",
330     EMailNoBackupEverSubj     => {type => "string",    undefIfEmpty => 1},
331     EMailNoBackupEverMesg     => {type => "bigstring", undefIfEmpty => 1},
332     EMailNotifyOldBackupDays  => "float",
333     EMailNoBackupRecentSubj   => {type => "string",    undefIfEmpty => 1},
334     EMailNoBackupRecentMesg   => {type => "bigstring", undefIfEmpty => 1},
335     EMailNotifyOldOutlookDays => "float",
336     EMailOutlookBackupSubj    => {type => "string",    undefIfEmpty => 1},
337     EMailOutlookBackupMesg    => {type => "bigstring", undefIfEmpty => 1},
338     EMailHeaders              => {type => "bigstring", undefIfEmpty => 1},
339
340     ######################################################################
341     # CGI user interface configuration settings
342     ######################################################################
343     CgiAdminUserGroup   => "string",
344     CgiAdminUsers       => "string",
345     CgiURL              => "string",
346     Language            => {
347             type   => "select",
348             values => [qw(de en es fr it nl pl pt_br zh_CN)],
349     },
350     CgiUserHomePageCheck => "string",
351     CgiUserUrlCreate    => "string",
352     CgiDateFormatMMDD   => "integer",
353     CgiNavBarAdminAllHosts => "boolean",
354     CgiSearchBoxEnable  => "boolean",
355     CgiNavBarLinks      => {
356             type    => "list",
357             emptyOk => 1,
358             child   => {
359                 type => "hash",
360                 noKeyEdit => 1,
361                 child => {
362                     link  => "string",
363                     lname => {type => "string", undefIfEmpty => 1},
364                     name  => {type => "string", undefIfEmpty => 1},
365                 },
366             },
367     },
368     CgiStatusHilightColor => {
369             type => "hash",
370             noKeyEdit => 1,
371             child => {
372                 Reason_backup_failed           => "string",
373                 Reason_backup_done             => "string",
374                 Reason_no_ping                 => "string",
375                 Reason_backup_canceled_by_user => "string",
376                 Status_backup_in_progress      => "string",
377                 Disabled_OnlyManualBackups     => "string", 
378                 Disabled_AllBackupsDisabled    => "string",  
379             },
380     },
381     CgiHeaders          => "bigstring",
382     CgiImageDir         => "string",
383     CgiExt2ContentType  => {
384             type      => "hash",
385             emptyOk   => 1,
386             childType => "string",
387         },
388     CgiImageDirURL      => "string",
389     CgiCSSFile          => "string",
390     CgiUserConfigEditEnable => "boolean",
391     CgiUserConfigEdit   => {
392             type => "hash",
393             noKeyEdit => 1,
394             child => {
395                 FullPeriod                => "boolean",
396                 IncrPeriod                => "boolean",
397                 FullKeepCnt               => "boolean",
398                 FullKeepCntMin            => "boolean",
399                 FullAgeMax                => "boolean",
400                 IncrKeepCnt               => "boolean",
401                 IncrKeepCntMin            => "boolean",
402                 IncrAgeMax                => "boolean",
403                 IncrLevels                => "boolean",
404                 PartialAgeMax             => "boolean",
405                 IncrFill                  => "boolean",
406                 RestoreInfoKeepCnt        => "boolean",
407                 ArchiveInfoKeepCnt        => "boolean",
408                 BackupFilesOnly           => "boolean",
409                 BackupFilesExclude        => "boolean",
410                 BackupsDisable            => "boolean",
411                 BlackoutBadPingLimit      => "boolean",
412                 BlackoutGoodCnt           => "boolean",
413                 BlackoutPeriods           => "boolean",
414                 BackupZeroFilesIsFatal    => "boolean",
415                 XferMethod                => "boolean",
416                 XferLogLevel              => "boolean",
417                 ClientCharset             => "boolean",
418                 ClientCharsetLegacy       => "boolean",
419                 SmbShareName              => "boolean",
420                 SmbShareUserName          => "boolean",
421                 SmbSharePasswd            => "boolean",
422                 SmbClientFullCmd          => "boolean",
423                 SmbClientIncrCmd          => "boolean",
424                 SmbClientRestoreCmd       => "boolean",
425                 TarShareName              => "boolean",
426                 TarFullArgs               => "boolean",
427                 TarIncrArgs               => "boolean",
428                 TarClientCmd              => "boolean",
429                 TarClientPath             => "boolean",
430                 TarClientRestoreCmd       => "boolean",
431                 RsyncShareName            => "boolean",
432                 RsyncdClientPort          => "boolean",
433                 RsyncdUserName            => "boolean",
434                 RsyncdPasswd              => "boolean",
435                 RsyncdAuthRequired        => "boolean",
436                 RsyncCsumCacheVerifyProb  => "boolean",
437                 RsyncArgs                 => "boolean",
438                 RsyncRestoreArgs          => "boolean",
439                 RsyncClientCmd            => "boolean",
440                 RsyncClientPath           => "boolean",
441                 RsyncClientRestoreCmd     => "boolean",
442                 FtpShareName              => "boolean",
443                 FtpUserName               => "boolean",
444                 FtpPasswd                 => "boolean",
445                 FtpBlockSize              => "boolean",
446                 FtpPort                   => "boolean",
447                 FtpTimeout                => "boolean",
448                 ArchiveDest               => "boolean",
449                 ArchiveComp               => "boolean",
450                 ArchivePar                => "boolean",
451                 ArchiveSplit              => "boolean",
452                 ArchiveClientCmd          => "boolean",
453                 FixedIPNetBiosNameCheck   => "boolean",
454                 PingMaxMsec               => "boolean",
455                 NmbLookupCmd              => "boolean",
456                 NmbLookupFindHostCmd      => "boolean",
457                 PingCmd                   => "boolean",
458                 ClientTimeout             => "boolean",
459                 MaxOldPerPCLogFiles       => "boolean",
460                 CompressLevel             => "boolean",
461                 ClientNameAlias           => "boolean",
462                 DumpPreUserCmd            => "boolean",
463                 DumpPostUserCmd           => "boolean",
464                 RestorePreUserCmd         => "boolean",
465                 RestorePostUserCmd        => "boolean",
466                 ArchivePreUserCmd         => "boolean",
467                 ArchivePostUserCmd        => "boolean",
468                 DumpPostShareCmd          => "boolean",
469                 DumpPreShareCmd           => "boolean",
470                 UserCmdCheckStatus        => "boolean",
471                 EMailNotifyMinDays        => "boolean",
472                 EMailFromUserName         => "boolean",
473                 EMailAdminUserName        => "boolean",
474                 EMailUserDestDomain       => "boolean",
475                 EMailNoBackupEverSubj     => "boolean",
476                 EMailNoBackupEverMesg     => "boolean",
477                 EMailNotifyOldBackupDays  => "boolean",
478                 EMailNoBackupRecentSubj   => "boolean",
479                 EMailNoBackupRecentMesg   => "boolean",
480                 EMailNotifyOldOutlookDays => "boolean",
481                 EMailOutlookBackupSubj    => "boolean",
482                 EMailOutlookBackupMesg    => "boolean",
483                 EMailHeaders              => "boolean",
484             },
485     },
486
487     ######################################################################
488     # Fake config setting for editing the hosts
489     ######################################################################
490     Hosts => {
491             type    => "list",
492             emptyOk => 1,
493             child   => {
494                 type  => "horizHash",
495                 order => [qw(host dhcp user moreUsers)],
496                 noKeyEdit => 1,
497                 child => {
498                     host       => { type => "string", size => 20 },
499                     dhcp       => { type => "boolean"            },
500                     user       => { type => "string", size => 20 },
501                     moreUsers  => { type => "string", size => 30 },
502                 },
503             },
504     },
505 );
506
507 1;