if ( $ConfigPath ne "" && -r $ConfigPath ) {
(my $topDir = $ConfigPath) =~ s{/[^/]+/[^/]+$}{};
die("BackupPC::Lib->new failed\n")
- if ( !($bpc = BackupPC::Lib->new($topDir, ".")) );
+ if ( !($bpc = BackupPC::Lib->new($topDir, ".", 1)) );
%Conf = $bpc->Conf();
%OrigConf = %Conf;
$Conf{TopDir} = $topDir;
sub new
{
my $class = shift;
- my($topDir, $installDir) = @_;
+ my($topDir, $installDir, $noUserCheck) = @_;
my $bpc = bless {
TopDir => $topDir || '/data/BackupPC',
#
# Verify we are running as the correct user
#
- if ( $bpc->{Conf}{BackupPCUserVerify}
+ if ( !$noUserCheck
+ && $bpc->{Conf}{BackupPCUserVerify}
&& $> != (my $uid = (getpwnam($bpc->{Conf}{BackupPCUser}))[2]) ) {
print("Wrong user: my userid is $>, instead of $uid"
. " ($bpc->{Conf}{BackupPCUser})\n");