Discussion:
[BackupPC-devel] configure.pl should be able to ignore existing installation in batch mode
Kenneth Porter
2013-09-18 12:02:01 UTC
Permalink
I'm trying to build/package an RPM on a system on which BackupPC is running
and configure.pl running as a mortal is seeing the unreadable
/etc/BackupPC/config.pl and failing.

If --batch is specified and --config-path is not specified, the
configure.pl script should NOT attempt to use the configuration at
/etc/BackupPC as a basis for upgrade.

I think something like this should work:

--- configure.pl.original 2013-09-18 05:00:54.357675245 -0700
+++ configure.pl 2013-09-18 04:59:03.142086920 -0700
@@ -159,6 +159,7 @@
#
my $ConfigPath = "";
my $ConfigFileOK = 1;
+$ConfigFileOK = 0 if ( $opts{batch} && !defined($opts{'config-path'}) );
while ( 1 ) {
if ( $ConfigFileOK && -f "/etc/BackupPC/config.pl" ) {
$ConfigPath = "/etc/BackupPC/config.pl";
Craig Barratt
2013-09-22 19:03:00 UTC
Permalink
Kenneth,

Yes, I noticed that too, and fixed it in 4.0.0alpha2. It is not fixed in
3.3.0.

My fixed was slightly different - I ignore /etc/BackupPC/config.pl if
$opts{"config-path"} is defined (not batch also). (I just noticed I used
"&", which should be benign but I'll fix that in the next release.)

@@ -160,7 +177,7 @@
my $ConfigFileOK = 1;
while ( 1 ) {
if ( $ConfigFileOK && -f "/etc/BackupPC/config.pl"
- && (!defined($opts{fhs}) || $opts{fhs}) ) {
+ && (!defined($opts{fhs}) || $opts{fhs}) &
!defined($opts{"config-path"}) ) {
$ConfigPath = "/etc/BackupPC/config.pl";
$opts{fhs} = 1 if ( !defined($opts{fhs}) );
print <<EOF;

Craig

Loading...