There was a slight bug in the code I offered below. Here is a fixed and better version:
foreach my $dir ( qw(TopDir ConfDir InstallDir LogDir RunDir) ) { if ($bpc->{Conf}{$dir} eq "" || defined(lcfirst($dir))) { $bpc->{Conf}{$dir} = $bpc->{$dir}; } else { $bpc->{$dir} = $bpc->{Conf}{$dir}; } $paths->{$dir} = $bpc->{$dir}; backu...@kosowsky.org wrote at about 13:50:11 +0000 on Sunday, May 5, 2024: > The following code seems to imply that one can (optionally) set > TopDir, InstallDir, and ConfDir when initializing a new bpc class > sub new > { > my $class = shift; > my($topDir, $installDir, $confDir, $noUserCheck) = @_; > > However, this doesn't really seem to have any effect in practice. > > Specifically, > - If TopDir, InstallDir, or ConfDir *are* set in config.pl, then > the following code overrides the arguments given to 'sub new', > making the input arguments irrelevant. > > foreach my $dir ( qw(TopDir ConfDir InstallDir LogDir RunDir) ) { > next if ( $bpc->{Conf}{$dir} eq "" ); > $paths->{$dir} = $bpc->{$dir} = $bpc->{Conf}{$dir}; > > > - Conversely, if TopDir, InstallDir, or ConfDir are *not* set in > config.pl, then $bpc->{Conf}{$dir} is never set causing any > routine that references $Conf{$dir} to fail > > Suggested fix: > foreach my $dir ( qw(TopDir ConfDir InstallDir LogDir RunDir) ) { > if (( $bpc->{Conf}{$dir} eq "" ) || > (defined($topDir) && $dir eq "TopDir") || > (defined($confDir) && $dir eq "ConfDir") || > (defined($installDir) && $dir eq "InstallDir")) > { > $bpc->{Conf}{$dir} = $bpc->{$dir}; > } else > $bpc->{$dir} = $bpc->{Conf}{$dir}; > } > $paths->{$dir} = $bpc->{$dir}; > > > > > > > > _______________________________________________ > BackupPC-users mailing list > BackupPC-users@lists.sourceforge.net > List: https://lists.sourceforge.net/lists/listinfo/backuppc-users > Wiki: https://github.com/backuppc/backuppc/wiki > Project: https://backuppc.github.io/backuppc/ > > > _______________________________________________ > BackupPC-users mailing list > BackupPC-users@lists.sourceforge.net > List: https://lists.sourceforge.net/lists/listinfo/backuppc-users > Wiki: https://github.com/backuppc/backuppc/wiki > Project: https://backuppc.github.io/backuppc/ _______________________________________________ BackupPC-users mailing list BackupPC-users@lists.sourceforge.net List: https://lists.sourceforge.net/lists/listinfo/backuppc-users Wiki: https://github.com/backuppc/backuppc/wiki Project: https://backuppc.github.io/backuppc/