3 # Simple wrapper for FusionForge installation
5 # Usage: ./install-ng <hostname>
7 # This will install all the fusionforge code in $FORGE_HOME
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>
17 FORGE_HOME=/opt/gforge
20 echo "Usage: $1 [-r|-h|-a|--reinit|--help|--auto|--deps|--files|--database|--config] [<hostname>]"
23 options=`getopt -o rha -l reinit,help,auto,deps,files,database,config -- "$@"`
25 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; usage $0 ;exit 1 ; fi
27 eval set -- "$options"
29 if [[ $EUID -ne 0 ]]; then
30 echo "This script must be run as root" 1>&2
37 # Install dependancies files database config by default
40 # Install dependancies
52 -r|--reinit) REINIT=true; shift 1;;
53 -h|--help) usage $0 ; exit 0; shift 1;;
54 -a|--auto) AUTO=true ; shift 1;;
55 --deps) DEFAULT=false ; DEPS=true ; shift 1;;
56 --files) DEFAULT=false ; FILES=true ; shift 1;;
57 --database) DEFAULT=false ; DATABASE=true ; shift 1;;
58 --config) DEFAULT=false ; CONFIG=true ; shift 1;;
68 hostname=`hostname -f`
70 echo "Using hostname=$hostname"
73 scriptdir=`cd \`dirname $0\`; pwd`
74 . $scriptdir/install/detect_os
76 FUSIONFORGE_DEFAULT_SRC_DIR=$(cd $(dirname $0); pwd)
77 FUSIONFORGE_DEFAULT_DIR=$FUSIONFORGE_DEFAULT_SRC_DIR
78 fusionforge_src_dir=${FUSIONFORGE_SRC_DIR:-$FUSIONFORGE_DEFAULT_SRC_DIR}
79 fusionforge_dir=${FUSIONFORGE_DIR:-$FUSIONFORGE_DEFAULT_DIR}
80 fusionforge_data_dir=${FUSIONFORGE_DATA_DIR:-/var/lib/gforge}
81 fusionforge_log_dir=${FUSIONFORGE_LOG_DIR:-/var/log/gforge}
82 fusionforge_etc_dir=${FUSIONFORGE_ETC_DIR:-/etc/gforge}
84 # Call to detect_os, this will set $type and $distrib
87 echo "Install type = $type"
91 # Load deps script and run the appropriate one
92 . $scriptdir/install/deps
96 # Load install scripts
97 . $scriptdir/install/install2
98 . $scriptdir/install/install3
99 . $scriptdir/install/install4
100 . $scriptdir/install/install5_post
101 . $scriptdir/install/install6_upgrade
105 echo "Using automatic configuration"
108 FFORGE_ADMIN_USER=admin
109 FFORGE_ADMIN_PASSWORD=myadmin
114 echo "Reinit the database"
115 rm -f /etc/gforge/install_completed
116 dropdbifexists $FFORGE_DB
119 if [ -d "$FORGE_HOME" ]
121 if [ -f "/etc/gforge/install_completed" ]
124 echo "Upgrading previous installation ...";
127 echo "Installing FusionForge ...";
131 echo "Installing FusionForge ...";
134 if $DEFAULT || $FILES
136 install2_files_$type "$hostname"
139 if [ "$mode" = "install" ]
141 if $DEFAULT || $DATABASE
143 echo "Running install3_db_$type"
146 if $DEFAULT || $CONFIG
148 echo "Running install4_config_$type"
149 install4_config_$type
153 echo "Running install5_post_$type"
154 install5_post_$type "$hostname"
159 echo "Running install6_upgrade_$type"
160 install6_upgrade_$type
164 echo "check /etc/gforge/local.inc for $hostname specific FusionForge settings"
165 echo "Write INSTALL COMPLETED"
166 date >> /etc/gforge/install_completed
167 ls -al /etc/gforge/install_completed