[Fusionforge-commits] r15139 - in branches/Branch_5_1: . src/deb-specific src/plugins/externalsearch/bin src/plugins/globalsearch/bin src/plugins/hudson/bin src/plugins/oslc/bin src/utils

Roland Mas lolando at fusionforge.org
Fri Mar 16 14:09:37 CET 2012


Author: lolando
Date: 2012-03-16 14:09:36 +0100 (Fri, 16 Mar 2012)
New Revision: 15139

Modified:
   branches/Branch_5_1/
   branches/Branch_5_1/src/deb-specific/create-mailing-lists.pl
   branches/Branch_5_1/src/deb-specific/db-upgrade.pl
   branches/Branch_5_1/src/deb-specific/fileforge.pl
   branches/Branch_5_1/src/deb-specific/fix-mailing-lists.pl
   branches/Branch_5_1/src/deb-specific/prepare-vhosts-file.pl
   branches/Branch_5_1/src/plugins/externalsearch/bin/db-upgrade.pl
   branches/Branch_5_1/src/plugins/globalsearch/bin/db-upgrade.pl
   branches/Branch_5_1/src/plugins/hudson/bin/db-upgrade.pl
   branches/Branch_5_1/src/plugins/oslc/bin/db-upgrade.pl
   branches/Branch_5_1/src/utils/include.pl
Log:
Remove dependency on local.pl in Perl?\194?\160scripts

Modified: branches/Branch_5_1/src/deb-specific/create-mailing-lists.pl
===================================================================
--- branches/Branch_5_1/src/deb-specific/create-mailing-lists.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/deb-specific/create-mailing-lists.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -17,7 +17,6 @@
 sub debug ( $ ) ;
 
 require ("/usr/share/gforge/lib/include.pl") ; # Include all the predefined functions 
-require ("/etc/gforge/local.pl") ;
 
 &db_connect ;
 

Modified: branches/Branch_5_1/src/deb-specific/db-upgrade.pl
===================================================================
--- branches/Branch_5_1/src/deb-specific/db-upgrade.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/deb-specific/db-upgrade.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -23,7 +23,6 @@
     $server_admin $domain_name $newsadmin_groupid $statsadmin_groupid
     $libdir $sqldir/ ;
 
-require ("/etc/gforge/local.pl") ; 
 $libdir="/usr/share/gforge/lib";
 $sqldir="/usr/share/gforge/db";
 require ("$libdir/sqlparser.pm") ; # Our magic SQL parser
@@ -116,8 +115,6 @@
 	  if (&is_lesser ($version, $target)) {
 	      &debug ("Adding local data.") ;
 
-	      do "/etc/gforge/local.pl" or die "Cannot read /etc/gforge/local.pl" ;
-
 	      my ($login, $md5pwd, $unixpwd, $email, $noreplymail, $date) ;
 
 	      $login = 'admin' ;

Modified: branches/Branch_5_1/src/deb-specific/fileforge.pl
===================================================================
--- branches/Branch_5_1/src/deb-specific/fileforge.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/deb-specific/fileforge.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -11,7 +11,7 @@
 delete @ENV{qw(IFS CDPATH ENV BASH_ENV PATH)};
 
 # Check access to secret
-require ("/etc/gforge/local.pl") ;
+require ("/usr/share/gforge/lib/include.pl") ;
 unless ( (defined $sys_dbpasswd)
 	 and (defined $ENV{'sys_dbpasswd'})
 	 and ($sys_dbpasswd eq $ENV{'sys_dbpasswd'}) ) {

Modified: branches/Branch_5_1/src/deb-specific/fix-mailing-lists.pl
===================================================================
--- branches/Branch_5_1/src/deb-specific/fix-mailing-lists.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/deb-specific/fix-mailing-lists.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -14,7 +14,6 @@
 
 sub debug ( $ ) ;
 
-require ("/etc/gforge/local.pl") ;
 require("/usr/share/gforge/lib/include.pl");  # Include all the predefined functions
 
 &db_connect ;

Modified: branches/Branch_5_1/src/deb-specific/prepare-vhosts-file.pl
===================================================================
--- branches/Branch_5_1/src/deb-specific/prepare-vhosts-file.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/deb-specific/prepare-vhosts-file.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -5,7 +5,6 @@
 use strict ;
 use vars qw/$dbh $ifile $ofile @ilist %hash $key $val $cur $line $dbh $sys_dbname $sys_dbuser $sys_dbpasswd $token/ ;
 
-require("/etc/gforge/local.pl"); 
 require ("/usr/share/gforge/lib/include.pl") ; 
 
 %hash = () ;

Modified: branches/Branch_5_1/src/plugins/externalsearch/bin/db-upgrade.pl
===================================================================
--- branches/Branch_5_1/src/plugins/externalsearch/bin/db-upgrade.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/plugins/externalsearch/bin/db-upgrade.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -74,8 +74,6 @@
     if (is_lesser $version, $target) {
 	debug "Adding local data." ;
 	
-	do "/etc/gforge/local.pl" or die "Cannot read /etc/gforge/local.pl" ;
-	
 	my $ip_address = qx/host $domain_name | awk '{print \}'/ ;
 	
 	@reqlist = (

Modified: branches/Branch_5_1/src/plugins/globalsearch/bin/db-upgrade.pl
===================================================================
--- branches/Branch_5_1/src/plugins/globalsearch/bin/db-upgrade.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/plugins/globalsearch/bin/db-upgrade.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -77,8 +77,6 @@
     if (is_lesser $version, $target) {
     debug "Adding local data." ;
         
-    do "/etc/gforge/local.pl" or die "Cannot read /etc/gforge/local.pl" ;
-
     my $packed_ip = gethostbyname("$domain_name");
     my $ip_address ;
     if (defined $packed_ip) {

Modified: branches/Branch_5_1/src/plugins/hudson/bin/db-upgrade.pl
===================================================================
--- branches/Branch_5_1/src/plugins/hudson/bin/db-upgrade.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/plugins/hudson/bin/db-upgrade.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -74,8 +74,6 @@
 #    if (is_lesser $version, $target) {
 #	debug "Adding local data." ;
 #	
-#	do "/etc/gforge/local.pl" or die "Cannot read /etc/gforge/local.pl" ;
-#	
 #	my $ip_address = qx/host $domain_name | awk '{print \}'/ ;
 #	
 #	@reqlist = (

Modified: branches/Branch_5_1/src/plugins/oslc/bin/db-upgrade.pl
===================================================================
--- branches/Branch_5_1/src/plugins/oslc/bin/db-upgrade.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/plugins/oslc/bin/db-upgrade.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -74,8 +74,6 @@
 #    if (is_lesser $version, $target) {
 #	debug "Adding local data." ;
 #	
-#	do "/etc/gforge/local.pl" or die "Cannot read /etc/gforge/local.pl" ;
-#	
 #	my $ip_address = qx/host $domain_name | awk '{print \}'/ ;
 #	
 #	@reqlist = (

Modified: branches/Branch_5_1/src/utils/include.pl
===================================================================
--- branches/Branch_5_1/src/utils/include.pl	2012-03-16 13:08:42 UTC (rev 15138)
+++ branches/Branch_5_1/src/utils/include.pl	2012-03-16 13:09:36 UTC (rev 15139)
@@ -4,13 +4,60 @@
 ##############################
 # Global Variables
 ##############################
-$config_file	=	"/etc/gforge/local.pl";	# Local Include file for database username and password
-
 $dummy_uid      =       getpwnam('scm-gforge');                  # UserID of the dummy user that will own group's files
 $date           =       int(time()/3600/24);    # Get the number of days since 1/1/1970 for /etc/shadow
 
-require $config_file;
+ at possible_paths = (
+    '/usr/share/gforge/bin',
+    '/usr/share/fusionforge/bin',
+    '/usr/local/share/gforge/bin',
+    '/usr/local/share/fusionforge/bin',
+    '/opt/gforge/bin',
+    '/opt/fusionforge/bin',
+    '/usr/bin',
+    '/usr/local/bin') ;
+foreach $p (@possible_paths) {
+    if (-x "$p/forge_get_config") {
+	$fgc = "$p/forge_get_config";
+	last;
+    }
+}
 
+%forge_config_cache = ();
+
+sub forge_get_config ($$) {
+    my $var = shift;
+    my $sec = shift || 'core';
+
+    if (!defined $forge_config_cache{$sec}{$var}) {
+	$forge_config_cache{$sec}{$var} = qx!$fgc $var $sec!;
+	chomp $forge_config_cache{$sec}{$var};
+    }
+    return $forge_config_cache{$sec}{$var};
+}
+
+$sys_default_domain = &forge_get_config ('web_host') ;
+$sys_scm_host = &forge_get_config ('web_host') ;
+$domain_name = &forge_get_config ('web_host') ;
+$sys_users_host = &forge_get_config ('users_host') ;
+$sys_lists_host = &forge_get_config ('lists_host') ;
+$sys_name = &forge_get_config ('forge_name') ;
+$sys_themeroot = &forge_get_config ('themes_root') ;
+$sys_news_group = &forge_get_config ('news_group') ;
+$sys_dbhost = &forge_get_config ('database_host') ;
+$sys_dbport = &forge_get_config ('database_port') ;
+$sys_dbname = &forge_get_config ('database_name') ;
+$sys_dbuser = &forge_get_config ('database_user') ;
+$sys_dbpasswd = &forge_get_config ('database_password') ;
+$sys_ldap_base_dn = &forge_get_config ('ldap_base_dn') ;
+$sys_ldap_host = &forge_get_config ('ldap_host') ;
+$server_admin = &forge_get_config ('admin_email') ;
+$peerrating_groupid = &forge_get_config ('peer_rating_group') ;
+$chroot_prefix = &forge_get_config ('chroot') ;
+$homedir_prefix = &forge_get_config ('homedir_prefix') ;
+$grpdir_prefix = &forge_get_config ('groupdir_prefix') ;
+$file_dir = &forge_get_config ('data_path') ;
+
 ##############################
 # Database Connect Functions
 ##############################




More information about the Fusionforge-commits mailing list