[open-ils-commits] r11348 - trunk/Open-ILS/src/support-scripts

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Nov 25 16:20:19 EST 2008


Author: dbs
Date: 2008-11-25 16:20:15 -0500 (Tue, 25 Nov 2008)
New Revision: 11348

Modified:
   trunk/Open-ILS/src/support-scripts/eg_db_config.pl
Log:
Command line settings should win out over settings in the config file
Necessary for a fresh install to work


Modified: trunk/Open-ILS/src/support-scripts/eg_db_config.pl
===================================================================
--- trunk/Open-ILS/src/support-scripts/eg_db_config.pl	2008-11-25 17:42:22 UTC (rev 11347)
+++ trunk/Open-ILS/src/support-scripts/eg_db_config.pl	2008-11-25 21:20:15 UTC (rev 11348)
@@ -128,11 +128,13 @@
 	my $parser = XML::LibXML->new();
 	my $opensrf_config = $parser->parse_file($config_file);
 
-	$settings->{host} = $opensrf_config->findnodes($host);
-	$settings->{port} = $opensrf_config->findnodes($port);
-	$settings->{db} = $opensrf_config->findnodes($dbname);
-	$settings->{user} = $opensrf_config->findnodes($user);
-	$settings->{pw} = $opensrf_config->findnodes($pw);
+	# If the user passed in settings at the command line,
+	# we don't want to override them
+	$settings->{host} = $settings->{host} || $opensrf_config->findnodes($host);
+	$settings->{port} = $settings->{port} || $opensrf_config->findnodes($port);
+	$settings->{db} = $settings->{db} || $opensrf_config->findnodes($dbname);
+	$settings->{user} = $settings->{user} || $opensrf_config->findnodes($user);
+	$settings->{pw} = $settings->{pw} || $opensrf_config->findnodes($pw);
 }
 
 # Creates the database schema by calling build-db.sh
@@ -140,10 +142,11 @@
 	my $settings = shift;
 
 	chdir(dirname($build_db_sh));
-	system(File::Spec->catfile('.', basename($build_db_sh)) . " " .
+	my $cmd = File::Spec->catfile('.', basename($build_db_sh)) . " " .
 		$settings->{host} ." ".  $settings->{port} ." ". 
 		$settings->{db} ." ".  $settings->{user} ." ". 
-		$settings->{pw});
+		$settings->{pw};
+	system($cmd);
 	chdir($script_dir);
 }
 



More information about the open-ils-commits mailing list