add newline to db.conf updater
This commit is contained in:
@ -44,14 +44,19 @@ sub update_db_config {
|
|||||||
open( my $readhandle, '<', $remote_db_conf )
|
open( my $readhandle, '<', $remote_db_conf )
|
||||||
or die "failed to open db.conf: $!";
|
or die "failed to open db.conf: $!";
|
||||||
my @lines;
|
my @lines;
|
||||||
|
my $found = 0;
|
||||||
while ( my $line = <$readhandle> ) {
|
while ( my $line = <$readhandle> ) {
|
||||||
if ( $line =~ /^database=/ ) {
|
if ( $line =~ /^database=/ ) {
|
||||||
$line = "database=$db_prefix\_$experiment";
|
$line = "database=${db_prefix}_$experiment\n";
|
||||||
|
$found = 1;
|
||||||
}
|
}
|
||||||
push @lines, $line;
|
push @lines, $line;
|
||||||
}
|
}
|
||||||
close($readhandle) or die "failed to close db.conf: $!";
|
close($readhandle) or die "failed to close db.conf: $!";
|
||||||
|
|
||||||
|
die "no database= line found in $remote_db_conf for some reason"
|
||||||
|
unless $found;
|
||||||
|
|
||||||
open( my $writehandle, '>', $remote_db_conf )
|
open( my $writehandle, '>', $remote_db_conf )
|
||||||
or die "failed to open db.conf: $!";
|
or die "failed to open db.conf: $!";
|
||||||
print( $writehandle, @lines );
|
print( $writehandle, @lines );
|
||||||
|
|||||||
Reference in New Issue
Block a user