[evolvis-commits] r16220: Use config API even during setup

mirabilos at evolvis.org mirabilos at evolvis.org
Tue Mar 1 01:03:48 CET 2011


Author: mirabilos
Date: 2011-03-01 01:03:48 +0100 (Tue, 01 Mar 2011)
New Revision: 16220

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/deb-specific/install-db.sh
   trunk/gforge_base/evolvisforge-5.1/src/utils/install-nsspgsql.sh
Log:
Use config API even during setup

Modified: trunk/gforge_base/evolvisforge-5.1/src/deb-specific/install-db.sh
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/deb-specific/install-db.sh	2011-03-01 00:03:45 UTC (rev 16219)
+++ trunk/gforge_base/evolvisforge-5.1/src/deb-specific/install-db.sh	2011-03-01 00:03:48 UTC (rev 16220)
@@ -87,9 +87,9 @@
 	;;
     configure-files)
 	# Tell PostgreSQL to let us use the database
-	db_passwd=$(grep ^db_password= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
-	db_name=$(grep ^db_name= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
-	db_user=$(grep ^db_user= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
+	db_passwd=$(/usr/share/gforge/bin/forge_get_config database_password)
+	db_name=$(/usr/share/gforge/bin/forge_get_config database_name)
+	db_user=$(/usr/share/gforge/bin/forge_get_config database_user)
 	pattern=$(basename $0).XXXXXX
 
         # PostgreSQL configuration for versions from 7.3 on
@@ -122,9 +122,9 @@
 	;;
     configure)
 	# Create the appropriate database user
-	db_passwd=$(grep ^db_password= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
-	db_name=$(grep ^db_name= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
-	db_user=$(grep ^db_user= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
+	db_passwd=$(/usr/share/gforge/bin/forge_get_config database_password)
+	db_name=$(/usr/share/gforge/bin/forge_get_config database_name)
+	db_user=$(/usr/share/gforge/bin/forge_get_config database_user)
 	pattern=$(basename $0).XXXXXX
 	tmp1=$(mktemp /tmp/$pattern)
 	tmp2=$(mktemp /tmp/$pattern)
@@ -260,8 +260,8 @@
 	perl -pi -e "BEGIN { undef \$/; } s/^### BEGIN GFORGE BLOCK -- DO NOT EDIT.*### END GFORGE BLOCK -- DO NOT EDIT\n//ms;" ${pg_hba_dir}/pg_hba.conf.gforge-new
 	;;
     purge)
-	db_name=$(grep ^db_name= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
-	db_user=$(grep ^db_user= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
+	db_name=$(/usr/share/gforge/bin/forge_get_config database_name)
+	db_user=$(/usr/share/gforge/bin/forge_get_config database_user)
 	su -s /bin/sh postgres -c "dropdb $db_name" > /dev/null 2>&1 || true
 	su -s /bin/sh postgres -c "dropuser $db_user" > /dev/null 2>&1 || true
 	;;
@@ -269,13 +269,7 @@
     # only only for migrating users of the sourceforge package
     #
     dump)
-	if [ -e /etc/sourceforge/local.pl ] ; then
-	    db_name=$(perl -e'require "/etc/sourceforge/local.pl"; print "$sys_dbname\n";')
-	elif [ -e /etc/fusionforge/fusionforge.conf ] ; then
-	    db_name=$(grep ^db_name= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
-	else
-	    db_name=sourceforge
-	fi
+	db_name=$(/usr/share/gforge/bin/forge_get_config database_name)
 	if [ "x$2" != "x" ] ;then
 		DUMPFILE=$2
 	else
@@ -294,7 +288,7 @@
     #
     restore)
 	pg_name=postgresql-$pg_version
-	db_name=$(grep ^db_name= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
+	db_name=$(/usr/share/gforge/bin/forge_get_config database_name)
 	pattern=$(basename $0).XXXXXX
 	newpg=$(mktemp /tmp/$pattern)
 	localtrust="local all all trust"

Modified: trunk/gforge_base/evolvisforge-5.1/src/utils/install-nsspgsql.sh
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/utils/install-nsspgsql.sh	2011-03-01 00:03:45 UTC (rev 16219)
+++ trunk/gforge_base/evolvisforge-5.1/src/utils/install-nsspgsql.sh	2011-03-01 00:03:48 UTC (rev 16220)
@@ -22,9 +22,9 @@
 PATH=$PATH:/usr/sbin
 
 setup_vars() {
-    db_host=$(grep ^db_host= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
-    db_name=$(grep ^db_name= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
-    db_user=$(grep ^db_user= /etc/fusionforge/fusionforge.conf | cut -d= -f2-)
+    db_name=$(/usr/share/gforge/bin/forge_get_config database_name)
+    db_user=$(/usr/share/gforge/bin/forge_get_config database_user)
+    db_host=$(/usr/share/gforge/bin/forge_get_config database_host)
     
     db_user_nss=$db_user"_nss"
 



More information about the evolvis-commits mailing list