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 # Copyright 2014, Franck Villaume - TrivialDev
19 FORGE_HOME=/opt/gforge
22 echo "Usage: $1 [-r|-h|-a|--reinit|--help|--auto|--deps|--files|--database|--config] [<hostname>]"
25 options=`getopt -o rha -l reinit,help,auto,deps,files,database,config -- "$@"`
27 if [ $? != 0 ] ; then echo "Terminating..." >&2 ; usage $0 ;exit 1 ; fi
29 eval set -- "$options"
31 if [[ $EUID -ne 0 ]]; then
32 echo "This script must be run as root" 1>&2
39 # Install dependancies files database config by default
42 # Install dependancies
54 -r|--reinit) REINIT=true; shift 1;;
55 -h|--help) usage $0 ; exit 0; shift 1;;
56 -a|--auto) AUTO=true ; shift 1;;
57 --deps) DEFAULT=false ; DEPS=true ; shift 1;;
58 --files) DEFAULT=false ; FILES=true ; shift 1;;
59 --database) DEFAULT=false ; DATABASE=true ; shift 1;;
60 --config) DEFAULT=false ; CONFIG=true ; shift 1;;
70 hostname=`hostname -f`
72 if [ -z "${hostname}" ]
74 echo "Missing hostname"
79 echo "Using hostname=$hostname"
82 scriptdir=`cd \`dirname $0\`; pwd`
83 . $scriptdir/install/detect_os
85 FUSIONFORGE_DEFAULT_SRC_DIR=$(cd $(dirname $0); pwd)
86 FUSIONFORGE_DEFAULT_DIR=$FORGE_HOME
87 fusionforge_src_dir=${FUSIONFORGE_SRC_DIR:-$FUSIONFORGE_DEFAULT_SRC_DIR}
88 fusionforge_dir=${FUSIONFORGE_DIR:-$FUSIONFORGE_DEFAULT_DIR}
89 fusionforge_data_dir=${FUSIONFORGE_DATA_DIR:-/var/lib/gforge}
90 fusionforge_log_dir=${FUSIONFORGE_LOG_DIR:-/var/log/gforge}
91 fusionforge_etc_dir=${FUSIONFORGE_ETC_DIR:-/etc/gforge}
93 # Call to detect_os, this will set $type and $distrib
96 echo "Install type = $type"
97 targetversion=$(detect_version)
98 echo "Target version (if any) = $targetversion"
102 # Load deps script and run the appropriate one
103 . $scriptdir/install/deps
107 # Load install scripts
108 . $scriptdir/install/install2
109 . $scriptdir/install/install3
110 . $scriptdir/install/install4
111 . $scriptdir/install/install5_post
112 . $scriptdir/install/install6_upgrade
116 echo "Using automatic configuration"
119 FFORGE_ADMIN_USER=admin
120 FFORGE_ADMIN_PASSWORD=myadmin
125 echo "Reinit the database"
126 rm -f /etc/gforge/install_completed
127 dropdbifexists $FFORGE_DB
130 if [ -d "$FORGE_HOME" ]
132 if [ -f "/etc/gforge/install_completed" ]
135 echo "Upgrading previous installation ...";
138 echo "Installing FusionForge ...";
142 echo "Installing FusionForge ...";
145 if $DEFAULT || $FILES
147 install2_files_$type "$hostname"
150 if [ "$mode" = "install" ]
152 if $DEFAULT || $DATABASE
154 echo "Running install3_db_$type"
157 if $DEFAULT || $CONFIG
159 echo "Running install4_config_$type"
160 install4_config_$type
164 echo "Running install5_post_$type"
165 install5_post_$type "$hostname"
170 echo "Running install6_upgrade_$type"
171 install6_upgrade_$type
175 echo "check /etc/gforge/local.inc for $hostname specific FusionForge settings"
176 echo "Write INSTALL COMPLETED"
177 date >> /etc/gforge/install_completed
178 ls -al /etc/gforge/install_completed