2016-04-29 13:24:22 -06:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
2016-09-29 17:57:50 +01:00
|
|
|
#move to script directory so all relative paths work
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
|
2017-04-23 01:49:16 -06:00
|
|
|
#includes
|
2017-03-04 12:51:05 -07:00
|
|
|
. ./config.sh
|
2016-09-30 23:59:58 +01:00
|
|
|
. ./colors.sh
|
2016-09-29 17:57:50 +01:00
|
|
|
|
2016-04-29 13:24:22 -06:00
|
|
|
#send a message
|
2016-09-29 17:57:50 +01:00
|
|
|
verbose "Installing FusionPBX"
|
2016-04-29 13:24:22 -06:00
|
|
|
|
|
|
|
|
#install dependencies
|
2016-05-13 22:02:36 +01:00
|
|
|
apt-get install -y --force-yes vim git dbus haveged ssl-cert
|
2017-06-10 18:50:59 +01:00
|
|
|
apt-get install -y --force-yes ghostscript libtiff5-dev libtiff-tools at
|
2016-04-29 13:24:22 -06:00
|
|
|
|
2017-04-23 01:44:41 -06:00
|
|
|
#get the branch
|
2017-05-10 13:56:24 -06:00
|
|
|
if [ .$system_branch = .'master' ]; then
|
2016-11-25 13:58:10 -07:00
|
|
|
verbose "Using master"
|
2017-03-04 13:44:28 -07:00
|
|
|
branch=""
|
2016-11-25 13:58:10 -07:00
|
|
|
else
|
2017-03-04 13:44:28 -07:00
|
|
|
system_major=$(git ls-remote --heads https://github.com/fusionpbx/fusionpbx.git | cut -d/ -f 3 | grep -P '^\d+\.\d+' | sort | tail -n 1 | cut -d. -f1)
|
|
|
|
|
system_minor=$(git ls-remote --tags https://github.com/fusionpbx/fusionpbx.git $system_major.* | cut -d/ -f3 | grep -P '^\d+\.\d+' | sort | tail -n 1 | cut -d. -f2)
|
|
|
|
|
system_version=$system_major.$system_minor
|
|
|
|
|
verbose "Using version $system_version"
|
|
|
|
|
branch="-b $system_version"
|
2016-09-29 17:57:50 +01:00
|
|
|
fi
|
|
|
|
|
|
2016-04-29 13:24:22 -06:00
|
|
|
#get the source code
|
2017-03-04 13:44:28 -07:00
|
|
|
git clone $branch https://github.com/fusionpbx/fusionpbx.git /var/www/fusionpbx
|
2016-04-29 13:24:22 -06:00
|
|
|
chown -R www-data:www-data /var/www/fusionpbx
|
2016-09-15 14:14:32 -06:00
|
|
|
chmod -R 755 /var/www/fusionpbx/secure
|