3 # Simple wrapper for FusionForge installation
5 # Usage: ./install-ng <hostname>
7 # This will install all the fusionforge code in /opt/gforge
8 # Configuration is stored in /etc/gforge
10 # Currently supported:
11 # * Red Hat 5 / CentOS 5
12 # * OpenSuSE 11 (contributed by Martin Bernreuther)
14 # Author: Alain Peyrat <aljeux@free.fr>
15 # Christian Bayle <bayle@debian.org>
18 echo "Usage: $1 [-r|-h|-a|--reinit|--help|--auto|--deps|--files|--database|--config] [<hostname>]"
21 options=`getopt -o rha -l reinit,help,auto,deps,files,database,config -- "$@"`
23 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; usage $0 ;exit 1 ; fi
25 eval set -- "$options"
30 # Install dependancies files database config by default
33 # Install dependancies
45 -r|--reinit) REINIT=true; shift 1;;
46 -h|--help) usage $0 ; exit 0; shift 1;;
47 -a|--auto) AUTO=true ; shift 1;;
48 --deps) DEFAULT=false ; DEPS=true ; shift 1;;
49 --files) DEFAULT=false ; FILES=true ; shift 1;;
50 --database) DEFAULT=false ; DATABASE=true ; shift 1;;
51 --config) DEFAULT=false ; CONFIG=true ; shift 1;;
61 hostname=`hostname -f`
63 echo "Using hostname=$hostname"
66 scriptdir=`cd \`dirname $0\`; pwd`
67 . $scriptdir/install/detect_os
68 . $scriptdir/install/config
70 # Call to detect_os, this will set $type and $distrib
76 # Load deps script and run the appropriate one
77 . $scriptdir/install/deps
81 # Load install scripts
82 . $scriptdir/install/install2
83 . $scriptdir/install/install3
84 . $scriptdir/install/install4
88 echo "Using automatic configuration"
91 FFORGE_ADMIN_USER=admin
92 FFORGE_ADMIN_PASSWORD=myadmin
97 echo "Reinit the database"
98 rm -f /etc/gforge/install_completed
99 dropdbifexists $FFORGE_DB
102 if [ -d "/opt/gforge" ]
104 if [ -f "/etc/gforge/install_completed" ]
107 echo "Upgrading previous installation ...";
110 echo "Installing FusionForge ...";
114 echo "Installing FusionForge ...";
117 echo "Install type = $type"
120 if $DEFAULT || $FILES
122 echo "Running install2_files "$hostname" apache apache"
123 install2_files "$hostname" apache apache
125 if [ "$mode" = "install" ]
127 if $DEFAULT || $DATABASE
129 echo "Running install3_db"
132 if $DEFAULT || $CONFIG
134 echo "Running install4_config"
139 # Post installation fixes.
140 perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/httpd/conf/httpd.conf
142 perl -spi -e "s/^Include/#Include/" /etc/gforge/httpd.conf.d/ssl-on.inc
145 chkconfig postgresql on
146 chkconfig iptables off
148 service httpd restart
149 service iptables stop
150 msg="IMPORTANT: Service iptables (firewall) disabled, please reconfigure after"
152 cp $scriptdir/packaging/cron.d/cron.fusionforge /etc/cron.d
153 cp $scriptdir/plugins/*/etc/cron.d/* /etc/cron.d/
159 echo "Running php db/upgrade-db.php"
160 cd $scriptdir; php db/upgrade-db.php
161 echo "Running php utils/normalize_roles.php"
162 cd $scriptdir; php utils/normalize_roles.php
168 if $DEFAULT || $FILES
170 install2_files "$hostname" wwwrun www
172 if [ $mode = "install" ]
174 if $DEFAULT || $DATABASE
176 echo "Running install3_db"
179 if $DEFAULT || $CONFIG
181 echo "Running install4_config"
186 # Post installation fixes.
187 #perl -spi -e "s/^#ServerName (.*):80/ServerName $hostname:80/" /etc/apache2/httpd.conf
189 chkconfig -s apache2 on
190 chkconfig -s postgresql on
192 # Apache settings: modules
193 for m in dav dav_svn authz_svn ssl; do
197 echo "Virtual hosts for ${hostname}:"
198 httpd2 -S -DSSL 2>&1 | grep ${hostname}
203 msg="IMPORTANT: Service SuSEfirewall2 stopped, please reconfigure after"
205 cp $scriptdir/packaging/cron.d/cron.fusionforge /etc/cron.d
206 cp $scriptdir/plugins/*/etc/cron.d/* /etc/cron.d/
212 echo "Running php db/upgrade-db.php"
213 cd $scriptdir; php db/upgrade-db.php
214 echo "Running php utils/normalize_roles.php"
215 cd $scriptdir; php utils/normalize_roles.php
222 echo "For ubuntu, rather use ubuntu $distrib package"
223 echo "SEE https://fusionforge.org/mediawiki/index.php/Installing/UbuntuRepositories"
229 echo "For debian, rather use debian $distrib package"
230 echo "SEE https://fusionforge.org/mediawiki/index.php/Installing/DebianRepositories"
235 echo "Only Red Hat, Fedora or CentOS and OpenSUSE are supported by this script.";
236 echo "See INSTALL for normal installation";
241 echo "check /etc/gforge/local.inc for $hostname specific FusionForge settings"
242 echo "Write INSTALL COMPLETED"
243 date >> /etc/gforge/install_completed
244 ls -al /etc/gforge/install_completed