From bb2079323d627eb02a8b2a99244996da2f85663d Mon Sep 17 00:00:00 2001 From: Mafoo Date: Wed, 8 Jun 2016 14:04:57 +0100 Subject: [PATCH] Enhance Add bootstrap installer (#16) Added bootstrap installer to help simplify the install Checks for root Checks what OS (in a way that can be expanded) If > Debian 8 - Install Git - Fetch the rest of the installer - Start the Install passing though command line options --- README.md | 7 +------ debian/install.sh | 3 +++ install-linux.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 install-linux.sh diff --git a/README.md b/README.md index daa0bba..15d3dbf 100644 --- a/README.md +++ b/README.md @@ -4,12 +4,7 @@ fusionpbx-install.sh This install script that has been designed to be an fast, simple, and modular way to to install FusionPBX. Start with a minimal install of Debian 8 with SSH enabled. Run the following commands under root. It installs FusionPBX, FreeSWITCH release package and its dependencies, IPTables, Fail2ban, NGINX, PHP FPM, and PostgresQL. ```bash -apt-get update && apt-get upgrade && apt-get install -y ca-certificates git -cd /usr/src -git clone https://github.com/fusionpbx/fusionpbx-install.sh.git -chmod 755 -R /usr/src/fusionpbx-install.sh -cd /usr/src/fusionpbx-install.sh/debian -./install.sh +wget https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/install-linux.sh -O install-linux.sh && bash install-linux.sh ``` At the end of the install it will instruct you to go to the ip address of the server in your web browser to finish the install. It will also provide a random database password for you to use during the web based phase of the install. The install script builds the fusionpbx database so you will not need to use the create database username and password on the last page of the web based install. diff --git a/debian/install.sh b/debian/install.sh index fd74bc3..64d233b 100755 --- a/debian/install.sh +++ b/debian/install.sh @@ -33,6 +33,9 @@ if [ $HELP = true ]; then exit; fi +# removes the cd img from the /etc/apt/sources.list file (not needed after base install) +sed -i '/cdrom:/d' /etc/apt/sources.list + #Update Debian echo "Update Debian" apt-get upgrade && apt-get update -y --force-yes diff --git a/install-linux.sh b/install-linux.sh new file mode 100644 index 0000000..7741289 --- /dev/null +++ b/install-linux.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# check to confirm running as root. +if [ "$(id -u)" -ne "0" ]; then + echo "$(basename "$0") must be run as root"; + exit 1 +fi +echo + +#Os/Distro Check +check_OS=$(lsb_release -is) +check_Release_Major=$(lsb_release -rs | cut -d. -f1) +lsb_release -c | grep -i jessie > /dev/null + +function unsupported_OS { + echo " Your OS appears to be: " + lsb_release -a + echo " Your OS is not currently supported... Exiting the install." + echo "If you require assistance we are available via IRC on freenode via #fusionpbx" + exit 2; +} + +if [ $check_OS = 'Debian' ]; then + if [ $check_Release_Major -ge 8 ]; then + echo "Removing the cd img from /etc/apt/sources.list" + sed -i '/cdrom:/d' /etc/apt/sources.list + echo "Updating system before we start" + apt-get update && apt-get -y upgrade + echo "Installing git" + apt-get install -y git + cd /usr/src + echo "Fetching Installer" + if [ -d /usr/src/fusionpbx-install.sh ]; then + echo "Cannot continue you already have a installer downloaded" + exit 1 + fi + git clone https://github.com/fusionpbx/fusionpbx-install.sh + cd /usr/src/fusionpbx-install.sh/debian + ./install.sh $@ + else + echo "Although you are running Debian we require version >= 8" + unsupported_OS + fi +else + unsupported_OS +fi +echo "If you require assistance we are available via IRC on freenode via #fusionpbx" \ No newline at end of file