e0923d23bd48c09534cead13d8a9532301f2d1e0
[BackupPC.git] / configure.pl
1 #!/usr/bin/env perl
2 #============================================================= -*-perl-*-
3 #
4 # configure.pl: Configuration and installation program for BackupPC
5 #
6 # DESCRIPTION
7 #
8 #   This script should be run as root:
9 #
10 #        perl configure.pl
11 #
12 #   To read about the command-line options for this configure script:
13 #
14 #        perldoc configure.pl
15 #
16 #   The installation steps are described as the script runs.
17 #
18 # AUTHOR
19 #   Craig Barratt <cbarratt@users.sourceforge.net>
20 #
21 # COPYRIGHT
22 #   Copyright (C) 2001-2007  Craig Barratt
23 #
24 #   This program is free software; you can redistribute it and/or modify
25 #   it under the terms of the GNU General Public License as published by
26 #   the Free Software Foundation; either version 2 of the License, or
27 #   (at your option) any later version.
28 #
29 #   This program is distributed in the hope that it will be useful,
30 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
31 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32 #   GNU General Public License for more details.
33 #
34 #   You should have received a copy of the GNU General Public License
35 #   along with this program; if not, write to the Free Software
36 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
37 #
38 #========================================================================
39 #
40 # Version 3.1.0beta0, released 3 Sep 2007.
41 #
42 # See http://backuppc.sourceforge.net.
43 #
44 #========================================================================
45
46 use strict;
47 no  utf8;
48 use vars qw(%Conf %OrigConf);
49 use lib "./lib";
50 use Encode;
51
52 my $EncodeVersion = eval($Encode::VERSION);
53 if ( $EncodeVersion < 1.99 ) {
54     print("Error: you need to upgrade perl's Encode package.\n"
55         . "I found $EncodeVersion and BackupPC needs >= 1.99\n"
56         . "Please go to www.cpan.org or use the cpan command.\n");
57     exit(1);
58 }
59
60 my @Packages = qw(File::Path File::Spec File::Copy DirHandle Digest::MD5
61                   Data::Dumper Getopt::Std Getopt::Long Pod::Usage
62                   BackupPC::Lib BackupPC::FileZIO);
63
64 foreach my $pkg ( @Packages ) {
65     eval "use $pkg";
66     next if ( !$@ );
67     if ( $pkg =~ /BackupPC/ ) {
68         die <<EOF;
69
70 Error loading $pkg: $@
71 BackupPC cannot load the package $pkg, which is included in the
72 BackupPC distribution.  This probably means you did not cd to the
73 unpacked BackupPC distribution before running configure.pl, eg:
74
75     cd BackupPC-__VERSION__
76     ./configure.pl
77
78 Please try again.
79
80 EOF
81     }
82     die <<EOF;
83
84 BackupPC needs the package $pkg.  Please install $pkg
85 before installing BackupPC.
86
87 EOF
88 }
89
90 my %opts;
91 $opts{"set-perms"} = 1;
92 if ( !GetOptions(
93             \%opts,
94             "batch",
95             "backuppc-user=s",
96             "bin-path=s%",
97             "cgi-dir=s",
98             "compress-level=i",
99             "config-path=s",
100             "config-override=s%",
101             "config-dir=s",
102             "data-dir=s",
103             "dest-dir=s",
104             "fhs!",
105             "help|?",
106             "hostname=s",
107             "html-dir=s",
108             "html-dir-url=s",
109             "install-dir=s",
110             "log-dir=s",
111             "man",
112             "set-perms!",
113             "uid-ignore!",
114         ) || @ARGV ) {
115     pod2usage(2);
116 }
117 pod2usage(1) if ( $opts{help} );
118 pod2usage(-exitstatus => 0, -verbose => 2) if $opts{man};
119
120 my $DestDir = $opts{"dest-dir"};
121 $DestDir = "" if ( $DestDir eq "/" );
122
123 if ( !$opts{"uid-ignore"} && $< != 0 ) {
124     print <<EOF;
125
126 This configure script should be run as root, rather than uid $<.
127 Provided uid $< has sufficient permissions to create the data and
128 install directories, then it should be ok to proceed.  Otherwise,
129 please quit and restart as root.
130
131 EOF
132     exit(1) if ( prompt("--> Do you want to continue?",
133                        "y") !~ /y/i );
134     exit(1) if ( $opts{batch} && !$opts{"uid-ignore"} );
135 }
136
137 #
138 # Whether we use the file system hierarchy conventions or not.
139 # Older versions did not.  BackupPC used to be installed in
140 # two main directories (in addition to CGI and html pages)
141 #
142 #    TopDir       which includes subdirs conf, log, pc, pool, cpool
143 #                
144 #    InstallDir   which includes subdirs bin, lib, doc
145 #
146 # With FHS enabled (which is the default for new installations)
147 # the config files move to /etc/BackupPC and log files to /var/log:
148 #
149 #    /etc/BackupPC/config.pl  main config file (was $TopDir/conf/config.pl)
150 #    /etc/BackupPC/hosts      hosts file (was $TopDir/conf/hosts)
151 #    /etc/BackupPC/pc/HOST.pl per-pc config file (was $TopDir/pc/HOST/config.pl)
152 #    /var/log/BackupPC        log files (was $TopDir/log)
153 #    /var/log/BackupPC        Pid, status and email info (was $TopDir/log)
154 #
155
156 #
157 # Check if this is an upgrade, in which case read the existing
158 # config file to get all the defaults.
159 #
160 my $ConfigPath = "";
161 my $ConfigFileOK = 1;
162 while ( 1 ) {
163     if ( $ConfigFileOK && -f "/etc/BackupPC/config.pl" ) {
164         $ConfigPath = "/etc/BackupPC/config.pl";
165         $opts{fhs} = 1 if ( !defined($opts{fhs}) );
166         print <<EOF;
167
168 Found /etc/BackupPC/config.pl, so this is an upgrade of an
169 existing BackupPC installation.  We will verify some existing
170 information, but you will probably not need to make any
171 changes - just hit ENTER to each question.
172 EOF
173     } else {
174         print <<EOF;
175
176 Is this a new installation or upgrade for BackupPC?  If this is
177 an upgrade please tell me the full path of the existing BackupPC
178 configuration file (eg: /etc/BackupPC/config.pl).  Otherwise, just
179 hit return.
180
181 EOF
182         $ConfigPath = prompt("--> Full path to existing main config.pl",
183                              $ConfigPath,
184                              "config-path");
185     }
186     last if ( $ConfigPath eq ""
187             || ($ConfigPath =~ /^\// && -f $ConfigPath && -w $ConfigPath) );
188     my $problem = "is not an absolute path";
189     $problem = "is not writable"        if ( !-w $ConfigPath );
190     $problem = "is not readable"        if ( !-r $ConfigPath );
191     $problem = "is not a regular file"  if ( !-f $ConfigPath );
192     $problem = "doesn't exist"          if ( !-e $ConfigPath );
193     print("The file '$ConfigPath' $problem.\n");
194     if ( $opts{batch} ) {
195         print("Need to specify a valid --config-path for upgrade\n");
196         exit(1);
197     }
198     $ConfigFileOK = 0;
199 }
200 $opts{fhs} = 1 if ( !defined($opts{fhs}) && $ConfigPath eq "" );
201 $opts{fhs} = 0 if ( !defined($opts{fhs}) );
202
203 my $bpc;
204 if ( $ConfigPath ne "" && -r $ConfigPath ) {
205     (my $confDir = $ConfigPath) =~ s{/[^/]+$}{};
206     die("BackupPC::Lib->new failed\n")
207             if ( !($bpc = BackupPC::Lib->new(".", ".", $confDir, 1)) );
208     %Conf = $bpc->Conf();
209     %OrigConf = %Conf;
210     if ( !$opts{fhs} ) {
211         ($Conf{TopDir} = $ConfigPath) =~ s{/[^/]+/[^/]+$}{}
212                     if ( $Conf{TopDir} eq '' );
213         $bpc->{LogDir} = $Conf{LogDir}  = "$Conf{TopDir}/log"
214                     if ( $Conf{LogDir} eq '' );
215     }
216     $bpc->{ConfDir} = $Conf{ConfDir} = $confDir;
217     my $err = $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPort}, 1);
218     if ( $err eq "" ) {
219         print <<EOF;
220
221 BackupPC is running on $Conf{ServerHost}.  You need to stop BackupPC
222 before you can upgrade the code.  Depending upon your installation,
223 you could run "/etc/init.d/backuppc stop".
224
225 EOF
226         exit(1);
227     }
228 }
229
230 #
231 # Create defaults for FHS setup
232 #
233 if ( $opts{fhs} ) {
234     $Conf{TopDir}       ||= $opts{"data-dir"}    || "/data/BackupPC";
235     $Conf{ConfDir}      ||= $opts{"config-dir"}  || "/etc/BackupPC";
236     $Conf{InstallDir}   ||= $opts{"install-dir"} || "/usr/local/BackupPC";
237     $Conf{LogDir}       ||= $opts{"log-dir"}     || "/var/log/BackupPC";
238 } else {
239     $Conf{TopDir}       ||= $opts{"data-dir"}    || "/data/BackupPC";
240     $Conf{ConfDir}      ||= $opts{"config-dir"}  || "$Conf{TopDir}/conf";
241     $Conf{InstallDir}   ||= $opts{"install-dir"} || "/usr/local/BackupPC";
242     $Conf{LogDir}       ||= $opts{"log-dir"}     || "$Conf{TopDir}/log";
243 }
244
245 #
246 # These are the programs whose paths we need to find
247 #
248 my %Programs = (
249     perl           => "PerlPath",
250     'gtar/tar'     => "TarClientPath",
251     smbclient      => "SmbClientPath",
252     nmblookup      => "NmbLookupPath",
253     rsync          => "RsyncClientPath",
254     ping           => "PingPath",
255     df             => "DfPath",
256     'ssh/ssh2'     => "SshPath",
257     sendmail       => "SendmailPath",
258     hostname       => "HostnamePath",
259     split          => "SplitPath",
260     par2           => "ParPath",
261     cat            => "CatPath",
262     gzip           => "GzipPath",
263     bzip2          => "Bzip2Path",
264 );
265
266 foreach my $prog ( sort(keys(%Programs)) ) {
267     my $path;
268     foreach my $subProg ( split(/\//, $prog) ) {
269         $path = FindProgram("$ENV{PATH}:/bin:/usr/bin:/sbin:/usr/sbin",
270                             $subProg) if ( !length($path) );
271     }
272     $Conf{$Programs{$prog}} = $path if ( !length($Conf{$Programs{$prog}}) );
273 }
274
275 while ( 1 ) {
276     print <<EOF;
277
278 I found the following locations for these programs:
279
280 EOF
281     foreach my $prog ( sort(keys(%Programs)) ) {
282         printf("    %-12s => %s\n", $prog, $Conf{$Programs{$prog}});
283     }
284     print "\n";
285     last if (prompt('--> Are these paths correct?', 'y') =~ /^y/i);
286     foreach my $prog ( sort(keys(%Programs)) ) {
287         $Conf{$Programs{$prog}} = prompt("--> $prog path",
288                                          $Conf{$Programs{$prog}});
289     }
290 }
291
292 my $Perl58 = system($Conf{PerlPath}
293                         . q{ -e 'exit($^V && $^V ge v5.8.0 ? 1 : 0);'});
294
295 if ( !$Perl58 ) {
296     print <<EOF;
297
298 BackupPC needs perl version 5.8.0 or later.  $Conf{PerlPath} appears
299 to be an older version.  Please upgrade to a newer version of perl
300 and re-run this configure script.
301
302 EOF
303     exit(1);
304 }
305
306 print <<EOF;
307
308 Please tell me the hostname of the machine that BackupPC will run on.
309
310 EOF
311 chomp($Conf{ServerHost} = `$Conf{HostnamePath}`)
312         if ( defined($Conf{HostnamePath}) && !defined($Conf{ServerHost}) );
313 $Conf{ServerHost} = prompt("--> BackupPC will run on host",
314                            $Conf{ServerHost},
315                            "hostname");
316
317 print <<EOF;
318
319 BackupPC should run as a dedicated user with limited privileges.  You
320 need to create a user.  This user will need read/write permission on
321 the main data directory and read/execute permission on the install
322 directory (these directories will be setup shortly).
323
324 The primary group for this user should also be chosen carefully.
325 The data directories and files will have group read permission,
326 so group members can access backup files.
327
328 EOF
329 my($name, $passwd, $Uid, $Gid);
330 while ( 1 ) {
331     $Conf{BackupPCUser} = prompt("--> BackupPC should run as user",
332                                  $Conf{BackupPCUser} || "backuppc",
333                                  "backuppc-user");
334     if ( $opts{"set-perms"} ) {
335         ($name, $passwd, $Uid, $Gid) = getpwnam($Conf{BackupPCUser});
336         last if ( $name ne "" );
337         print <<EOF;
338
339 getpwnam() says that user $Conf{BackupPCUser} doesn't exist.  Please
340 check the name and verify that this user is in the passwd file.
341
342 EOF
343         exit(1) if ( $opts{batch} );
344     } else {
345         last;
346     }
347 }
348
349 print <<EOF;
350
351 Please specify an install directory for BackupPC.  This is where the
352 BackupPC scripts, library and documentation will be installed.
353
354 EOF
355
356 while ( 1 ) {
357     $Conf{InstallDir} = prompt("--> Install directory (full path)",
358                                $Conf{InstallDir},
359                                "install-dir");
360     last if ( $Conf{InstallDir} =~ /^\// );
361     if ( $opts{batch} ) {
362         print("Need to specify --install-dir for new installation\n");
363         exit(1);
364     }
365 }
366
367 print <<EOF;
368
369 Please specify a data directory for BackupPC.  This is where all the
370 PC backup data is stored.  This file system needs to be big enough to
371 accommodate all the PCs you expect to backup (eg: at least several GB
372 per machine).
373
374 EOF
375
376 while ( 1 ) {
377     $Conf{TopDir} = prompt("--> Data directory (full path)",
378                            $Conf{TopDir},
379                            "data-dir");
380     last if ( $Conf{TopDir} =~ /^\// );
381     if ( $opts{batch} ) {
382         print("Need to specify --data-dir for new installation\n");
383         exit(1);
384     }
385 }
386
387 $Conf{CompressLevel} = $opts{"compress-level"}
388                             if ( defined($opts{"compress-level"}) );
389
390 if ( !defined($Conf{CompressLevel}) ) {
391     $Conf{CompressLevel} = BackupPC::FileZIO->compOk ? 3 : 0;
392     if ( $ConfigPath eq "" && $Conf{CompressLevel} ) {
393         print <<EOF;
394
395 BackupPC can compress pool files, providing around a 40% reduction in pool
396 size (your mileage may vary). Specify the compression level (0 turns
397 off compression, and 1 to 9 represent good/fastest to best/slowest).
398 The recommended values are 0 (off) or 3 (reasonable compression and speed).
399 Increasing the compression level to 5 will use around 20% more cpu time
400 and give perhaps 2-3% more compression.
401
402 EOF
403     } elsif ( $ConfigPath eq "" ) {
404         print <<EOF;
405
406 BackupPC can compress pool files, but it needs the Compress::Zlib
407 package installed (see www.cpan.org). Compression will provide around a
408 40% reduction in pool size, at the expense of cpu time.  You can leave
409 compression off and run BackupPC without compression, in which case you
410 should leave the compression level at 0 (which means off).  You could
411 install Compress::Zlib and turn compression on later, but read the
412 documentation first about how to do this.  Or the better choice is
413 to quit, install Compress::Zlib, and re-run configure.pl.
414
415 EOF
416     } elsif ( $Conf{CompressLevel} ) {
417         $Conf{CompressLevel} = 0;
418         print <<EOF;
419
420 BackupPC now supports pool file compression.  Since you are upgrading
421 BackupPC you probably have existing uncompressed backups.  You have
422 several choices if you want to turn on compression.  You can run
423 the script BackupPC_compressPool to convert everything to compressed
424 form.  Or you can simply turn on compression, so that new backups
425 will be compressed.  This will increase the pool storage requirement,
426 since both uncompressed and compressed copies of files will be stored.
427 But eventually the old uncompressed backups will expire, recovering
428 the pool storage.  Please see the documentation for more details.
429
430 If you are not sure what to do, leave the Compression Level at 0,
431 which disables compression.  You can always read the documentation
432 and turn it on later.
433
434 EOF
435     } else {
436         $Conf{CompressLevel} = 0;
437         print <<EOF;
438
439 BackupPC now supports pool file compression, but it needs the
440 Compress::Zlib module (see www.cpan.org).  For now, leave
441 the compression level set at 0 to disable compression.  If you
442 want you can install Compress::Zlib and turn compression on.
443 Please see the documentation for more details about converting
444 old backups to compressed form.
445
446 EOF
447     }
448     while ( 1 ) {
449         $Conf{CompressLevel}
450                     = prompt("--> Compression level", $Conf{CompressLevel});
451         last if ( $Conf{CompressLevel} =~ /^\d+$/ );
452     }
453 }
454
455 print <<EOF;
456
457 BackupPC has a powerful CGI perl interface that runs under Apache.
458 A single executable needs to be installed in a cgi-bin directory.
459 This executable needs to run as set-uid $Conf{BackupPCUser}, or
460 it can be run under mod_perl with Apache running as user $Conf{BackupPCUser}.
461
462 Leave this path empty if you don't want to install the CGI interface.
463
464 EOF
465
466 while ( 1 ) {
467     $Conf{CgiDir} = prompt("--> CGI bin directory (full path)",
468                            $Conf{CgiDir},
469                            "cgi-dir");
470     last if ( $Conf{CgiDir} =~ /^\// || $Conf{CgiDir} eq "" );
471     if ( $opts{batch} ) {
472         print("Need to specify --cgi-dir for new installation\n");
473         exit(1);
474     }
475 }
476
477 if ( $Conf{CgiDir} ne "" ) {
478
479     print <<EOF;
480
481 BackupPC's CGI script needs to display various GIF images that
482 should be stored where Apache can serve them.  They should be
483 placed somewhere under Apache's DocumentRoot.  BackupPC also
484 needs to know the URL to access these images.  Example:
485
486     Apache image directory:  /usr/local/apache/htdocs/BackupPC
487     URL for image directory: /BackupPC
488
489 The URL for the image directory should start with a slash.
490
491 EOF
492     while ( 1 ) {
493         $Conf{CgiImageDir} = prompt("--> Apache image directory (full path)",
494                                     $Conf{CgiImageDir},
495                                     "html-dir");
496         last if ( $Conf{CgiImageDir} =~ /^\// );
497         if ( $opts{batch} ) {
498             print("Need to specify --html-dir for new installation\n");
499             exit(1);
500         }
501     }
502     while ( 1 ) {
503         $Conf{CgiImageDirURL} = prompt("--> URL for image directory (omit http://host; starts with '/')",
504                                         $Conf{CgiImageDirURL},
505                                         "html-dir-url");
506         last if ( $Conf{CgiImageDirURL} =~ /^\// );
507         if ( $opts{batch} ) {
508             print("Need to specify --html-dir-url for new installation\n");
509             exit(1);
510         }
511     }
512 }
513
514 print <<EOF;
515
516 Ok, we're about to:
517
518   - install the binaries, lib and docs in $Conf{InstallDir},
519   - create the data directory $Conf{TopDir},
520   - create/update the config.pl file $Conf{ConfDir}/config.pl,
521   - optionally install the cgi-bin interface.
522
523 EOF
524
525 exit unless prompt("--> Do you want to continue?", "y") =~ /y/i;
526
527 #
528 # Create install directories
529 #
530 foreach my $dir ( qw(bin doc
531                      lib/BackupPC/CGI
532                      lib/BackupPC/Config
533                      lib/BackupPC/Lang
534                      lib/BackupPC/Storage
535                      lib/BackupPC/Xfer
536                      lib/BackupPC/Zip
537                      lib/Net/FTP
538                  ) ) {
539     next if ( -d "$DestDir$Conf{InstallDir}/$dir" );
540     mkpath("$DestDir$Conf{InstallDir}/$dir", 0, 0755);
541     if ( !-d "$DestDir$Conf{InstallDir}/$dir"
542             || !my_chown($Uid, $Gid, "$DestDir$Conf{InstallDir}/$dir") ) {
543         die("Failed to create or chown $DestDir$Conf{InstallDir}/$dir\n");
544     } else {
545         print("Created $DestDir$Conf{InstallDir}/$dir\n");
546     }
547 }
548
549 #
550 # Create CGI image directory
551 #
552 foreach my $dir ( ($Conf{CgiImageDir}) ) {
553     next if ( $dir eq "" || -d "$DestDir$dir" );
554     mkpath("$DestDir$dir", 0, 0755);
555     if ( !-d "$DestDir$dir" || !my_chown($Uid, $Gid, "$DestDir$dir") ) {
556         die("Failed to create or chown $DestDir$dir");
557     } else {
558         print("Created $DestDir$dir\n");
559     }
560 }
561
562 #
563 # Create other directories
564 #
565 foreach my $dir ( (
566             "$Conf{TopDir}",
567             "$Conf{TopDir}/pool",
568             "$Conf{TopDir}/cpool",
569             "$Conf{TopDir}/pc",
570             "$Conf{TopDir}/trash",
571             "$Conf{ConfDir}",
572             "$Conf{LogDir}",
573         ) ) {
574     mkpath("$DestDir$dir", 0, 0750) if ( !-d "$DestDir$dir" );
575     if ( !-d "$DestDir$dir"
576             || !my_chown($Uid, $Gid, "$DestDir$dir") ) {
577         die("Failed to create or chown $DestDir$dir\n");
578     } else {
579         print("Created $DestDir$dir\n");
580     }
581 }
582
583 printf("Installing binaries in $DestDir$Conf{InstallDir}/bin\n");
584 foreach my $prog ( qw(
585         __CONFIGURE_BIN_LIST__
586     ) ) {
587     InstallFile($prog, "$DestDir$Conf{InstallDir}/$prog", 0555);
588 }
589
590 printf("Installing library in $DestDir$Conf{InstallDir}/lib\n");
591 foreach my $lib ( qw(
592         __CONFIGURE_LIB_LIST__
593     ) ) {
594     InstallFile($lib, "$DestDir$Conf{InstallDir}/$lib", 0444);
595 }
596
597 if ( $Conf{CgiImageDir} ne "" ) {
598     printf("Installing images in $DestDir$Conf{CgiImageDir}\n");
599     foreach my $img ( <images/*> ) {
600         (my $destImg = $img) =~ s{^images/}{};
601         InstallFile($img, "$DestDir$Conf{CgiImageDir}/$destImg", 0444, 1);
602     }
603
604     #
605     # Install new CSS file, making a backup copy if necessary
606     #
607     my $cssBackup = "$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css.pre-__VERSION__";
608     if ( -f "$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css" && !-f $cssBackup ) {
609         rename("$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css", $cssBackup);
610     }
611     InstallFile("conf/BackupPC_stnd.css",
612                 "$DestDir$Conf{CgiImageDir}/BackupPC_stnd.css", 0444, 0);
613     InstallFile("conf/BackupPC_stnd_orig.css",
614                 "$DestDir$Conf{CgiImageDir}/BackupPC_stnd_orig.css", 0444, 0);
615     InstallFile("conf/sorttable.js",
616                 "$DestDir$Conf{CgiImageDir}/sorttable.js", 0444, 0);
617 }
618
619 printf("Making init.d scripts\n");
620 foreach my $init ( qw(gentoo-backuppc gentoo-backuppc.conf linux-backuppc
621                       solaris-backuppc debian-backuppc freebsd-backuppc
622                       suse-backuppc slackware-backuppc ) ) {
623     InstallFile("init.d/src/$init", "init.d/$init", 0444);
624 }
625
626 printf("Making Apache configuration file for suid-perl\n");
627 InstallFile("httpd/src/BackupPC.conf", "httpd/BackupPC.conf", 0644);
628
629 printf("Installing docs in $DestDir$Conf{InstallDir}/doc\n");
630 foreach my $doc ( qw(BackupPC.pod BackupPC.html) ) {
631     InstallFile("doc/$doc", "$DestDir$Conf{InstallDir}/doc/$doc", 0444);
632 }
633
634 printf("Installing config.pl and hosts in $DestDir$Conf{ConfDir}\n");
635 InstallFile("conf/hosts", "$DestDir$Conf{ConfDir}/hosts", 0644)
636                     if ( !-f "$DestDir$Conf{ConfDir}/hosts" );
637
638 #
639 # Now do the config file.  If there is an existing config file we
640 # merge in the new config file, adding any new configuration
641 # parameters and deleting ones that are no longer needed.
642 #
643 my $dest = "$DestDir$Conf{ConfDir}/config.pl";
644 my ($distConf, $distVars) = ConfigParse("conf/config.pl");
645 my ($oldConf, $oldVars);
646 my ($newConf, $newVars) = ($distConf, $distVars);
647 if ( -f $dest ) {
648     ($oldConf, $oldVars) = ConfigParse($dest);
649     ($newConf, $newVars) = ConfigMerge($oldConf, $oldVars, $distConf, $distVars);
650 }
651
652 #
653 # Update various config parameters.  The old config is in Conf{}
654 # and the new config is an array in text form in $newConf->[].
655 #
656 $Conf{EMailFromUserName}  ||= $Conf{BackupPCUser};
657 $Conf{EMailAdminUserName} ||= $Conf{BackupPCUser};
658
659 #
660 # Guess $Conf{CgiURL}
661 #
662 if ( !defined($Conf{CgiURL}) ) {
663     if ( $Conf{CgiDir} =~ m{cgi-bin(/.*)} ) {
664         $Conf{CgiURL} = "'http://$Conf{ServerHost}/cgi-bin$1/BackupPC_Admin'";
665     } else {
666         $Conf{CgiURL} = "'http://$Conf{ServerHost}/cgi-bin/BackupPC_Admin'";
667     }
668 }
669
670 #
671 # The smbclient commands have moved from hard-coded to the config file.
672 # $Conf{SmbClientArgs} no longer exists, so merge it into the new
673 # commands if it still exists.
674 #
675 if ( defined($Conf{SmbClientArgs}) ) {
676     if ( $Conf{SmbClientArgs} ne "" ) {
677         foreach my $param ( qw(SmbClientRestoreCmd SmbClientFullCmd
678                                 SmbClientIncrCmd) ) {
679             $newConf->[$newVars->{$param}]{text}
680                             =~ s/(-E\s+-N)/$1 $Conf{SmbClientArgs}/;
681         }
682     }
683     delete($Conf{SmbClientArgs});
684 }
685
686 #
687 # CSS is now stored in a file rather than a big config variable.
688 #
689 delete($Conf{CSSstylesheet});
690
691 #
692 # The blackout timing settings are now stored in a list of hashes, rather
693 # than three scalar parameters.
694 #
695 if ( defined($Conf{BlackoutHourBegin}) ) {
696     $Conf{BlackoutPeriods} = [
697          {
698              hourBegin => $Conf{BlackoutHourBegin},
699              hourEnd   => $Conf{BlackoutHourEnd},
700              weekDays  => $Conf{BlackoutWeekDays},
701          } 
702     ];
703     delete($Conf{BlackoutHourBegin});
704     delete($Conf{BlackoutHourEnd});
705     delete($Conf{BlackoutWeekDays});
706 }
707
708 #
709 # $Conf{RsyncLogLevel} has been replaced by $Conf{XferLogLevel}
710 #
711 if ( defined($Conf{RsyncLogLevel}) ) {
712     $Conf{XferLogLevel} = $Conf{RsyncLogLevel};
713     delete($Conf{RsyncLogLevel});
714 }
715
716 #
717 # In 2.1.0 the default for $Conf{CgiNavBarAdminAllHosts} is now 1
718 #
719 $Conf{CgiNavBarAdminAllHosts} = 1;
720
721 #
722 # IncrFill should now be off
723 #
724 $Conf{IncrFill} = 0;
725
726 #
727 # Empty $Conf{ParPath} if it isn't a valid executable
728 # (pre-3.0.0 configure.pl incorrectly set it to a
729 # hardcoded value).
730 #
731 $Conf{ParPath} = '' if ( $Conf{ParPath} ne '' && !-x $Conf{ParPath} );
732
733 #
734 # Figure out sensible arguments for the ping command
735 #
736 if ( defined($Conf{PingArgs}) ) {
737     $Conf{PingCmd} = '$pingPath ' . $Conf{PingArgs};
738 } elsif ( !defined($Conf{PingCmd}) ) {
739     if ( $^O eq "solaris" || $^O eq "sunos" ) {
740         $Conf{PingCmd} = '$pingPath -s $host 56 1';
741     } elsif ( ($^O eq "linux" || $^O eq "openbsd" || $^O eq "netbsd")
742             && !system("$Conf{PingPath} -c 1 -w 3 localhost") ) {
743         $Conf{PingCmd} = '$pingPath -c 1 -w 3 $host';
744     } else {
745         $Conf{PingCmd} = '$pingPath -c 1 $host';
746     }
747     delete($Conf{PingArgs});
748 }
749
750 #
751 # Figure out sensible arguments for the df command
752 #
753 if ( !defined($Conf{DfCmd}) ) {
754     if ( $^O eq "solaris" || $^O eq "sunos" ) {
755         $Conf{DfCmd} = '$dfPath -k $topDir';
756     }
757 }
758
759 #
760 # $Conf{SmbClientTimeout} is now $Conf{ClientTimeout}
761 #
762 if ( defined($Conf{SmbClientTimeout}) ) {
763     $Conf{ClientTimeout} = $Conf{SmbClientTimeout};
764     delete($Conf{SmbClientTimeout});
765 }
766
767 #
768 # Replace --devices with -D in RsyncArgs and RsyncRestoreArgs
769 #
770 foreach my $param ( qw(RsyncArgs RsyncRestoreArgs) ) {
771     next if ( !defined($newVars->{$param}) );
772     $newConf->[$newVars->{$param}]{text} =~ s/--devices/-D/g;
773 }
774
775 #
776 # Merge any new user-editable parameters into CgiUserConfigEdit
777 # by copying the old settings forward.
778 #
779 if ( defined($Conf{CgiUserConfigEdit}) ) {
780     #
781     # This is a real hack.  The config file merging is done in text
782     # form without actually instantiating the new conf structure.
783     # So we need to extract the new hash of settings, update it,
784     # and merge the text.  Ugh...
785     #
786     my $new;
787     my $str = $distConf->[$distVars->{CgiUserConfigEdit}]{text};
788
789     $str =~ s/^\s*\$Conf\{.*?\}\s*=\s*/\$new = /m;
790     eval($str);
791     foreach my $p ( keys(%$new) ) {
792         $new->{$p} = $Conf{CgiUserConfigEdit}{$p}
793                 if ( defined($Conf{CgiUserConfigEdit}{$p}) );
794     }
795     $Conf{CgiUserConfigEdit} = $new;
796     my $d = Data::Dumper->new([$new], [*value]);
797     $d->Indent(1);
798     $d->Terse(1);
799     my $value = $d->Dump;
800     $value =~ s/(.*)\n/$1;\n/s;
801     $newConf->[$newVars->{CgiUserConfigEdit}]{text}
802             =~ s/(\s*\$Conf\{.*?\}\s*=\s*).*/$1$value/s;
803 }
804
805 #
806 # Apply any command-line configuration parameter settings
807 #
808 foreach my $param ( keys(%{$opts{"config-override"}}) ) {
809     my $val = eval { $opts{"config-override"}{$param} };
810     if ( @$ ) {
811         printf("Can't eval --config-override setting %s=%s\n",
812                         $param, $opts{"config-override"}{$param});
813         exit(1);
814     }
815     if ( !defined($newVars->{$param}) ) {
816         printf("Unkown config parameter %s in --config-override\n", $param);
817         exit(1);
818     }
819     $newConf->[$newVars->{$param}]{text} = $opts{"config-override"}{$param};
820 }
821
822 #
823 # Now backup and write the config file
824 #
825 my $confCopy = "$dest.pre-__VERSION__";
826 if ( -f $dest && !-f $confCopy ) {
827     #
828     # Make copy of config file, preserving ownership and modes
829     #
830     printf("Making backup copy of $dest -> $confCopy\n");
831     my @stat = stat($dest);
832     my $mode = $stat[2];
833     my $uid  = $stat[4];
834     my $gid  = $stat[5];
835     die("can't copy($dest, $confCopy)\n")
836                                 unless copy($dest, $confCopy);
837     die("can't chown $uid, $gid $confCopy\n")
838                                 unless my_chown($uid, $gid, $confCopy);
839     die("can't chmod $mode $confCopy\n")
840                                 unless my_chmod($mode, $confCopy);
841 }
842 open(OUT, ">", $dest) || die("can't open $dest for writing\n");
843 binmode(OUT);
844 my $blockComment;
845 foreach my $var ( @$newConf ) {
846     if ( length($blockComment)
847           && substr($var->{text}, 0, length($blockComment)) eq $blockComment ) {
848         $var->{text} = substr($var->{text}, length($blockComment));
849         $blockComment = undef;
850     }
851     $blockComment = $1 if ( $var->{text} =~ /^([\s\n]*#{70}.*#{70}[\s\n]+)/s );
852     $var->{text} =~ s/^\s*\$Conf\{(.*?)\}(\s*=\s*['"]?)(.*?)(['"]?\s*;)/
853                 defined($Conf{$1}) && ref($Conf{$1}) eq ""
854                                    && $Conf{$1} ne $OrigConf{$1}
855                                    ? "\$Conf{$1}$2$Conf{$1}$4"
856                                    : "\$Conf{$1}$2$3$4"/emg;
857     print OUT $var->{text};
858 }
859 close(OUT);
860 if ( !defined($oldConf) ) {
861     die("can't chmod 0640 mode $dest\n")  unless my_chmod(0640, $dest);
862     die("can't chown $Uid, $Gid $dest\n") unless my_chown($Uid, $Gid, $dest);
863 }
864
865 if ( $Conf{CgiDir} ne "" ) {
866     printf("Installing cgi script BackupPC_Admin in $DestDir$Conf{CgiDir}\n");
867     mkpath("$DestDir$Conf{CgiDir}", 0, 0755);
868     InstallFile("cgi-bin/BackupPC_Admin", "$DestDir$Conf{CgiDir}/BackupPC_Admin",
869                 04554);
870 }
871
872 print <<EOF;
873
874 Ok, it looks like we are finished.  There are several more things you
875 will need to do:
876
877   - Browse through the config file, $Conf{ConfDir}/config.pl,
878     and make sure all the settings are correct.  In particular,
879     you will need to set \$Conf{CgiAdminUsers} so you have
880     administration privileges in the CGI interface.
881
882   - Edit the list of hosts to backup in $Conf{ConfDir}/hosts.
883
884   - Read the documentation in $Conf{InstallDir}/doc/BackupPC.html.
885     Please pay special attention to the security section.
886
887   - Verify that the CGI script BackupPC_Admin runs correctly.  You might
888     need to change the permissions or group ownership of BackupPC_Admin.
889     If this is an upgrade and you are using mod_perl, you will need
890     to restart Apache.  Otherwise it will have stale code.
891
892   - BackupPC should be ready to start.  Don't forget to run it
893     as user $Conf{BackupPCUser}!  The installation also contains an
894     init.d/backuppc script that can be copied to /etc/init.d
895     so that BackupPC can auto-start on boot.  This will also enable
896     administrative users to start the server from the CGI interface.
897     See init.d/README.
898
899 Enjoy!
900 EOF
901
902 if ( `$Conf{PerlPath} -V` =~ /uselargefiles=undef/ ) {
903     print <<EOF;
904
905 Warning: your perl, $Conf{PerlPath}, does not support large files.
906 This means BackupPC won't be able to backup files larger than 2GB.
907 To solve this problem you should build/install a new version of perl
908 with large file support enabled.  Use
909
910     $Conf{PerlPath} -V | egrep uselargefiles
911
912 to check if perl has large file support (undef means no support).
913 EOF
914 }
915
916 eval "use File::RsyncP;";
917 if ( !$@ && $File::RsyncP::VERSION < 0.68 ) {
918     print("\nWarning: you need to upgrade File::RsyncP;"
919         . " I found $File::RsyncP::VERSION and BackupPC needs 0.68\n");
920 }
921
922 exit(0);
923
924 ###########################################################################
925 # Subroutines
926 ###########################################################################
927
928 sub InstallFile
929 {
930     my($prog, $dest, $mode, $binary) = @_;
931     my $first = 1;
932     my($uid, $gid) = ($Uid, $Gid);
933
934     if ( -f $dest ) {
935         #
936         # preserve ownership and modes of files that already exist
937         #
938         my @stat = stat($dest);
939         $mode = $stat[2];
940         $uid  = $stat[4];
941         $gid  = $stat[5];
942     }
943     unlink($dest) if ( -f $dest );
944     if ( $binary ) {
945         die("can't copy($prog, $dest)\n") unless copy($prog, $dest);
946     } else {
947         open(PROG, $prog)     || die("can't open $prog for reading\n");
948         open(OUT, ">", $dest) || die("can't open $dest for writing\n");
949         binmode(PROG);
950         binmode(OUT);
951         while ( <PROG> ) {
952             s/__INSTALLDIR__/$Conf{InstallDir}/g;
953             s/__LOGDIR__/$Conf{LogDir}/g;
954             s/__CONFDIR__/$Conf{ConfDir}/g;
955             s/__TOPDIR__/$Conf{TopDir}/g;
956             s/^(\s*my \$useFHS\s*=\s*)\d;/${1}$opts{fhs};/
957                                     if ( $prog =~ /Lib.pm/ );
958             s/__BACKUPPCUSER__/$Conf{BackupPCUser}/g;
959             s/__CGIDIR__/$Conf{CgiDir}/g;
960             s/__IMAGEDIR__/$Conf{CgiImageDir}/g;
961             s/__IMAGEDIRURL__/$Conf{CgiImageDirURL}/g;
962             if ( $first && /^#.*bin\/perl/ ) {
963                 #
964                 # Fill in correct path to perl (no taint for >= 2.0.1).
965                 #
966                 print OUT "#!$Conf{PerlPath}\n";
967             } else {
968                 print OUT;
969             }
970             $first = 0;
971         }
972         close(PROG);
973         close(OUT);
974     }
975     die("can't chown $uid, $gid $dest") unless my_chown($uid, $gid, $dest);
976     die("can't chmod $mode $dest")      unless my_chmod($mode, $dest);
977 }
978
979 sub FindProgram
980 {
981     my($path, $prog) = @_;
982
983     if ( defined($opts{"bin-path"}{$prog}) ) {
984         return $opts{"bin-path"}{$prog};
985     }
986     foreach my $dir ( split(/:/, $path) ) {
987         my $file = File::Spec->catfile($dir, $prog);
988         return $file if ( -x $file );
989     }
990     return;
991 }
992
993 sub ConfigParse
994 {
995     my($file) = @_;
996     open(C, $file) || die("can't open $file");
997     binmode(C);
998     my($out, @conf, $var);
999     my $comment = 1;
1000     my $allVars = {};
1001     my $endLine = undef;
1002     while ( <C> ) {
1003         if ( /^#/ && !defined($endLine) ) {
1004             if ( $comment ) {
1005                 $out .= $_;
1006             } else {
1007                 if ( $out ne "" ) {
1008                     $allVars->{$var} = @conf if ( defined($var) );
1009                     push(@conf, {
1010                         text => $out,
1011                         var => $var,
1012                     });
1013                 }
1014                 $var = undef;
1015                 $comment = 1;
1016                 $out = $_;
1017             }
1018         } elsif ( /^\s*\$Conf\{([^}]*)/ ) {
1019             $comment = 0;
1020             if ( defined($var) ) {
1021                 $allVars->{$var} = @conf if ( defined($var) );
1022                 push(@conf, {
1023                     text => $out,
1024                     var => $var,
1025                 });
1026                 $out = $_;
1027             } else {
1028                 $out .= $_;
1029             }
1030             $var = $1;
1031             $endLine = $1 if ( /^\s*\$Conf\{[^}]*} *= *<<(.*);/ );
1032             $endLine = $1 if ( /^\s*\$Conf\{[^}]*} *= *<<'(.*)';/ );
1033         } else {
1034             $endLine = undef if ( defined($endLine) && /^\Q$endLine[\n\r]*$/ );
1035             $out .= $_;
1036         }
1037     }
1038     if ( $out ne "" ) {
1039         $allVars->{$var} = @conf if ( defined($var) );
1040         push(@conf, {
1041             text => $out,
1042             var  => $var,
1043         });
1044     }
1045     close(C);
1046     return (\@conf, $allVars);
1047 }
1048
1049 sub ConfigMerge
1050 {
1051     my($old, $oldVars, $new, $newVars) = @_;
1052     my $posn = 0;
1053     my($res, $resVars);
1054
1055     #
1056     # Find which config parameters are not needed any longer
1057     #
1058     foreach my $var ( @$old ) {
1059         next if ( !defined($var->{var}) || defined($newVars->{$var->{var}}) );
1060         #print(STDERR "Deleting old config parameter $var->{var}\n");
1061         $var->{delete} = 1;
1062     }
1063     #
1064     # Find which config parameters are new
1065     #
1066     foreach my $var ( @$new ) {
1067         next if ( !defined($var->{var}) );
1068         if ( defined($oldVars->{$var->{var}}) ) {
1069             $posn = $oldVars->{$var->{var}};
1070         } else {
1071             #print(STDERR "New config parameter $var->{var}: $var->{text}\n");
1072             push(@{$old->[$posn]{new}}, $var);
1073         }
1074     }
1075     #
1076     # Create merged config file
1077     #
1078     foreach my $var ( @$old ) {
1079         next if ( $var->{delete} );
1080         push(@$res, $var);
1081         foreach my $new ( @{$var->{new}} ) {
1082             push(@$res, $new);
1083         }
1084     }
1085     for ( my $i = 0 ; $i < @$res ; $i++ ) {
1086         $resVars->{$res->[$i]{var}} = $i;
1087     }
1088     return ($res, $resVars);
1089 }
1090
1091 sub my_chown
1092 {
1093     my($uid, $gid, $file) = @_;
1094
1095     return 1 if ( !$opts{"set-perms"} );
1096     return chown($uid, $gid, $file);
1097 }
1098
1099 sub my_chmod
1100 {
1101     my ($mode, $file) = @_;
1102
1103     return 1 if ( !$opts{"set-perms"} );
1104     return chmod($mode, $file);
1105 }
1106
1107 sub prompt
1108 {
1109     my($question, $default, $option) = @_;
1110
1111     $default = $opts{$option} if ( defined($opts{$option}) );
1112     if ( $opts{batch} ) {
1113         print("$question [$default]\n");
1114         return $default;
1115     }
1116     print("$question [$default]? ");
1117     my $reply = <STDIN>;
1118     $reply =~ s/[\n\r]*//g;
1119     return $reply if ( $reply !~ /^$/ );
1120     return $default;
1121 }
1122
1123 __END__
1124
1125 =head1 SYNOPSIS
1126
1127 configure.pl [options]
1128
1129 =head1 DESCRIPTION
1130
1131 configure.pl is a script that is used to install or upgrade a BackupPC
1132 installation.  It is usually run interactively without arguments.  It
1133 also supports a batch mode where all the options can be specified
1134 via the command-line.
1135
1136 For upgrading BackupPC you need to make sure that BackupPC is not
1137 running prior to running BackupPC.
1138
1139 Typically configure.pl needs to run as the super user (root).
1140
1141 =head1 OPTIONS
1142
1143 =over 8
1144
1145 =item B<--batch>
1146
1147 Run configure.pl in batch mode.  configure.pl will run without
1148 prompting the user.  The other command-line options are used
1149 to specify the settings that the user is usually prompted for.
1150
1151 =item B<--backuppc-user=USER>
1152
1153 Specify the BackupPC user name that owns all the BackupPC
1154 files and runs the BackupPC programs.  Default is backuppc.
1155
1156 =item B<--bin-path PROG=PATH>
1157
1158 Specify the path for various external programs that BackupPC
1159 uses.  Several --bin-path options may be specified.  configure.pl
1160 usually finds sensible defaults based on searching the PATH.
1161 The format is:
1162
1163     --bin-path PROG=PATH
1164
1165 where PROG is one of perl, tar, smbclient, nmblookup, rsync, ping,
1166 df, ssh, sendmail, hostname, split, par2, cat, gzip, bzip2 and
1167 PATH is that full path to that program.
1168
1169 Examples
1170
1171     --bin-path cat=/bin/cat --bin-path bzip2=/home/user/bzip2
1172
1173 =item B<--compress-level=N>
1174
1175 Set the configuration compression level to N.  Default is 3
1176 if Compress::Zlib is installed.
1177
1178 =item B<--config-dir CONFIG_DIR>
1179
1180 Configuration directory for new installations.  Defaults
1181 to /etc/BackupPC with FHS.  Automatically extracted
1182 from --config-path for existing installations.
1183
1184 =item B<--config-path CONFIG_PATH>
1185
1186 Path to the existing config.pl configuration file for BackupPC.
1187 This option should be specified for batch upgrades to an
1188 existing installation.  The option should be omitted when
1189 doing a batch new install.
1190
1191 =item B<--cgi-dir CGI_DIR>
1192
1193 Path to Apache's cgi-bin directory where the BackupPC_Admin
1194 script will be installed.  This option only needs to be
1195 specified for a batch new install.
1196
1197 =item B<--data-dir DATA_DIR>
1198
1199 Path to the BackupPC data directory.  This is where all the backup
1200 data is stored, and it should be on a large file system. This option
1201 only needs to be specified for a batch new install.
1202
1203 Example:
1204
1205     --data-dir /data/BackupPC
1206
1207 =item B<--dest-dir DEST_DIR>
1208
1209 An optional prefix to apply to all installation directories.
1210 Usually this is not needed, but certain auto-installers like
1211 to stage an install in a temporary directory, and then copy
1212 the files to their real destination.  This option can be used
1213 to specify the temporary directory prefix.  Note that if you
1214 specify this option, BackupPC won't run correctly if you try
1215 to run it from below the --dest-dir directory, since all the
1216 paths are set assuming BackupPC is installed in the intended
1217 final locations.
1218
1219 =item B<--fhs>
1220
1221 Use locations specified by the Filesystem Hierarchy Standard
1222 for installing BackupPC.  This is enabled by default for new
1223 installations.  To use the pre-3.0 installation locations,
1224 specify --no-fhs.
1225
1226 =item B<--help|?>
1227
1228 Print a brief help message and exits.
1229
1230 =item B<--hostname HOSTNAME>
1231
1232 Host name (this machine's name) on which BackupPC is being installed.
1233 This option only needs to be specified for a batch new install.
1234
1235 =item B<--html-dir HTML_DIR>
1236
1237 Path to an Apache html directory where various BackupPC image files
1238 and the CSS files will be installed.  This is typically a directory
1239 below Apache's DocumentRoot directory.  This option only needs to be
1240 specified for a batch new install.
1241
1242 Example:
1243
1244     --html-dir /usr/local/apache/htdocs/BackupPC
1245
1246 =item B<--html-dir-url URL>
1247
1248 The URL (without http://hostname) required to access the BackupPC html
1249 directory specified with the --html-dir option.  This option only needs
1250 to be specified for a batch new install.
1251
1252 Example:
1253
1254     --html-dir-url /BackupPC
1255
1256 =item B<--install-dir INSTALL_DIR>
1257
1258 Installation directory for BackupPC scripts, libraries, and
1259 documentation.  This option only needs to be specified for a
1260 batch new install.
1261
1262 Example:
1263
1264     --install-dir /usr/local/BackupPC
1265
1266 =item B<--log-dir LOG_DIR>
1267
1268 Log directory.  Defaults to /var/log/BackupPC with FHS.
1269
1270 =item B<--man>
1271
1272 Prints the manual page and exits.
1273
1274 =item B<--set-perms>
1275
1276 When installing files and creating directories, chown them to
1277 the BackupPC user and chmod them too.  This is enabled by default.
1278 To disable (for example, if staging a destination directory)
1279 then specify --no-set-perms.
1280
1281 =item B<--uid-ignore>
1282
1283 configure.pl verifies that the script is being run as the super user
1284 (root).  Without the --uid-ignore option, in batch mode the script will
1285 exit with an error if not run as the super user, and in interactive mode
1286 the user will be prompted.  Specifying this option will cause the script
1287 to continue even if the user id is not root.
1288
1289 =head1 EXAMPLES
1290
1291 For a standard interactive install, run without arguments:
1292
1293     configure.pl
1294
1295 For a batch new install you need to specify answers to all the
1296 questions that are normally prompted:
1297
1298     configure.pl                                   \
1299         --batch                                    \
1300         --cgi-dir /var/www/cgi-bin/BackupPC        \
1301         --data-dir /data/BackupPC                  \
1302         --hostname myHost                          \
1303         --html-dir /var/www/html/BackupPC          \
1304         --html-dir-url /BackupPC                   \
1305         --install-dir /usr/local/BackupPC
1306
1307 For a batch upgrade, you only need to specify the path to the
1308 configuration file:
1309         
1310     configure.pl --batch --config-path /data/BackupPC/conf/config.pl
1311
1312 =head1 AUTHOR
1313
1314 Craig Barratt <cbarratt@users.sourceforge.net>
1315
1316 =head1 COPYRIGHT
1317
1318 Copyright (C) 2001-2007  Craig Barratt.
1319
1320 This program is free software; you can redistribute it and/or modify
1321 it under the terms of the GNU General Public License as published by
1322 the Free Software Foundation; either version 2 of the License, or
1323 (at your option) any later version.
1324
1325 =cut