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

Christian Bayle cbayle at fusionforge.org
Sun Jun 19 10:17:11 CEST 2011


Author: cbayle
Date: 2011-06-19 10:17:11 +0200 (Sun, 19 Jun 2011)
New Revision: 13523

Added:
   trunk/src/install-ng
   trunk/src/install/
   trunk/src/install/config
   trunk/src/install/deps
   trunk/src/install/detect_os
   trunk/src/install/install2
   trunk/src/install/install3
   trunk/src/install/install4
Log:
Preliminary work to merge install stuff between various install


Added: trunk/src/install/config
===================================================================
--- trunk/src/install/config	                        (rev 0)
+++ trunk/src/install/config	2011-06-19 08:17:11 UTC (rev 13523)
@@ -0,0 +1,6 @@
+#! /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}

Added: trunk/src/install/deps
===================================================================
--- trunk/src/install/deps	                        (rev 0)
+++ trunk/src/install/deps	2011-06-19 08:17:11 UTC (rev 13523)
@@ -0,0 +1,169 @@
+#! /bin/sh
+# FusionForge Installation Dependency Setup
+#
+# Copyright 2006 GForge, LLC
+# Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
+# Copyright (C) 2011 Christian Bayle
+# http://fusionforge.org/
+#
+# @version
+#
+# highly inspired from GInstaller
+#
+# FusionForge is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# FusionForge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with FusionForge; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+msg(){
+	GREEN="\033[01;32m"
+	NORMAL="\033[00m"
+	RED="\033[01;31m"
+	case $1 in
+		red)
+			echo "$RED $2 $NORMAL"
+			;;
+		green)
+			echo "$GREEN $2 $NORMAL"
+			;;
+	esac
+}
+
+
+install_redhat() {
+	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
+}
+
+install_debian() {
+	msg green "Installing packages: Executing apt-get. Please wait..."
+	apt-get -y install apache2 php5 php5-cli php5-pgsql cvs postgresql postgresql-contrib libipc-run-perl liburi-perl libapache2-svn libapache2-mod-php5 subversion subversion-tools php5-curl curl ssh lsb-release php-htmlpurifier
+	a2enmod headers
+	a2enmod proxy
+	a2enmod ssl
+	a2enmod rewrite
+	a2enmod vhost_alias
+	# TODO: automate next
+	msg red "You Must Install Mailman Manually: apt-get install mailman postfix"
+}
+
+# http://www.arklinux.org/
+install_ark() {
+	msg green "Installing packages: Executing apt-get. Please wait..."
+	apt-get update
+	apt-get -y install httpd php mailman cvs postgresql postgresql-libs postgresql-server postgresql-contrib perl-URI php-pgsql subversion subversion-server-httpd postfix rcs mod_ssl wget ssh
+
+	msg green "Restarting PostgreSQL"
+	/sbin/service postgresql restart
+
+	# TODO: automate next
+	msg red "You Must Install htmlpurifier manually."
+}
+
+install_suse() {
+	msg green "Installing Packages with yast"
+	yast -i php5 apache2-prefork php mailman cvs postgresql postgresql-libs postgresql-server postgresql-contrib perl-URI php4-pgsql subversion apache-mod_dav_svn ssh postfix rcs php4-gd mod_ssl perl-IPC-Run php4-curl wget subversion-server apache2-mod_php4
+
+	msg green "Fixing php4 installation"
+	cp /usr/lib/apache2-prefork/libphp4.so /usr/lib/apache2/mod_php.so
+
+	msg green "Stopping Apache"
+	/etc/init.d/apache2 stop
+
+	msg green "Restarting PostgreSQL"
+	/etc/init.d/postgresql stop
+	/etc/init.d/postgresql start
+
+	msg green "Starting Apache"
+	/etc/init.d/apache2 start
+
+	# TODO: automate next
+	msg red "You Must Install htmlpurifier manually."
+}
+
+install_opensuse() {
+	msg green "Installing Packages with yast"
+	yast -i php5 apache2-prefork apache2-mod_php5 cvs mailman perl-IPC-Run perl-URI php5 php5-curl php5-gd php5-gettext php5-pgsql postfix postgresql postgresql-contrib postgresql-libs postgresql-server rcs openssh subversion subversion-server wget viewvc
+
+	msg green "Restarting PostgreSQL..."
+	rcpostgresql restart
+	msg green "Restarting Apache..."
+	rcapache2 restart
+
+	# TODO: automate next
+	msg red "You Must Install htmlpurifier manually."
+}
+
+addFusionForgeYumRepo() {
+	if [ ! -f "/etc/yum.repos.d/fusionforge.repo" ]
+	then 
+		msg green "Adding Fusionforge YUM repository"
+		if [ -z "$FFORGE_RPM_REPO" ]
+		then 
+			rpm_repo="http://fusionforge.fusionforge.org/rpm/5.1"
+		else
+			rpm_repo="$FFORGE_RPM_REPO"
+		fi
+		cat > /etc/yum.repos.d/fusionforge.repo <<-END
+# Name: FusionForge RPM Repository
+# URL: http://fusionforge.org/
+[fusionforge]
+name = Red Hat Enterprise \$releasever - fusionforge.org
+baseurl = $rpm_repo
+enabled = 0
+protect = 0
+gpgcheck = 0';
+END
+	fi
+}
+
+addDagRPMForgeYumRepo() {
+	if [ ! -f "/etc/yum.repos.d/dag-rpmforge.repo" ]
+	then
+		msg green "Adding Dag RPMForge YUM repository" ]
+		if [ -z "$DAG_RPMFORGE_REPO" ]
+		then
+			rpm_repo="http://apt.sw.be/redhat"
+		else
+			rpm_repo="$DAG_RPMFORGE_REPO"
+		fi
+		cat > /etc/yum.repos.d/dag-rpmforge.repo <<-END
+# Name: RPMforge RPM Repository for Red Hat Enterprise 5 - dag
+# URL: http://rpmforge.net/
+[dag-rpmforge]
+name = Red Hat Enterprise \$releasever - RPMforge.net - dag
+baseurl = $rpm_repo/el5/en/\$basearch/dag
+#mirrorlist = http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
+enabled = 0
+protect = 0
+gpgcheck = 0';
+END
+	fi
+}
+
+install_centos(){
+	install_redhat
+}
+
+install_rhel(){
+	install_redhat
+}
+
+install_fedora(){
+	install_redhat
+}
+
+install_ubuntu(){
+	install_debian
+}


Property changes on: trunk/src/install/deps
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/install/detect_os
===================================================================
--- trunk/src/install/detect_os	                        (rev 0)
+++ trunk/src/install/detect_os	2011-06-19 08:17:11 UTC (rev 13523)
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# Simple OS detection script
+#
+# Usage: ./install.sh <hostname>
+#
+# This will install all the fusionforge code in /opt/gforge
+# Configuration is stored in /etc/gforge
+#
+# Currently supported:
+# * Red Hat 5 / CentOS 5
+# * OpenSuSE 11
+#
+# Authors: Christian Bayle <bayle at debian.org>
+#
+
+detect_os(){
+	distrib=""
+	if [ -f "/etc/redhat-release" ]
+	then
+		distrib=`awk '{print $1}' /etc/redhat-release`
+		case $distrib in
+			CentOS)
+				os=centos
+				;;
+			Red)
+				os=rhel
+				;;
+			Fedora)
+				os=fedora
+				;;
+			openSUSE)
+				os=opensuse
+				;;
+			*)
+				os=redhat_unknown
+				;;
+		esac
+	elif [ -f "/etc/SuSE-release" ]
+	then
+        	distrib=`awk '{print $1}' /etc/SuSE-release | head -n 1`
+		if grep -q openSUSE /etc/SuSE-release
+		then
+			os="opensuse"
+		else
+        		os="suse"
+		fi
+	elif [ -f "/etc/ubuntu_version" ]
+	then
+        	distrib=`awk '{print $1}' /etc/ubuntu_version`
+        	os="ubuntu"
+	elif [ -f "/etc/debian_version" ]
+	then
+        	distrib=`awk '{print $1}' /etc/debian_version`
+        	os="debian"
+	else
+		distrib="unknown"
+		os="unknown"
+	fi
+	echo $os
+}


Property changes on: trunk/src/install/detect_os
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/install/install2
===================================================================
--- trunk/src/install/install2	                        (rev 0)
+++ trunk/src/install/install2	2011-06-19 08:17:11 UTC (rev 13523)
@@ -0,0 +1,222 @@
+#! /bin/sh
+# FusionForge Installation Dependency Setup
+#
+# Copyright 2006 GForge, LLC
+# Copyright 2011 Christian Bayle <bayle at debian.org>
+# http://fusionforge.org/
+#
+# @version
+#
+# This file is part of GInstaller, it is called by install.sh.
+#
+# FusionForge is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# FusionForge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with FusionForge; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+msg(){
+	GREEN="\033[01;32m"
+	NORMAL="\033[00m"
+	RED="\033[01;31m"
+	case $1 in
+		red)
+			echo "$RED $2 $NORMAL"
+			;;
+		green)
+			echo "$GREEN $2 $NORMAL"
+			;;
+	esac
+}
+
+install2(){
+	hostname=$1
+	apacheuser=$2
+	apachegroup=$3
+	
+	if [ $# -ne 3 ]
+	then
+		msg red "Validating arguments: FAIL"
+		msg red "Usage: $0 fusionforge.org apacheuser apachegroup"
+		exit(127);
+	else
+		msg green "Validating arguments: OK"
+	fi
+
+	CHECK=`echo $hostname | grep -E "[^[:alnum:]\-]"`
+	if [ "$CHECK" != "" ] ; then
+		msg green "Validating hostname: OK";
+	else
+		msg red "Validating hostname: FAIL invalid hostname"
+	fi
+
+	if getent passwd $apacheuser > /dev/null
+	then
+		msg red "Invalid apache user"
+	 	exit 2
+	fi
+
+	if getent group $apachegroup > /dev/null
+	then
+		msg red "Invalid apache group"
+	 	exit 3
+	fi
+ 
+	insscriptdir=`cd \`dirname $0\`; pwd`
+	. $insscriptdir/config
+
+	for dir in $fusionforge_dir $fusionforge_data_dir $fusionforge_log_dir
+	do
+		if [ ! -d "$dir" ]
+		then
+			if mkdir -p $dir > /dev/null
+			then
+				msg green "Creating $dir : OK"
+			else
+				msg red "Creating $dir : FAILED"
+				msg red "$dir didn't exist - error - make sure you've got permission"
+				exit 4
+			fi
+		fi
+	done
+				
+	if [ "$fusionforge_dir" != "$fusionforge_src_dir" ]
+	then
+		cp -r * $fusionforge_dir
+	fi
+
+	mkdir -p $fusionforge_data_dir/uploads
+	mkdir -p $fusionforge_data_dir/scmtarballs
+	mkdir -p $fusionforge_data_dir/scmsnapshots
+	mkdir -p $fusionforge_data_dir/scmrepos/svn
+	mkdir -p $fusionforge_data_dir/scmrepos/cvs
+
+	mkdir -p $fusionforge_data_dir/etc
+	touch $fusionforge_data_dir/etc/httpd.vhosts
+
+	mkdir -p $fusionforge_data_dir/homedirs
+	mkdir -p /home/groups
+	if [ ! -d  $fusionforge_data_dir/homedirs/groups ]
+	then
+		ln -s /home/groups $fusionforge_data_dir/homedirs/groups
+	fi
+
+	if [ ! -d  $fusionforge_data_dir/scmrepos ]
+	then 
+		ln -s $fusionforge_data_dir/scmrepos /scmrepos
+	fi
+
+	# Create the old symlink /svnroot for compatibility.
+	if [ ! -d /svnroot ]
+	then 
+		ln -s $fusionforge_data_dir/scmrepos/svn /svnroot
+	fi
+		
+	# Create the old symlink /cvsroot for compatibility.
+	if [ ! -d /cvsroot ]
+	then 
+		ln -s $fusionforge_data_dir/scmrepos/cvs /cvsroot
+	fi
+	
+	# Create default dumps dir
+	mkdir -p $fusionforge_data_dir/dumps
+
+	cd $fusionforge_dir
+	chown -R root:$apachegroup $fusionforge_dir
+	chmod -R 644 $fusionforge_dir
+	cd $fusionforge_dir && find -type d | xargs chmod 755
+	chown -R $apacheuser:$apachegroup $fusionforge_data_dir/uploads
+	chmod -R 755 $fusionforge_dir/cronjobs/
+	chmod 755 $fusionforge_dir/www/scm/viewvc/bin/cgi/viewvc.cgi
+	chmod 755 $fusionforge_dir/utils/forge_get_config
+	chmod 755 $fusionforge_dir/utils/manage-apache-config.sh
+	$fusionforge_dir/utils/manage-apache-config.sh build
+	chmod 755 $fusionforge_dir/utils/manage-translations.sh
+	chmod 755 $fusionforge_dir/utils/migrate-to-ini-files.sh
+
+	#restricted shell for cvs accounts
+	cp $fusionforge_dir/plugins/scmcvs/bin/cvssh.pl /bin/
+	chmod 755 /bin/cvssh.pl
+
+	# Create default location for gforge config files
+	mkdir -p $fusionforge_etc_dir
+	if [ -f $fusionforge_etc_dir/httpd.conf ]
+	then
+		cp $fusionforge_dir/etc/httpd.conf-opt $fusionforge_etc_dir/httpd.conf
+	fi
+	mkdir -p $fusionforge_etc_dir/httpd.conf.d
+
+	ls $fusionforge_dir/etc/httpd.conf.d-opt/[0-9a-zA-Z_-]*.conf $fusionforge_dir/etc/httpd.conf.d-opt/[0-9a-zA-Z_-]*.inc | while read file
+	do
+		cp $file $fusionforge_etc_dir/httpd.conf.d/
+	done
+
+	cp $fusionforge_dir/etc/config.ini-opt $fusionforge_etc_dir/config.ini
+	cp -rL $fusionforge_dir/etc/config.ini.d $fusionforge_etc_dir/config.ini.d
+
+	# Install default configuration files for all plugins.
+	mkdir -p $fusionforge_etc_dir/plugins/
+
+	cd $fusionforge_dir/plugins
+	find $fusionforge_dir/plugins -type d -maxdepth 1 | while read plugdir
+	do
+		plugin=`basename $plugdir`
+		if [ -d $fusionforge_dir/plugins/$plugin/etc/plugins/$plugin ]
+		then 
+			cp -r $fusionforge_dir/plugins/$plugin/etc/plugins/$plugin $fusionforge_etc_dir/plugins/
+		fi
+	done
+		
+	for file in /etc/httpd/conf/httpd.conf /opt/csw/apache2/etc/httpd.conf /etc/apache2/httpd.conf
+	do
+		if [ -f $file ]
+		then 
+			msg green 'Setting FusionForge Include For Apache...'
+			if ! grep -q "^Include" $fusionforge_etc_dir/httpd.conf $file > /dev/null
+			then
+				echo "Include $fusionforge_etc_dir/httpd.conf" >> $file
+			fi
+		fi
+	done
+		
+	# Create symlink for the wiki plugin.
+	if [ ! -d $fusionforge_src_dir/www/wiki ]
+	then
+		ln -s ../plugins/wiki/www/ $fusionforge_src_dir/www/wiki
+	fi
+
+	# symlink plugin www's
+	cd $fusionforge_src_dir/www
+	if [ ! -d plugins ]
+	then
+		mkdir -p plugins
+	fi
+	for plugin in cvstracker svntracker message scmcvs fckeditor blocks authbuiltin
+	if [ ! -d $plugin ]
+	then
+		ln -s ../../plugins/$plugin/www/ $plugin
+	fi
+
+	cd $fusionforge_dir
+	if [ ! -d $fusionforge_etc_dir ]
+	then
+		msg red "/etc/gforge didn't exist - error - make sure you've got permission"
+		exit 2
+	fi
+	
+	chown -R root:$apachegroup $fusionforge_etc_dir
+	chmod -R 644 $fusionforge_etc_dir
+	cd $fusionforge_etc_dir && find -type d | xargs chmod 755
+	cd $fusionforge_etc_dir && find -type f -exec perl -pi -e "s/apacheuser/$apacheuser/" {} \;
+	cd $fusionforge_etc_dir && find -type f -exec perl -pi -e "s/apachegroup/$apachegroup/" {} \;
+	cd $fusionforge_etc_dir && find -type f -exec perl -pi -e "s/gforge.company.com/$hostname/" {} \;
+	echo "noreply:	/dev/null" >> /etc/aliases
+}


Property changes on: trunk/src/install/install2
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/install/install3
===================================================================
--- trunk/src/install/install3	                        (rev 0)
+++ trunk/src/install/install3	2011-06-19 08:17:11 UTC (rev 13523)
@@ -0,0 +1,315 @@
+#! /bin/sh
+# FusionForge Installation Dependency Setup
+#
+# Copyright 2006 GForge, LLC
+# Copyright 2011 Christian Bayle <bayle at debian.org>
+# http://fusionforge.org/
+#
+# @version
+#
+# This file is part of GInstaller, it is called by install.sh.
+#
+# FusionForge is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# FusionForge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with FusionForge; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+msg(){
+	GREEN="\033[01;32m"
+	NORMAL="\033[00m"
+	RED="\033[01;31m"
+	case $1 in
+		red)
+			echo "$RED $2 $NORMAL"
+			;;
+		green)
+			echo "$GREEN $2 $NORMAL"
+			;;
+	esac
+}
+
+create_db_admin_user(){
+	gforge_db="$1"
+	admin_user="$2"
+	su - postgres -c "psql $gforge_db -c \"INSERT INTO users (user_name, realname, firstname, lastname, email, user_pw, unix_pw, status, theme_id) VALUES ('$admin_user', 'Forge Admin', 'Forge', 'Admin', 'root at localhost.localdomain', 'INVALID', 'INVALID', 'A', 1); INSERT INTO user_group (user_id, group_id, admin_flags) VALUES (currval('users_pk_seq'), 1, 'A'); INSERT INTO pfo_user_role (user_id, role_id) VALUES (currval('users_pk_seq'), 3)\""
+}
+
+msg green "-=# Welcome to FusionForge DB-Installer #=-"
+
+find_psql_init(){
+	initpsql=""
+	for initpsql in /etc/init.d/postgresql /etc/init.d/postgresql-8.2 /etc/init.d/postgresql-8.3 /etc/init.d/postgresql-8.4 /etc/init.d/cswpostgres
+	do
+		if [ -f $initpsql ]
+		then
+			pgservice=$initpsql
+		fi
+	done
+	if [ -z "$pgservice" ]
+	then
+		exit 1
+	fi
+}
+		
+psql_startdb(){
+	# Fedora9 (an maybe newer) requires running initdb
+	if [ "$pgservice" == '/etc/init.d/postgresql' ]
+	then
+		if [ -d /var/lib/pgsql/data/base ]
+		then
+			service postgresql initdb &>/dev/null
+		fi
+	fi
+
+	# Might fail if it's already running, so we'll ingnore the result
+	$pgservice start
+}
+
+get_config(){
+	insscriptdir=`cd \`dirname $0\`; pwd`
+	. $insscriptdir/config
+
+	if [ ! -d "$fusionforge_src_dir" ]
+	then
+		msg red "Error: GForge folder doesn't exist. Run fusionforge-install-2.php first."
+		exit 2
+	fi
+}
+
+# Where the pghba config file is
+find_pghba(){
+	pghbafile=""
+	for pghbafile in /var/lib/pgsql/data/pg_hba.conf /etc/postgresql/8.2/main/pg_hba.conf /etc/postgresql/8.3/main/pg_hba.conf /etc/postgresql/8.4/main/pg_hba.conf /opt/csw/var/pgdata/pg_hba.conf
+	do
+		if [ -f $pghbafile ]
+		then
+			$pghba="$pghbafile"
+		fi
+	done
+	if [ -z "$pghba" ]
+	then
+		msg red "ERROR: Could not find pg_hba.conf file"
+		exit 1
+	fi
+}
+
+# Where the tsearch sql config file is
+find_tsearch(){
+	tsearchfile=""
+	for tsearchfile in /usr/share/pgsql/contrib/tsearch2.sql /usr/share/postgresql/8.2/contrib/tsearch2.sql /usr/share/postgresql/8.3/contrib/tsearch2.sql /usr/share/postgresql/8.4/contrib/tsearch2.sql /opt/csw/postgresql/share/contrib/tsearch2.sql
+	do
+		if [ -f $tsearchfile ]
+		then
+			$tsearch="$tsearchfile"
+		fi
+	done
+	if [ -z "$tsearch" ]
+	then
+		msg red "ERROR: Could not find tsearch2.sql file"
+		exit 1
+	fi
+}
+
+installandrundb()
+{
+	# USING $pghba, $fusionforge_src_dir, $fusionforge_etc_dir, $tsearch, $pgservice, $STDIN, $STDOUT;
+
+	if [ -z "$FFORGE_DB" ]
+	then
+		while test -z "$FFORGE_DB"
+		do
+			msg green "* Enter the Database Name (fusionforge): "
+			read FFORGE_DB
+		done
+	fi
+	gforge_db="$FFORGE_DB"
+	msg green " ...using $gforge_db"
+
+	if [ -z "$FFORGE_USER" ]
+	then
+		while test -z "$FFORGE_USER"
+		do
+			msg green "* Enter the Database Username (gforge): "
+			read FFORGE_USER
+		done
+	fi
+	gforge_user="$FFORGE_USER"
+	msg green " ...using $gforge_user"
+
+	msg green " * Modifying DB Access Permissions..."
+	
+	if [ ! -f $pghba.fforge.backup ]
+	then 
+		cp $pghba $pghba.fforge.backup
+	fi
+	cat > $pghba <<-EOF
+# FUSIONFORGE
+local all all trust
+EOF
+	msg green " * Restarting PostgreSQL..."
+	$pgservice stop
+	$pgservice start
+
+	msg green " * Creating $gforge_user Group..."
+	/usr/sbin/groupadd $gforge_user;
+
+	msg green " * Creating '$gforge_user' User..."
+	/usr/sbin/useradd -g $gforge_user $gforge_user
+	
+	# Let's give some time for PostgreSQL to start
+	sleep 5 
+
+	msg green " * Creating Database User $gforge_user..."
+	su - postgres -c "createuser -A -R -d -E $gforge_user"
+
+	msg green " * Creating Language..."
+	su - postgres -c "createlang plpgsql template1"
+
+	if [ -d /home/$gforge_user ]
+	then
+		$susufix = ''
+	else
+		$susufix = '-'
+	fi
+
+	msg green " * Creating $gforge_db Database..."
+	su $susufix $gforge_user -c "createdb --encoding UNICODE $gforge_db"
+
+	# Detect postgresql version, load tsearch2 for pg < 8.3
+	pgv=`postgres --version | cut -d" " -f3`
+	case $pgv in
+		7.*|8.1*|8.2*)
+			msg green " * Dumping tsearch2 Database Into $gforge_db DB"
+			su - postgres -c "psql $gforge_db < $tsearch" >> /tmp/gforge-import.log
+			for table in pg_ts_cfg pg_ts_cfgmap pg_ts_dict pg_ts_parser
+			do
+				su - postgres -c "psql $gforge_db -c \"GRANT ALL on $table TO $gforge_user\";"
+			done
+			su - postgres -c "psql $gforge_db -c \"UPDATE pg_ts_cfg SET locale='en_US.UTF-8' WHERE ts_name='default'\""
+			;;
+	esac
+
+	msg green " * Dumping FusionForge DB"
+	su $susufix $gforge_user -c "psql $gforge_db < $fusionforge_src_dir/db/gforge.sql" >> /tmp/gforge-import.log
+
+	if [ -z "$FFORGE_ADMIN_USER" ]
+	then
+		while test -z "$FFORGE_ADMIN_USER"
+		do
+			msg green " * Enter the Admin Username (fforgeadmin): "
+			read FFORGE_ADMIN_USER
+		done
+	fi
+	admin_user=$FFORGE_ADMIN_USER
+	msg green " ...using $admin_user"
+
+	if [ -z "$FFORGE_ADMIN_PASSWORD" ]
+	then
+		retry=5
+		while test -z "$FFORGE_ADMIN_PASSWORD" -a $retry -gt 0
+		do
+			msg green " * Enter the Site Admin Password:"
+			read -s FFORGE_ADMIN_PASSWORD1
+			if validatePassword "$FFORGE_ADMIN_PASSWORD1"
+			then
+				msg green " * Please enter it again:"
+				read -s FFORGE_ADMIN_PASSWORD2
+				if [ "FFORGE_ADMIN_PASSWORD1" == "FFORGE_ADMIN_PASSWORD2" ]
+				then
+					FFORGE_ADMIN_PASSWORD=$FFORGE_ADMIN_PASSWORD1
+				else
+					msg green "Passwords don't match. Please try again."
+				fi
+			fi
+			retry=`expr $retry - 1`
+		done
+		if [ -z "$FFORGE_ADMIN_PASSWORD" ]
+		then
+			msg green "Passwords didn't match! Aborting."
+			exit 1
+		else
+			create_db_admin_user "$gforge_db" "$admin_user"
+			forge_set_password "$admin_user" "$FFORGE_ADMIN_PASSWORD"
+		fi
+	fi
+}
+
+forge_save_db_config(){
+	if [ ! -f "$fusionforge_etc_dir" ]
+	then
+		mkdir $fusionforge_etc_dir
+	fi
+	if [ ! -f "$fusionforge_etc_dir/config.ini.d" ]
+	then
+		mkdir $fusionforge_etc_dir/config.ini.d
+	fi
+	
+	msg green " * Saving database configuration in FForge config file"
+	if [ ! -f "$fusionforge_etc_dir/config.ini.d/rpm-install.ini" ]
+	then
+		cat > $fusionforge_etc_dir/config.ini.d/rpm-install.ini <<-EOF
+; You can edit the values here or move them to other files.
+[core]
+forge_name=FusionForge
+web_host=`hostname -f`
+
+; This file was generated by the RPM installation system.
+EOF
+	fi
+
+	if [ ! -f "$fusionforge_etc_dir/config.ini.d/rpm-install-secrets.ini" ]
+	then
+		cat > $fusionforge_etc_dir/config.ini.d/rpm-install-secrets.ini <<-EOF
+; You can edit the values here or move them to other files.
+; These values should not go into world-readable files!
+
+[core]
+database_host=""
+database_name=$gforge_db
+database_user=$gforge_user
+database_port=5432
+; database_password=$pw
+
+; This file was generated by the RPM installation system.
+EOF
+	fi
+	msg green " * Saving installation log in /tmp/gforge-import.log"
+}
+
+validatePassword() {
+	password="$1"
+	strlen=`echo "$1" | wc -m`
+	if [ $strlen -le 7 ]
+	then
+		msg red "Password is too short. Please try again"
+		return 1
+	fi
+        CHECK=`echo $password | grep -E "[[:alnum:]]*"`
+        if [ "$CHECK" == "" ] ; then
+        then
+                msg red "Password contains invalid characters. Please try again."
+		return 2
+	else
+		return 0
+        fi
+}
+
+install3(){
+	find_psql_init
+	psql_startdb
+	get_config
+	find_pghba
+	find_tsearch
+	installandrundb
+	forge_save_db_config
+	msg green "Done."
+}


Property changes on: trunk/src/install/install3
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/install/install4
===================================================================
--- trunk/src/install/install4	                        (rev 0)
+++ trunk/src/install/install4	2011-06-19 08:17:11 UTC (rev 13523)
@@ -0,0 +1,37 @@
+#! /bin/sh
+# FusionForge Installation Dependency Setup
+#
+# Copyright 2011 Christian Bayle <bayle at debian.org>
+# http://fusionforge.org/
+#
+# @version
+#
+# This file is part of GInstaller, it is called by install.sh.
+#
+# FusionForge is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# FusionForge is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with FusionForge; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+install4(){
+	if [ -f "/etc/gforge/local.inc" ]
+	then
+		PATH=/opt/gforge/utils/:$PATH migrate-to-ini-files.sh
+	fi
+	
+	PATH=/opt/gforge/utils/:$PATH manage-apache-config.sh install
+	
+	ls /etc/gforge/httpd.conf.d/*.generated | while read i
+	do
+		mv $i ${i%%.generated}
+	done
+}


Property changes on: trunk/src/install/install4
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/src/install-ng
===================================================================
--- trunk/src/install-ng	                        (rev 0)
+++ trunk/src/install-ng	2011-06-19 08:17:11 UTC (rev 13523)
@@ -0,0 +1,137 @@
+#!/bin/dash
+#
+# Simple wrapper for FusionForge installation
+#
+# Usage: ./install.sh <hostname>
+#
+# This will install all the fusionforge code in /opt/gforge
+# Configuration is stored in /etc/gforge
+#
+# Currently supported:
+# * Red Hat 5 / CentOS 5
+# * OpenSuSE 11 (contributed by Martin Bernreuther)
+#
+# Author: Alain Peyrat <aljeux at free.fr>
+#         Christian Bayle <bayle at debian.org>
+#
+scriptdir=`cd \`dirname $0\`; pwd`
+. $scriptdir/install/detect_os
+
+hostname=$1
+
+if [ ! "$hostname" ]
+then
+	hostname=`hostname -f`
+fi
+
+# Call to detect_os, this will set $type and $distrib
+os=$(detect_os)
+
+if [ -d "/opt/fusionforge" ]
+then
+	mode="update"
+	echo "Upgrading previous installation ...";
+else
+	mode="install"
+	echo "Installing FusionForge ...";
+fi
+
+. $scriptdir/install/deps
+deps_$os
+
+. $scriptdir/install/install2
+. $scriptdir/install/install3
+. $scriptdir/install/install4
+
+echo "Install type = $type"
+if [ "$type" = "redhat" ]
+then
+	echo "Running install/install2 "$hostname" apache apache"
+	install2 "$hostname" apache apache
+
+	if [ $mode = "install" ]
+	then
+		echo "Running install/install3"
+		install3
+		echo "Running php db/upgrade-db.php"
+		php db/upgrade-db.php
+		echo "Running install/install4"
+		install4
+
+		# 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 packaging/cron.d/cron.fusionforge /etc/cron.d
+		cp plugins/*/etc/cron.d/* /etc/cron.d/
+		service crond reload
+	else
+		echo "Running php db/upgrade-db.php"
+		php db/upgrade-db.php
+		php utils/normalize_roles.php
+	fi
+elif [ "$type" = "suse" ]
+then
+	install2 "$hostname" wwwrun www
+
+	if [ $mode = "install" ]
+	then
+		install3
+		php db/upgrade-db.php
+		install4
+
+		# 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 packaging/cron.d/cron.fusionforge /etc/cron.d
+		cp plugins/*/etc/cron.d/* /etc/cron.d/
+		rccron reload
+	else
+		php db/upgrade-db.php
+	fi
+elif [ $type = "ubuntu" ]
+then
+	echo "--"
+	echo "For ubuntu, rather use ubuntu $distrib package"
+	echo "SEE https://fusionforge.org/mediawiki/index.php/Installing/UbuntuRepositories"
+	echo "--"
+elif [ $type = "debian" ]
+then
+	echo "--"
+	echo "For debian, rather use debian $distrib package"
+	echo "SEE https://fusionforge.org/mediawiki/index.php/Installing/DebianRepositories"
+	echo "--"
+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 "check /etc/gforge/local.inc for ${hostname} specific FusionForge settings"
+echo -e $msg;
+exit 0;


Property changes on: trunk/src/install-ng
___________________________________________________________________
Added: svn:executable
   + *




More information about the Fusionforge-commits mailing list