[Fusionforge-commits] r14491 - in trunk/src: . install

Christian Bayle cbayle at fusionforge.org
Tue Sep 27 14:16:33 CEST 2011


Author: cbayle
Date: 2011-09-27 14:16:33 +0200 (Tue, 27 Sep 2011)
New Revision: 14491

Added:
   trunk/src/install/install5_post
   trunk/src/install/install6_upgrade
Removed:
   trunk/src/install/config
Modified:
   trunk/src/install-ng
   trunk/src/install/deps
   trunk/src/install/detect_os
   trunk/src/install/install2
   trunk/src/install/install3
   trunk/src/install/install4
Log:
factorize and cleanup


Deleted: trunk/src/install/config
===================================================================
--- trunk/src/install/config	2011-09-27 12:14:41 UTC (rev 14490)
+++ trunk/src/install/config	2011-09-27 12:16:33 UTC (rev 14491)
@@ -1,6 +0,0 @@
-#! /bin/sh
-fusionforge_dir=${FUSIONFORGE_DIR:-/opt/gforge}
-fusionforge_src_dir=${FUSIONFORGE_SRC_DIR:-/opt/gforge}
-fusionforge_data_dir=${FUSIONFORGE_DATA_DIR:-/var/lib/gforge}
-fusionforge_log_dir=${FUSIONFORGE_LOG_DIR:-/var/log/gforge}
-fusionforge_etc_dir=${FUSIONFORGE_ETC_DIR:-/etc/gforge}

Modified: trunk/src/install/deps
===================================================================
--- trunk/src/install/deps	2011-09-27 12:14:41 UTC (rev 14490)
+++ trunk/src/install/deps	2011-09-27 12:16:33 UTC (rev 14491)
@@ -42,13 +42,11 @@
 deps_redhat() {
 	if [ ! -f /tmp/done_yum ]
 	then
-		set -e
 		addFusionForgeYumRepo
 		addDagRPMForgeYumRepo
 		msg green "Installing packages: Executing YUM. Please wait..."
 		yum --enablerepo=fusionforge --enablerepo=dag-rpmforge  -y --skip-broken install httpd php mailman cvs postgresql postgresql-libs postgresql-server postgresql-contrib perl-URI php-pgsql subversion mod_dav_svn postfix rcs php-gd mod_ssl wget openssh which liberation-fonts php-htmlpurifier php-mbstring php-jpgraph-1.5.2 poppler-utils php-pecl-zip php-pear-HTTP_WebDAV_Server antiword php-pecl-Fileinfo shared-mime-info rsync
 		touch /tmp/done_yum
-		set +e
 	fi
 }
 

Modified: trunk/src/install/detect_os
===================================================================
--- trunk/src/install/detect_os	2011-09-27 12:14:41 UTC (rev 14490)
+++ trunk/src/install/detect_os	2011-09-27 12:16:33 UTC (rev 14491)
@@ -78,12 +78,18 @@
 		suse|opensuse)
 			type=suse
 			;;
-		debian|ubuntu|ark)
+		debian|ark)
 			type=debian	
 			;;
+		ubuntu)
+			type=ubuntu
+			;;
 		centos|rhel|redhat_unknown|fedora)
 			type=redhat
 			;;
+		*)
+			type=unknown
+			;;
 	esac
 	echo $type
 }

Modified: trunk/src/install/install2
===================================================================
--- trunk/src/install/install2	2011-09-27 12:14:41 UTC (rev 14490)
+++ trunk/src/install/install2	2011-09-27 12:16:33 UTC (rev 14491)
@@ -48,7 +48,7 @@
 		msg red "Usage: $0 fusionforge.org apacheuser apachegroup"
 		exit 127
 	else
-		msg green "Validating arguments: OK"
+		msg green "Running install2_files $hostname $apacheuser $apachegroup"
 	fi
 
 	CHECK=`echo $hostname | grep -E "[^[:alnum:]\-]"`
@@ -153,6 +153,7 @@
 	chmod 755 /bin/cvssh.pl
 
 	# Create default location for gforge config files
+	# TODO BEGIN : could this be replaced by $fusionforge_dir/utils/manage-apache-config.sh install ?
 	mkdir -p $fusionforge_etc_dir
 	if [ ! -f $fusionforge_etc_dir/httpd.conf ]
 	then
@@ -167,6 +168,7 @@
 
 	cp $fusionforge_dir/etc/config.ini-opt $fusionforge_etc_dir/config.ini
 	cp -rL $fusionforge_dir/etc/config.ini.d $fusionforge_etc_dir/
+	# TODO END
 
 	# Install default configuration files for all plugins.
 	mkdir -p $fusionforge_etc_dir/plugins/
@@ -246,3 +248,36 @@
 	cd $fusionforge_etc_dir && find -type f -exec perl -pi -e "s/gforge.company.com/$hostname/" {} \;
 	echo "noreply:	/dev/null" >> /etc/aliases
 }
+
+install2_files_redhat()
+{
+	install2_files $1 apache apache
+}
+
+install2_files_suse()
+{
+	install2_files $1 wwwrun www
+}
+
+install2_files_ubuntu()
+{
+	echo "--"
+	echo "For ubuntu, rather use ubuntu package"
+	echo "SEE https://fusionforge.org/mediawiki/index.php/Installing/UbuntuRepositories"
+	echo "--"
+}
+
+install2_files_debian()
+{
+	echo "--"
+	echo "For debian, rather use debian package"
+	echo "SEE https://fusionforge.org/mediawiki/index.php/Installing/DebianRepositories"
+	echo "--"
+}
+
+install2_files_unknown()
+{
+	echo "Only Red Hat, Fedora or CentOS and OpenSUSE are supported by this script.";
+	echo "See INSTALL for normal installation";
+	exit 1
+}

Modified: trunk/src/install/install3
===================================================================
--- trunk/src/install/install3	2011-09-27 12:14:41 UTC (rev 14490)
+++ trunk/src/install/install3	2011-09-27 12:16:33 UTC (rev 14491)
@@ -123,7 +123,6 @@
 }
 
 forge_save_db_config(){
-
 	if [ -z "$FFORGE_DB" ]
 	then
 		while test -z "$FFORGE_DB"
@@ -350,3 +349,28 @@
 	installandrundb
 	msg green "Done."
 }
+
+install3_db_redhat()
+{
+	install3_db
+}
+
+install3_db_suse()
+{
+	install3_db
+}
+
+install3_db_debian()
+{
+	echo "Install 3 db not implemented for debian"
+}
+
+install3_db_ubuntu()
+{
+	echo "Install 3 db not implemented for ubuntu"
+}
+
+install3_db_unknown()
+{
+	echo "Install 3 db not implemented"
+}

Modified: trunk/src/install/install4
===================================================================
--- trunk/src/install/install4	2011-09-27 12:14:41 UTC (rev 14490)
+++ trunk/src/install/install4	2011-09-27 12:16:33 UTC (rev 14491)
@@ -23,15 +23,40 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 install4_config(){
-	if [ -f "/etc/gforge/local.inc" ]
+	if [ -f "$fusionforge_etc_dir/local.inc" ]
 	then
-		PATH=/opt/gforge/utils/:$PATH migrate-to-ini-files.sh
+		PATH=$fusionforge_dir/utils/:$PATH migrate-to-ini-files.sh
 	fi
 	
-	PATH=/opt/gforge/utils/:$PATH manage-apache-config.sh install
+	PATH=$fusionforge_dir/utils/:$PATH manage-apache-config.sh install
 	
-	ls /etc/gforge/httpd.conf.d/*.generated | while read i
+	ls $fusionforge_etc_dir/httpd.conf.d/*.generated | while read i
 	do
 		mv $i ${i%%.generated}
 	done
 }
+
+install4_config_redhat()
+{
+	install4_config
+}
+
+install4_config_suse()
+{
+	install4_config
+}
+
+install4_config_debian()
+{
+	echo "TODO"
+}
+
+install4_config_ubuntu()
+{
+	echo "TODO"
+}
+
+install4_config_unknown()
+{
+	echo "TODO"
+}

Added: trunk/src/install/install5_post
===================================================================
--- trunk/src/install/install5_post	                        (rev 0)
+++ trunk/src/install/install5_post	2011-09-27 12:16:33 UTC (rev 14491)
@@ -0,0 +1,66 @@
+install5_post_redhat()
+{
+	hostname=$1
+
+	# Post installation fixes.
+	perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/httpd/conf/httpd.conf
+	# Disable ssl
+	perl -spi -e "s/^Include/#Include/" /etc/gforge/httpd.conf.d/ssl-on.inc
+	
+	chkconfig httpd on
+	chkconfig postgresql on
+	chkconfig iptables off
+	
+	service httpd restart
+	service iptables stop
+	msg="IMPORTANT: Service iptables (firewall) disabled, please reconfigure after"
+	
+	cp $scriptdir/packaging/cron.d/cron.fusionforge /etc/cron.d
+	cp $scriptdir/plugins/*/etc/cron.d/* /etc/cron.d/
+	service crond reload
+}
+
+install5_post_suse()
+{
+	hostname=$1
+
+	# Post installation fixes.
+	#perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/apache2/httpd.conf
+
+	chkconfig -s apache2 on
+	chkconfig -s postgresql on
+
+	# Apache settings: modules
+	for m in dav dav_svn authz_svn ssl; do
+		a2enmod $m
+		a2enflag $m
+	done
+	echo "Virtual hosts for ${hostname}:"
+	httpd2 -S -DSSL 2>&1 | grep ${hostname}
+
+	rcapache2 restart
+
+	rcSuSEfirewall2 stop
+	msg="IMPORTANT: Service SuSEfirewall2 stopped, please reconfigure after"
+
+	cp $scriptdir/packaging/cron.d/cron.fusionforge /etc/cron.d
+	cp $scriptdir/plugins/*/etc/cron.d/* /etc/cron.d/
+	rccron reload
+}
+
+install5_post_debian()
+{
+	echo "TODO"
+}
+
+install5_post_ubuntu()
+{
+	echo "TODO"
+}
+
+install5_post_unknown()
+{
+	echo "TODO"
+}
+
+

Added: trunk/src/install/install6_upgrade
===================================================================
--- trunk/src/install/install6_upgrade	                        (rev 0)
+++ trunk/src/install/install6_upgrade	2011-09-27 12:16:33 UTC (rev 14491)
@@ -0,0 +1,32 @@
+install6_upgrade()
+{
+	echo "Running php db/upgrade-db.php"
+	cd $scriptdir; php db/upgrade-db.php
+	echo "Running php utils/normalize_roles.php"
+	cd $scriptdir; php utils/normalize_roles.php
+}
+
+install6_upgrade_redhat()
+{
+	install6_upgrade
+}
+
+install6_upgrade_suse()
+{
+	install6_upgrade
+}
+
+install6_upgrade_debian()
+{
+	echo "TODO"
+}
+
+install6_upgrade_ubuntu()
+{
+	echo "TODO"
+}
+
+install6_upgrade_unknown()
+{
+	echo "TODO"
+}

Modified: trunk/src/install-ng
===================================================================
--- trunk/src/install-ng	2011-09-27 12:14:41 UTC (rev 14490)
+++ trunk/src/install-ng	2011-09-27 12:16:33 UTC (rev 14491)
@@ -4,7 +4,7 @@
 #
 # Usage: ./install-ng <hostname>
 #
-# This will install all the fusionforge code in /opt/gforge
+# This will install all the fusionforge code in $FORGE_HOME
 # Configuration is stored in /etc/gforge
 #
 # Currently supported:
@@ -14,6 +14,8 @@
 # Author: Alain Peyrat <aljeux at free.fr>
 #         Christian Bayle <bayle at debian.org>
 #
+FORGE_HOME=/opt/gforge
+
 usage(){
 	echo "Usage: $1 [-r|-h|-a|--reinit|--help|--auto|--deps|--files|--database|--config] [<hostname>]"
 }
@@ -65,8 +67,15 @@
 # Load some script
 scriptdir=`cd \`dirname $0\`; pwd`
 . $scriptdir/install/detect_os
-. $scriptdir/install/config
 
+FUSIONFORGE_DEFAULT_SRC_DIR=$(cd $(dirname $0); pwd)
+FUSIONFORGE_DEFAULT_DIR=$FUSIONFORGE_DEFAULT_SRC_DIR
+fusionforge_src_dir=${FUSIONFORGE_SRC_DIR:-$FUSIONFORGE_DEFAULT_SRC_DIR}
+fusionforge_dir=${FUSIONFORGE_DIR:-$FUSIONFORGE_DEFAULT_DIR}
+fusionforge_data_dir=${FUSIONFORGE_DATA_DIR:-/var/lib/gforge}
+fusionforge_log_dir=${FUSIONFORGE_LOG_DIR:-/var/log/gforge}
+fusionforge_etc_dir=${FUSIONFORGE_ETC_DIR:-/etc/gforge}
+
 # Call to detect_os, this will set $type and $distrib
 os=$(detect_os)
 type=$(detect_type)
@@ -82,6 +91,8 @@
 . $scriptdir/install/install2
 . $scriptdir/install/install3
 . $scriptdir/install/install4
+. $scriptdir/install/install5_post
+. $scriptdir/install/install6_upgrade
 
 if $AUTO
 then
@@ -99,7 +110,7 @@
 	dropdbifexists $FFORGE_DB
 fi
 
-if [ -d "/opt/gforge" ]
+if [ -d "$FORGE_HOME" ]
 then
 	if [ -f "/etc/gforge/install_completed" ]
 	then
@@ -115,129 +126,36 @@
 fi
 
 echo "Install type = $type"
-case $type in 
-	redhat)
-	if $DEFAULT || $FILES
+if $DEFAULT || $FILES
+then
+	install2_files_$type "$hostname"
+fi
+
+if [ "$mode" = "install" ]
+then
+	if $DEFAULT || $DATABASE
 	then
-		echo "Running install2_files "$hostname" apache apache"
-		install2_files "$hostname" apache apache
+		echo "Running install3_db_$type"
+		install3_db_$type
 	fi
-	if [ "$mode" = "install" ]
+	if $DEFAULT || $CONFIG
 	then
-		if $DEFAULT || $DATABASE
-		then
-			echo "Running install3_db"
-			install3_db
-		fi
-		if $DEFAULT || $CONFIG
-		then
-			echo "Running install4_config"
-			install4_config
-		fi
-		if $DEFAULT
-		then
-			# Post installation fixes.
-			perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/httpd/conf/httpd.conf
-			# Disable ssl
-			perl -spi -e "s/^Include/#Include/" /etc/gforge/httpd.conf.d/ssl-on.inc
-	
-			chkconfig httpd on
-			chkconfig postgresql on
-			chkconfig iptables off
-	
-			service httpd restart
-			service iptables stop
-			msg="IMPORTANT: Service iptables (firewall) disabled, please reconfigure after"
-	
-			cp $scriptdir/packaging/cron.d/cron.fusionforge /etc/cron.d
-			cp $scriptdir/plugins/*/etc/cron.d/* /etc/cron.d/
-			service crond reload
-		fi
-	else
-		if $DEFAULT
-		then
-			echo "Running php db/upgrade-db.php"
-			cd $scriptdir; php db/upgrade-db.php
-			echo "Running php utils/normalize_roles.php"
-			cd $scriptdir; php utils/normalize_roles.php
-		fi
+		echo "Running install4_config_$type"
+		install4_config_$type
 	fi
-	;;
-
-	suse)
-	if $DEFAULT || $FILES
+	if $DEFAULT
 	then
-		install2_files "$hostname" wwwrun www
+		echo "Running install5_post_$type"
+		install5_post_$type "$hostname"
 	fi
-	if [ $mode = "install" ]
+else
+	if $DEFAULT
 	then
-		if $DEFAULT || $DATABASE
-		then
-			echo "Running install3_db"
-			install3_db
-		fi
-		if $DEFAULT || $CONFIG
-		then
-			echo "Running install4_config"
-			install4_config
-		fi
-		if $DEFAULT
-		then
-			# Post installation fixes.
-			#perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/apache2/httpd.conf
-	
-			chkconfig -s apache2 on
-			chkconfig -s postgresql on
-	
-			# Apache settings: modules
-			for m in dav dav_svn authz_svn ssl; do
-				a2enmod $m
-				a2enflag $m
-			done
-			echo "Virtual hosts for ${hostname}:"
-			httpd2 -S -DSSL 2>&1 | grep ${hostname}
-
-			rcapache2 restart
-
-			rcSuSEfirewall2 stop
-			msg="IMPORTANT: Service SuSEfirewall2 stopped, please reconfigure after"
-
-			cp $scriptdir/packaging/cron.d/cron.fusionforge /etc/cron.d
-			cp $scriptdir/plugins/*/etc/cron.d/* /etc/cron.d/
-			rccron reload
-		fi
-	else
-		if $DEFAULT
-		then
-			echo "Running php db/upgrade-db.php"
-			cd $scriptdir; php db/upgrade-db.php
-			echo "Running php utils/normalize_roles.php"
-			cd $scriptdir; php utils/normalize_roles.php
-		fi
+		echo "Running install6_upgrade_$type"
+		install6_upgrade_$type
 	fi
-	;;
+fi
 
-	ubuntu)
-	echo "--"
-	echo "For ubuntu, rather use ubuntu $distrib package"
-	echo "SEE https://fusionforge.org/mediawiki/index.php/Installing/UbuntuRepositories"
-	echo "--"
-	;;
-
-	debian)
-	echo "--"
-	echo "For debian, rather use debian $distrib package"
-	echo "SEE https://fusionforge.org/mediawiki/index.php/Installing/DebianRepositories"
-	echo "--"
-	;;
-	
-	*)
-	echo "Only Red Hat, Fedora or CentOS and OpenSUSE are supported by this script.";
-	echo "See INSTALL for normal installation";
-	exit 1
-	;;
-esac
-
 echo "check /etc/gforge/local.inc for $hostname specific FusionForge settings"
 echo "Write INSTALL COMPLETED"
 date >> /etc/gforge/install_completed




More information about the Fusionforge-commits mailing list