[evolvis-commits] r12988: Upgrade mode added for install.sh (tarball)

mirabilos at evolvis.org mirabilos at evolvis.org
Mon Feb 28 02:13:03 CET 2011


Author: mirabilos
Date: 2011-02-28 02:13:02 +0100 (Mon, 28 Feb 2011)
New Revision: 12988

Modified:
   trunk/gforge_base/evolvisforge-5.1/gforge/gforge-install-2.php
   trunk/gforge_base/evolvisforge-5.1/gforge/install.sh
Log:
Upgrade mode added for install.sh (tarball)

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/gforge-install-2.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/gforge-install-2.php	2011-02-28 01:13:01 UTC (rev 12987)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/gforge-install-2.php	2011-02-28 01:13:02 UTC (rev 12988)
@@ -73,7 +73,7 @@
 	//     exit 2
 	//fi
 	
-	//ARREGLAR ESTO
+
 	exec("getent group $args[3] > /dev/null", $arr, $t);
 	if ($t != 0) {
 	 	echo "invalid apache group";
@@ -98,18 +98,13 @@
 	}
 	echo "OK\n";
 
-	//system("mv * /opt/gforge");
+
 	system("cp -r * /opt/gforge");
-	//cd /var/lib/gforge
+
 	chdir("/var/lib/gforge");
 	system("mkdir -p uploads");
-	system("mkdir -p /opt/jpgraph");
 	system("mkdir -p scmtarballs");
 	system("mkdir -p scmsnapshots");
-	/*if (!is_file("/usr/bin/php4"))
-	{
-		symlink("/usr/bin/php", "/usr/bin/php4");
-	}*/
 
 	//#project vhost space
 	system("mkdir -p homedirs");
@@ -119,20 +114,21 @@
 		symlink("/home/groups", "homedirs/groups");
 	}
 
-	//#Create default location for SVN repositories
+	// Create default location for SVN repositories
 	system("mkdir -p svnroot");
 	if (!is_dir("/svnroot"))
 	{
 		symlink("/var/lib/gforge/svnroot", "/svnroot");
 	}
 
-	#Create default location for CVS repositories
+	// Create default location for CVS repositories
 	system("mkdir -p cvsroot");
 	if (!is_dir("/cvsroot"))
 	{
 		symlink("/var/lib/gforge/cvsroot", "/cvsroot");
 	}
-	#create default dumps dir 
+
+	// Create default dumps dir
 	system("mkdir -p /var/lib/gforge/dumps");
 
 	//cd /opt/gforge
@@ -144,10 +140,14 @@
 	//echo "linea 2\n";
 	system("chmod 755 /bin/cvssh.pl");
 
-	//#Create default location for gforge config files
+	// Create default location for gforge config files
 	system("mkdir -p /etc/gforge");
-	system("cp etc/local.inc.example /etc/gforge/local.inc");
-	system("cp etc/gforge-httpd.conf.example /etc/gforge/httpd.conf");
+	if (!is_file("/etc/gforge/local.inc")) {
+		system("cp etc/local.inc.example /etc/gforge/local.inc");
+	}
+	if (!is_file("/etc/gforge/httpd.conf")) {
+		system("cp etc/gforge-httpd.conf.example /etc/gforge/httpd.conf");
+	}
 
 	////#copy the scmcvs plugin config to /etc/gforge/
 	//if (!is_dir("/etc/gforge/plugins/scmcvs"))
@@ -250,7 +250,7 @@
 	{
 		system("mkdir -p plugins");
 	}
-	//cd plugins
+
 	chdir("plugins");
 	if (!is_dir("cvstracker"))
 	{

Modified: trunk/gforge_base/evolvisforge-5.1/gforge/install.sh
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/install.sh	2011-02-28 01:13:01 UTC (rev 12987)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/install.sh	2011-02-28 01:13:02 UTC (rev 12988)
@@ -21,8 +21,9 @@
 fi
 
 hostname=$1
+type="";
+msg="";
 
-type="";
 if [ -f "/etc/redhat-release" ]
 then
 	type="redhat"
@@ -48,61 +49,75 @@
 	deps="OPENSUSE"
 fi
 
+if [ -d "/opt/gforge" ]
+then
+	mode="update"
+	echo "Upgrading previous installation ...";
+else
+	mode="install"
+	echo "Installing FusionForge ...";
+fi
 
 if [ $type = "redhat" ]
 then
 	yum -y install php
 	php gforge-install-1-deps.php $deps
 	php gforge-install-2.php "$hostname" apache apache
-	php gforge-install-3-db.php
 
-	php /opt/gforge/db/startpoint.php 4.7
+	if [ $mode = "install" ]
+	then
+		php gforge-install-3-db.php
+		php /opt/gforge/db/startpoint.php 4.7
 
-	# Post installation fixes.
-	perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/httpd/conf/httpd.conf
-	perl -spi -e 's/^LoadModule/#LoadModule/g' /etc/gforge/httpd.conf 
+		# Post installation fixes.
+		perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/httpd/conf/httpd.conf
+		perl -spi -e 's/^LoadModule/#LoadModule/g' /etc/gforge/httpd.conf
 
-	chkconfig httpd on
-	chkconfig postgresql on
-	chkconfig iptables off
+		chkconfig httpd on
+		chkconfig postgresql on
+		chkconfig iptables off
 
-	service httpd restart
-	service iptables stop
+		service httpd restart
+		service iptables stop
+		msg="IMPORTANT: Service iptables (firewall) disabled, please reconfigure after"
 
-	cp cron.gforge /etc/cron.d
-	service crond reload
-
-	echo "IMPORTANT: Service iptables (firewall) disabled, please reconfigure after";
-
-	exit 0;
+		cp cron.gforge /etc/cron.d
+		service crond reload
+	else
+		php /opt/gforge/db/upgrade-db.php
+	fi
 elif [ $type = "suse" ]
 then
 	yast -i php5
 	php gforge-install-1-deps.php $deps
 	php gforge-install-2.php "$hostname" wwwrun www
-	php gforge-install-3-db.php
 
-	php /opt/gforge/db/startpoint.php 4.7
+	if [ $mode = "install" ]
+	then
+		php gforge-install-3-db.php
+		php /opt/gforge/db/startpoint.php 4.7
 
-	# Post installation fixes.
-	perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/httpd/conf/httpd.conf
-	perl -spi -e 's/^LoadModule/#LoadModule/g' /etc/gforge/httpd.conf
+		# Post installation fixes.
+		perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/httpd/conf/httpd.conf
+		perl -spi -e 's/^LoadModule/#LoadModule/g' /etc/gforge/httpd.conf
 
-	chkconfig httpd on
-	chkconfig postgresql on
-	#chkconfig iptables off
+		chkconfig httpd on
+		chkconfig postgresql on
 
-	rcapache2 restart
-	rcSuSEfirewall2 stop
+		rcapache2 restart
+		rcSuSEfirewall2 stop
+		msg="IMPORTANT: Service SuSEfirewall2 stopped, please reconfigure after"
 
-	cp cron.gforge /etc/cron.d
-	rccron reload
-
-#	echo "IMPORTANT: Service SuSEfirewall2 stopped, please reconfigure after";
-
-	exit 0;
+		cp cron.gforge /etc/cron.d
+		rccron reload
+	else
+		php /opt/gforge/db/upgrade-db.php
+	fi
 else
 	echo "Only Red Hat, Fedora or CentOS and OpenSUSE are supported by this script.";
 	echo "See INSTALL for normal installation";
 	exit 1;
 fi
+
+echo $smg;
+exit 0;



More information about the evolvis-commits mailing list