# Craig Barratt <cbarratt@users.sourceforge.net>
#
# COPYRIGHT
-# Copyright (C) 2001-2004 Craig Barratt
+# Copyright (C) 2001-2006 Craig Barratt
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
#
#========================================================================
#
-# Version 2.1.0beta1, released 9 Apr 2004.
+# Version 3.0.0alpha, released 23 Jan 2006
#
# See http://backuppc.sourceforge.net.
#
}
my %opts;
-$opts{fhs} = 1;
$opts{"set-perms"} = 1;
-$opts{"backuppc-user"} = "backuppc";
if ( !GetOptions(
\%opts,
"batch",
#
# InstallDir which includes subdirs bin, lib, doc
#
-# With FSH enabled (which is the default for new installations):
+# With FHS enabled (which is the default for new installations)
+# the config files move to /etc/BackupPC and log files to /var/log:
#
# /etc/BackupPC/config.pl main config file (was $TopDir/conf/config.pl)
# /etc/BackupPC/hosts hosts file (was $TopDir/conf/hosts)
# /etc/BackupPC/pc/HOST.pl per-pc config file (was $TopDir/pc/HOST/config.pl)
# /var/log/BackupPC log files (was $TopDir/log)
-# /var/lib/BackupPC Pid, status and email info (was $TopDir/log)
+# /var/log/BackupPC Pid, status and email info (was $TopDir/log)
#
print <<EOF if ( !$opts{fhs} || !-f "/etc/BackupPC/config.pl" );
#
my $ConfigPath = "";
while ( 1 ) {
- if ( $opts{fhs} && -f "/etc/BackupPC/config.pl" ) {
+ if ( -f "/etc/BackupPC/config.pl" ) {
$ConfigPath = "/etc/BackupPC/config.pl";
+ $opts{fhs} = 1 if ( !defined($opts{fhs}) );
} else {
$ConfigPath = prompt("--> Full path to existing main config.pl",
$ConfigPath,
"config-path");
}
last if ( $ConfigPath eq ""
- || ($ConfigPath =~ /^\// && -r $ConfigPath && -w $ConfigPath) );
+ || ($ConfigPath =~ /^\// && -f $ConfigPath && -w $ConfigPath) );
my $problem = "is not an absolute path";
$problem = "is not writable" if ( !-w $ConfigPath );
$problem = "is not readable" if ( !-r $ConfigPath );
exit(1);
}
}
+$opts{fhs} = 1 if ( !defined($opts{fhs}) && $ConfigPath eq "" );
+$opts{fhs} = 0 if ( !defined($opts{fhs}) );
my $bpc;
if ( $ConfigPath ne "" && -r $ConfigPath ) {
%Conf = $bpc->Conf();
%OrigConf = %Conf;
if ( !$opts{fhs} ) {
- ($Conf{TopDir} = $ConfigPath) =~ s{/[^/]+/[^/]+$}{};
+ ($Conf{TopDir} = $ConfigPath) =~ s{/[^/]+/[^/]+$}{}
+ if ( $Conf{TopDir} eq '' );
+ $bpc->{LogDir} = $Conf{LogDir} = "$Conf{TopDir}/log"
+ if ( $Conf{LogDir} eq '' );
}
- $Conf{ConfDir} = $confDir;
+ $bpc->{ConfDir} = $Conf{ConfDir} = $confDir;
my $err = $bpc->ServerConnect($Conf{ServerHost}, $Conf{ServerPort}, 1);
if ( $err eq "" ) {
print <<EOF;
$Conf{ConfDir} ||= "/etc/BackupPC";
$Conf{InstallDir} ||= "/usr/local/BackupPC";
$Conf{LogDir} ||= "/var/log/BackupPC";
- $Conf{StatusDir} ||= "/var/lib/BackupPC";
}
#
#
foreach my $dir ( qw(bin doc
lib/BackupPC/CGI
+ lib/BackupPC/Config
lib/BackupPC/Lang
+ lib/BackupPC/Storage
lib/BackupPC/Xfer
lib/BackupPC/Zip
) ) {
"$Conf{TopDir}/trash",
"$Conf{ConfDir}",
"$Conf{LogDir}",
- "$Conf{StatusDir}",
) ) {
mkpath("$DestDir/$dir", 0, 0750) if ( !-d "$DestDir/$dir" );
if ( !-d "$DestDir/$dir"
}
printf("Installing binaries in $DestDir$Conf{InstallDir}/bin\n");
-foreach my $prog ( qw(BackupPC BackupPC_dump BackupPC_link BackupPC_nightly
- BackupPC_sendEmail BackupPC_tarCreate BackupPC_trashClean
- BackupPC_tarExtract BackupPC_compressPool BackupPC_zcat
- BackupPC_archive BackupPC_archiveHost
- BackupPC_restore BackupPC_serverMesg BackupPC_zipCreate ) ) {
- InstallFile("bin/$prog", "$DestDir$Conf{InstallDir}/bin/$prog", 0555);
+foreach my $prog ( qw(
+ __CONFIGURE_BIN_LIST__
+ ) ) {
+ InstallFile($prog, "$DestDir$Conf{InstallDir}/$prog", 0555);
}
printf("Installing library in $DestDir$Conf{InstallDir}/lib\n");
foreach my $lib ( qw(
- BackupPC/Lib.pm
- BackupPC/FileZIO.pm
- BackupPC/Attrib.pm
- BackupPC/PoolWrite.pm
- BackupPC/View.pm
- BackupPC/Xfer/Archive.pm
- BackupPC/Xfer/Tar.pm
- BackupPC/Xfer/Smb.pm
- BackupPC/Xfer/Rsync.pm
- BackupPC/Xfer/RsyncDigest.pm
- BackupPC/Xfer/RsyncFileIO.pm
- BackupPC/Zip/FileMember.pm
- BackupPC/Lang/en.pm
- BackupPC/Lang/fr.pm
- BackupPC/Lang/es.pm
- BackupPC/Lang/de.pm
- BackupPC/Lang/it.pm
- BackupPC/Lang/nl.pm
- BackupPC/CGI/AdminOptions.pm
- BackupPC/CGI/Archive.pm
- BackupPC/CGI/ArchiveInfo.pm
- BackupPC/CGI/Browse.pm
- BackupPC/CGI/DirHistory.pm
- BackupPC/CGI/EmailSummary.pm
- BackupPC/CGI/GeneralInfo.pm
- BackupPC/CGI/HostInfo.pm
- BackupPC/CGI/Lib.pm
- BackupPC/CGI/LOGlist.pm
- BackupPC/CGI/Queue.pm
- BackupPC/CGI/ReloadServer.pm
- BackupPC/CGI/RestoreFile.pm
- BackupPC/CGI/RestoreInfo.pm
- BackupPC/CGI/Restore.pm
- BackupPC/CGI/StartServer.pm
- BackupPC/CGI/StartStopBackup.pm
- BackupPC/CGI/StopServer.pm
- BackupPC/CGI/Summary.pm
- BackupPC/CGI/View.pm
+ __CONFIGURE_LIB_LIST__
) ) {
- InstallFile("lib/$lib", "$DestDir$Conf{InstallDir}/lib/$lib", 0444);
+ InstallFile($lib, "$DestDir$Conf{InstallDir}/$lib", 0444);
}
if ( $Conf{CgiImageDir} ne "" ) {
s/__LOGDIR__/$Conf{LogDir}/g;
s/__CONFDIR__/$Conf{ConfDir}/g;
s/__TOPDIR__/$Conf{TopDir}/g;
+ s/^(\s*my \$useFHS\s*=\s*)\d;/${1}$opts{fhs};/
+ if ( $prog =~ /Lib.pm/ );
s/__BACKUPPCUSER__/$Conf{BackupPCUser}/g;
s/__CGIDIR__/$Conf{CgiDir}/g;
if ( $first && /^#.*bin\/perl/ ) {
=item B<--fhs>
Use locations specified by the Filesystem Hierarchy Standard
-for installing BackupPC. This is enabled by default. To
-use the pre-3.0 installation locations, specify --no-fhs.
+for installing BackupPC. This is enabled by default for new
+installatios. To use the pre-3.0 installation locations,
+specify --no-fhs.
=item B<--help|?>
=head1 COPYRIGHT
-Copyright (C) 2001-2004 Craig Barratt.
+Copyright (C) 2001-2006 Craig Barratt.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by