Professional Documents
Culture Documents
/bin/bash
# install_fusionpbx
#-----------------------------------------------------------------------------DELIM
)
#--------#VARIABLES
#--------#Variables are for the auto installation option.
#for apache set to a, for nginx/php-fpm set to n -> for an auto install, user mode will prompt
APACHENGINX=n
# default distro
#DISTRO=precise
#DISTRO=squeeze
#DISTRO=precise
#DISTRO=lucid
#DISTRO=wheezy
DISTRO=trusty
#------#DEFINES
#------VERSION="Version - using subversion, no longer keeping track. WAF License"
#latest release
FPBXBRANCH="http://fusionpbx.googlecode.com/svn/trunk/fusionpbx"
#dev branch
#FPBXBRANCH="http://fusionpbx.googlecode.com/svn/branches/dev/fusionpbx"
# Modules_comp_default determined using
# grep -v ^$ /usr/src/freeswitch/modules.conf |grep -v ^# | tr '\n' ' '
# on FreeSWITCH version FreeSWITCH Version 1.0.head (git-8f2ee97 2010-12-05 17-19-28
-0600)
#modules_comp_default=( loggers/mod_console loggers/mod_logfile loggers/mod_syslog
applications/mod_commands applications/mod_conference applications/mod_dptools
applications/mod_enum applications/mod_fifo applications/mod_db applications/mod_hash
applications/mod_voicemail applications/mod_expr applications/mod_esf applications/mod_fsv
applications/mod_spandsp applications/mod_cluechoo applications/mod_valet_parking
codecs/mod_g723_1 codecs/mod_amr codecs/mod_g729 codecs/mod_h26x codecs/mod_bv
codecs/mod_ilbc codecs/mod_speex codecs/mod_siren dialplans/mod_dialplan_xml
dialplans/mod_dialplan_asterisk endpoints/mod_sofia endpoints/mod_loopback
event_handlers/mod_event_socket event_handlers/mod_cdr_csv formats/mod_native_file
formats/mod_sndfile formats/mod_local_stream formats/mod_tone_stream
#staying with default repository, feel free to change this to github. Some report faster
downloads.
FSGIT=https://freeswitch.org/stash/scm/fs/freeswitch.git
#FSGIT=https://stash.freeswitch.org/scm/fs/freeswitch.git
#FSGIT=git://github.com/FreeSWITCH/FreeSWITCH.git
FSSTABLE=true
FSStableVer="v1.4"
GUI_NAME=fusionpbx
INST_FPBX=svn
#INST_FPBX=tgz
#--------# NOTES
#--------# This Script installs or upgrades FreeSWITCH and FusionPBX on a fresh install of
# Ubuntu 10.04 LTS [lucid]. It tries to edit all appropriate files, and
# set the permissions correctly.
#When you install ubuntu, you should select the "Manual package selection" option.
#This way we can keep the install to the bare minimum. This script will install
#everything you need (and nothing) - hopefully, you don't. Just quit tasksel
#--------#FUNCTIONS
#--------function nativepgsql {
/bin/echo
/bin/echo "By default, FreeSWITCH is using sqlite, until we tell it not to."
/bin/echo "FreeSWITCH can be configured to use postgresql natively, but it is"
/bin/echo "not always advantageous to do so."
read -p " Use Postgres (p) or Sqlite (s) [p/S]? " FSDB
case $FSDB in
[pP])
#tell FS about the postgresql database...
echo " Please type in the password for the freeswitch database
you configured below."
read -p "Password: " FSDBPASS
FPATH="/var/www/fusionpbx/resources/templates/conf"
/bin/echo "setting switch.conf.xml"
sed -i $FPATH/autoload_configs/switch.conf.xml -e
s,\<\/settings\>,,g -e s,\<\/configuration\>,,g
cat >> $FPATH/autoload_configs/switch.conf.xml <<EOF
</settings>
</configuration>
EOF
</settings>
</configuration>
EOF
</settings>
</configuration>
EOF
</settings>
</configuration>
EOF
</settings>
</configuration>
EOF
</settings>
</configuration>
EOF
;;
*)
/bin/echo "Ok, using sqlite, nothing more to do here."
;;
esac
function nginxconfig {
apt-get install -y ssl-cert
ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/nginx.key
ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/nginx.crt
ln -s /etc/ssl/certs/nginx.crt $WWW_PATH/$GUI_NAME/$HOSTNAME.crt
client_max_body_size 10M;
client_body_buffer_size 128k;
location / {
root $WWW_PATH/$GUI_NAME;
index index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $WWW_PATH/$GUI_NAME\
$fastcgi_script_name;
}
location ~ .htaccess {
deny all;
}
location ~ .htpassword {
deny all;
}
location ~^.+.(db)$ {
deny all;
}
}
server {
listen 80;
server_name $GUI_NAME;
#grandstream
rewrite "^.*/provision/cfg([A-Fa-f0-9]{12})(\.(xml|cfg))?$" /app/provision/?mac=\$1;
#aastra
#rewrite "^.*/provision/([A-Fa-f0-9]{12})(\.(cfg))?$" /app/provision/?mac=\$1 last;
#yealink common
rewrite "^.*/(y[0-9]{12})(\.cfg)?$" /app/provision/index.php?file=\$1\$2;
#yealink mac
rewrite "^.*/([A-Fa-f0-9]{12})(\.(xml|cfg))?$" /app/provision/index.php?mac=\$1 last;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
client_max_body_size 10M;
client_body_buffer_size 128k;
location / {
root $WWW_PATH/$GUI_NAME;
index index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $WWW_PATH/$GUI_NAME\
$fastcgi_script_name;
}
deny all;
}
}
server {
listen 443;
server_name $GUI_NAME;
ssl
on;
ssl_certificate
/etc/ssl/certs/nginx.crt;
ssl_certificate_key
ssl_protocols
ssl_ciphers
/etc/ssl/private/nginx.key;
SSLv3 TLSv1;
HIGH:!ADH:!MD5;
#grandstream
rewrite "^.*/provision/cfg([A-Fa-f0-9]{12})(\.(xml|cfg))?$" /app/provision/?mac=\$1;
#aastra
#rewrite "^.*/provision/([A-Fa-f0-9]{12})(\.(cfg))?$" /app/provision/?mac=\$1 last;
#yealink common
rewrite "^.*/(y[0-9]{12})(\.cfg)?$" /app/provision/index.php?file=\$1\$2;
#yealink mac
rewrite "^.*/([A-Fa-f0-9]{12})(\.(xml|cfg))?$" /app/provision/index.php?mac=\$1 last;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
client_max_body_size 10M;
client_body_buffer_size 128k;
location / {
root $WWW_PATH/$GUI_NAME;
index index.php;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php5-fpm.sock;
#fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $WWW_PATH/$GUI_NAME\
$fastcgi_script_name;
}
/etc/init.d/php5-fpm
/etc/init.d/nginx restart
}
function fusionfail2ban {
[Definition]
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
#
host must be matched by a group named "host". The tag "<HOST>" can
(?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values: TEXT
#
#failregex = [hostname] FusionPBX: \[<HOST>\] authentication failed
#[hostname] variable doesn't seem to work in every case. Do this instead:
failregex = .* FusionPBX: \[<HOST>\] authentication failed for
= .* FusionPBX: \[<HOST>\] provision attempt bad password for
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
DELIM
if [ $? -eq 0 ]; then
/bin/echo "FusionPBX Jail already set"
else
/bin/cat >> /etc/fail2ban/jail.local <<DELIM
[$GUI_NAME]
enabled = true
port
= 80,443
protocol = tcp
filter = $GUI_NAME
logpath = /var/log/auth.log
action = iptables-allports[name=$GUI_NAME, protocol=all]
#
sendmail-whois[name=$GUI_NAME, dest=root, sender=fail2ban@example.org] #no
smtp server installed
maxretry = 5
findtime = 600
bantime = 600
DELIM
fi
}
function www_permissions {
#consider not stopping here... it's causing some significant delays, or just pause until it
starts back up...
#/etc/init.d/freeswitch stop
/usr/sbin/adduser www-data audio
/usr/sbin/adduser www-data dialout
/bin/echo "setting FreeSWITCH owned by www-data.www-data"
/bin/chown -R www-data.www-data /usr/local/freeswitch
#remove 'other' permissions on freeswitch
/bin/chmod -R o-rwx /usr/local/freeswitch/
#set FreeSWITCH directories full permissions for user/group with group sticky
/bin/echo "Setting group ID sticky for FreeSWITCH"
/usr/bin/find /usr/local/freeswitch -type d -exec /bin/chmod u=rwx,g=srx,o= {} \;
#make sure FreeSWITCH directories have group write
/bin/echo "Setting Group Write for FreeSWITCH files"
/usr/bin/find /usr/local/freeswitch -type f -exec /bin/chmod g+w {} \;
#make sure FreeSWITCH files have group write
/bin/echo "Setting Group Write for FreeSWITCH directories"
/usr/bin/find /usr/local/freeswitch -type d -exec /bin/chmod g+w {} \;
/bin/echo "setting FusionPBX owned by www-data.www-data just in case"
if [ -e /var/www/fusionpbx ]; then
/bin/chown -R www-data.www-data /var/www/fusionpbx
fi
/bin/echo "Changing /etc/init.d/freeswitch to start with user www-data"
/bin/sed -i -e s,'USER=freeswitch','USER=www-data', /etc/init.d/freeswitch
#/etc/init.d/freeswitch start
}
function finish_fpbx_install_permissions {
/bin/echo
/bin/echo "The FusionPBX installation changed permissions of
/usr/local/freeswitch/storage"
/bin/echo " Waiting on you to finish installation (via browser), I'll clean up"
/bin/echo -ne " the last bit of permissions when you finish."
/bin/echo "Waiting on $WWW_PATH/$GUI_NAME/resources/config.php"
while [ ! -e $WWW_PATH/$GUI_NAME/resources/config.php ]
do
/bin/echo -ne '.'
sleep 1
done
/bin/echo
/bin/echo "$WWW_PATH/$GUI_NAME/resources/config.php Found!"
/bin/echo " Waiting 5 more seconds to be sure. "
SLEEPTIME=0
while [ "$SLEEPTIME" -lt 5 ]
do
/bin/echo -ne '.'
sleep 1
let "SLEEPTIME = $SLEEPTIME + 1"
done
function build_modules {
#bandaid
sed -i -e "s/applications\/mod_voicemail_ivr/#applications\/mod_voicemail_ivr/"
$SRCPATH/modules.conf
#-----------# new way v2
#-----------#find the default modules - redundant really...
modules_comp_default=( `/bin/grep -v ^$ /usr/src/freeswitch/modules.conf |/bin/grep -v
^# | /usr/bin/tr '\n' ' '` )
#add the directory prefixes to the modules in array so the modules we wish to add will
compile
module_count=`echo ${#modules_add[@]}`
index=0
while [ "$index" -lt "$module_count" ]
do
modules_compile_add[$index]=`/bin/grep ${modules_add[$index]}
$SRCPATH/modules.conf | sed -e "s/#//g"`
let "index = $index + 1"
done
[ENABLED] $
/bin/echo "
${modules_compile[$index]}
{modules_compile[$index]}"
else
ALREADY ENABLED!"
fi
else
#module is not present. Add to end of file
#/bin/echo "did not find ${modules_compile[$index]}"
/bin/echo ${modules_compile[$index]} >>
$SRCPATH/modules.conf
/bin/echo "
fi
[ADDED] ${modules_compile[$index]}"
function enable_modules {
#-----------# new way v2
#-----------#ENABLE MODULES for FreeSWITCH
#
echo
echo
echo "Now enabling modules for FreeSWITCH in $EN_PATH/modules.conf.xml"
index=0
module_count=`echo ${#modules_add[@]}`
#get rid of any funky whitespace
/bin/sed -i -e s,'<!-- *<','<!--<', -e s,'> *-->','>-->', $EN_PATH/modules.conf.xml
while [ "$index" -lt "$module_count" ]
do
#more strangness to take care of, example:
#Now enabling modules for FreeSWITCH in
/usr/local/freeswitch/conf/autoload_configs/modules.conf.xml
#[ADDED] ../../libs/freetdm/mod_freetdm
modules_add[$index]=`/bin/echo ${modules_add[$index]} | /bin/sed -e
's/.*mod_/mod_/'`
grep ${modules_add[$index]} $EN_PATH/modules.conf.xml > /dev/null
if [ $? -eq 0 ]; then
#module is present in file, see if we need to enable it.
grep '<!--<load module="'${modules_add[$index]}'"/>-->'
$EN_PATH/modules.conf.xml > /dev/null
if [ $? -eq 0 ]; then
[ENABLED] ${modules_add[$index]}"
/bin/echo "
else
fi
else
#not in file. we need to add, and will do so below <modules> tag at top of
file
/bin/sed -i -e s,'<modules>','&\n <load module="'$
{modules_add[$index]}'"/>', $EN_PATH/modules.conf.xml
/bin/echo "
[ADDED] ${modules_add[$index]}"
fi
function freeswitch_logfiles {
/bin/echo
/bin/echo "logrotate not happy with FS: see http://wiki.fusionpbx.com/index.php?
title=RotateFSLogs doing differently now..."
/bin/echo "
SEE: /etc/cron.daily/freeswitch_log_rotation"
# put in /etc/cron.daily
# don't forget to make it executable
# you might consider changing /usr/local/freeswitch/conf/autoload_configs/logfile.conf.xml
# <param name="rollover" value="0"/>
case $1 in
fix-https)
nginxconfig
;;
fix-permissions)
/etc/init.d/freeswitch stop
www_permissions
/etc/init.d/freeswitch start
;;
install-freeswitch)
INSFUSION=0
INSFREESWITCH=1
UPGFUSION=0
UPGFREESWITCH=0
;;
install-fusionpbx)
INSFUSION=1
INSFREESWITCH=0
UPGFUSION=0
UPGFREESWITCH=0
;;
install-both)
INSFUSION=1
INSFREESWITCH=1
UPGFUSION=0
UPGFREESWITCH=0
;;
upgrade-fusionpbx)
INSFUSION=0
INSFREESWITCH=0
UPGFUSION=1
UPGFREESWITCH=0
;;
upgrade-freeswitch)
INSFUSION=0
INSFREESWITCH=0
UPGFUSION=0
UPGFREESWITCH=1
;;
upgrade-both)
INSFUSION=0
INSFREESWITCH=0
UPGFUSION=1
UPGFREESWITCH=1
;;
version)
/bin/echo " "$VERSION
/bin/echo
/bin/echo "$LICENSE"
exit 0
;;
-v)
/bin/echo " "$VERSION
/bin/echo
/bin/echo "$LICENSE"
exit 0
;;
--version)
/bin/echo " "$VERSION
/bin/echo
/bin/echo "$LICENSE"
exit 0
;;
*)
/bin/echo
/bin/echo "This script should be called as:"
/bin/echo " install_fusionpbx option1 option2"
/bin/echo
/bin/echo "
option1:"
/bin/echo "
install-freeswitch"
/bin/echo "
install-fusionpbx"
/bin/echo "
install-both"
/bin/echo "
upgrade-freeswitch"
/bin/echo "
upgrade-fusionpbx"
/bin/echo "
fix-https"
/bin/echo "
fix-permissions"
/bin/echo "
version|--version|-v"
/bin/echo
/bin/echo "
/bin/echo "
option2:"
user: option waits in certain places for the user to check for errors"
/bin/echo "
/bin/echo "
/bin/echo "
/bin/echo
/bin/echo "
/bin/echo "
EXAMPLE"
install_fusionpbx install-both user"
/bin/echo
exit 0
;;
esac
case $2 in
user)
DEBUG=1
;;
auto)
DEBUG=0
;;
*)
/bin/echo
/bin/echo "This script should be called as:"
option1:"
/bin/echo "
install-freeswitch"
/bin/echo "
install-fusionpbx"
/bin/echo "
install-both"
/bin/echo "
upgrade-freeswitch"
/bin/echo "
upgrade-fusionpbx"
/bin/echo "
fix-https"
/bin/echo "
fix-permissions"
/bin/echo "
version|--version|-v"
/bin/echo
/bin/echo "
/bin/echo "
option2:"
user: option waits in certain places for the user to check for errors"
/bin/echo "
/bin/echo "
/bin/echo "
/bin/echo
/bin/echo "
EXAMPLE"
/bin/echo "
/bin/echo
exit 0
;;
esac
if [ ! -s /usr/bin/lsb_release ]; then
/bin/echo "Tell your upstream distro to include lsb_release"
/bin/echo
apt-get upgrade && apt-get -y install lsb-release
fi
DISTRO=lucid
/bin/echo "Good, you're running Ubuntu 10.04 LTS codename Lucid"
/bin/echo
;;
#else
#
if [ $? -eq 0 ]; then
squeeze)
DISTRO=squeeze
/bin/echo "OK you're running Debian Squeeze. This script is known to work"
/bin/echo " with apache/nginx and mysql|sqlite|postgres8 options"
/bin/echo " Please consider providing feedback on repositories for nginx"
/bin/echo " and php-fpm."
/bin/echo
CONTINUE=YES
fi
;;
if [ $? -eq 0 ]; then
wheezy)
DISTRO=wheezy
/bin/echo "OK you're running Debian Wheezy. This script is known to work"
/bin/echo " with apache/nginx and sqlite|postgres9.4 options"
/bin/echo " Please consider providing feedback on whether or not this works."
/bin/echo
CONTINUE=YES
#
fi
;;
if [ $? -eq 0 ]; then
precise)
DISTRO=precise
/bin/echo "OK you're running Ubuntu 12.04 LTS [precise]. This script is"
/bin/echo " works fine."
/bin/echo
CONTINUE=YES
;;
else
*)
/bin/echo "This script was written for Ubuntu 10.04 LTS codename Lucid, 12.04
LTS and Debian Squeeze"
/bin/echo
/bin/echo "Your OS appears to be:"
lsb_release -a
read -p "Do you want to continue [y|n]? " CONTINUE
case "$CONTINUE" in
[yY]*)
/bin/echo "Ok, this doesn't always work..,"
/bin/echo " but we'll give it a go."
#set the default to try to install like precise instead of lucid. PPA's aren't
required for wheezy or precise going forward...
DISTRO=precise
;;
*)
/bin/echo "Quitting."
exit 1
;;
esac
;;
#
fi
#fi
esac
*)
;;
esac
fi
#--------------------------------------#
INSTALL
FREESWITCH
/bin/echo "Upgrading the system, and adding the necessary dependencies for a
FreeSWITCH compile"
if [ $DEBUG -eq 1 ]; then
/bin/echo
read -p "Press Enter to continue..."
fi
/usr/bin/apt-get update
/usr/bin/apt-get -y upgrade
LDRUN=0
/bin/echo -ne "Waiting on ldconfig to finish so bootstrap will work"
while [ $LDRUN -eq 0 ]
do
echo -ne "."
sleep 1
/usr/bin/pgrep -f ldconfig > /dev/null
LDRUN=$?
done
/bin/echo
/bin/echo
/bin/echo "ldconfig is finished"
/bin/echo
if [ ! -e /tmp/install_fusion_status ]; then
touch /tmp/install_fusion_status
fi
#-----------------
# Databases
#----------------#Lets ask... sqlite or postgresql -- for user option only
if [ $DEBUG -eq 1 ]; then
/bin/echo "New Option..."
/bin/echo " FreeSWITCH now has native support for PostgreSQL (no more odbc
in the core)"
/bin/echo " also note that freeswitch is now compiled with zrtp support"
/bin/echo
read -p " Would you like to install PostgreSQL or stay with Sqlite (p/S)? "
SQLITEMYSQL
case "$SQLITEMYSQL" in
[pP]*)
if [ $DISTRO = "wheezy" ]; then
echo "wheezy is PostgreSQL 9.4 by default"
POSTGRES9=9
else
/bin/echo
/bin/echo "OK, PostgreSQL! Would you prefer the stock verion
8.4"
/bin/echo " or verion 9 from PPA?"
/bin/echo
read -p "PostgreSQL 8.4 or 9 [8/9]? " POSTGRES9
fi
echo
;;
esac
fi
case "$SQLITEMYSQL" in
[Pp]*)
main"
echo " then see if it is running with 'service postgresql
status'"
read -p " this script will pause until this issue is resolved"
fi
else
#add the ppa
/usr/bin/apt-add-repository ppa:pitti/postgresql
/usr/bin/apt-get update
/usr/bin/apt-get -y install postgresql-9.3 libpq-dev
fi
else
/bin/echo " version 8.4"
/usr/bin/apt-get -y install postgresql libpq-dev
#The following NEW packages will be installed:
# libpq5 php5-pgsql postgresql postgresql-8.4 postgresql-client-8.4
# postgresql-client-common postgresql-common
fi
PGSQLPASSWORD="dummy"
PGSQLPASSWORD2="dummy2"
while [ $PGSQLPASSWORD != $PGSQLPASSWORD2 ]; do
/bin/echo
/bin/echo
/bin/echo "THIS PROBABLY ISN'T THE MOST SECURE THING TO DO."
/bin/echo "IT IS; HOWEVER, AUTOMATED. WE ARE STORING THE
PASSWORD"
/bin/echo "AS A BASH VARIABLE, AND USING ECHO TO PIPE IT TO"
/bin/echo "psql. THE COMMAND USED IS:"
/bin/echo
/bin/echo "/bin/su -l postgres -c \"/bin/echo 'ALTER USER fusionpbx with
PASSWORD \$PGSQLPASSWORD;' | psql freeswitch\""
/bin/echo
/bin/echo "AFTERWARDS WE OVERWRITE THE VARIABLE WITH RANDOM
DATA"
/bin/echo
/bin/echo "The pgsql username is fusionpbx"
/bin/echo "The pgsql database name is freeswitch"
/bin/echo "Please provide a password for the fusionpbx user"
#/bin/stty -echo
read -s -p " Password: " PGSQLPASSWORD
/bin/echo
/bin/echo "Let's repeat that"
read -s -p " Password: " PGSQLPASSWORD2
/bin/echo
#/bin/stty echo
done
*)
#elif [ $SQLITEMYSQL == "s" || $SQLITEMYSQL == "S" || $SQLITEMYSQL == "" ]; then
/bin/echo "SQLITE is chosen. already done. nothing left to install..."
;;
esac
if [ -e /usr/src/FreeSWITCH ]; then
/bin/ln -s /usr/src/FreeSWITCH /usr/src/freeswitch
elif [ -e /usr/src/freeswitch.git ]; then
/bin/ln -s /usr/src/freeswitch.git /usr/src/freeswitch
fi
fi
/bin/echo
read -p "Press Enter to continue (check for errors)"
fi
/usr/bin/time /usr/src/freeswitch/bootstrap.sh
fi
if [ $? -ne 0 ]; then
#bootstrap had an error
/bin/echo "BOOTSTRAP ERROR"
exit 1
else
/bin/echo "bootstrap_done" >> /tmp/install_fusion_status
fi
fi
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: Failed to enable build modules in modules.conf."
exit 1
else
/bin/echo "build_modules" >> /tmp/install_fusion_status
fi
fi
[Pp]*)
/usr/bin/time /usr/src/freeswitch/configure --enable-core-pgsql-support
--enable-zrtp
;;
*)
/usr/bin/time /usr/src/freeswitch/configure --enable-zrtp
;;
esac
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: FreeSWITCH Configure ERROR."
exit 1
else
/bin/echo "config_done" >> /tmp/install_fusion_status
fi
fi
if [ -a /etc/init.d/freeswitch ]; then
/bin/echo " In case of an install where FS exists (iso), stop FS"
/etc/init.d/freeswitch stop
fi
#------------------------
# COMPILE FREESWITCH
#-----------------------/bin/grep 'compile_done' /tmp/install_fusion_status > /dev/null
if [ $? -eq 0 ]; then
/bin/echo "FreeSWITCH already Compiled! Skipping."
else
#might see about -j cores option to make...
/bin/echo
/bin/echo -ne "Compiling FreeSWITCH. This might take a while [~30 minutes]"
/bin/sleep 1
/bin/echo -ne "."
/bin/sleep 1
/bin/echo -ne "."
/bin/sleep 1
/bin/echo -ne "."
if [ $? -ne 0 ]; then
#tls no longer required for dingaling, so this weird issue doesn't happen. now
uses openssl.
#
/bin/grep 'lgnutls'
/usr/src/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.la > /dev/null
#
if [ $? -eq 0 ]; then
#
#
#
/bin/sed -i -e s,'--mode=relink gcc','--mode=relink gcc -lgnutls',
/usr/src/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.la
#
fi
cd /usr/src/freeswitch
if [ $CORES -gt 1 ]; then
/bin/echo " multicore processor detected. Installing with -j $CORES"
/usr/bin/time /usr/bin/make -j $CORES install
else
/bin/echo " singlecore processor detected. Starting install sans -j"
/usr/bin/time /usr/bin/make install
fi
#/usr/bin/time /usr/bin/make install
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: FreeSWITCH INSTALL Failure."
exit 1
else
/bin/echo "install_done" >> /tmp/install_fusion_status
fi
fi
/bin/echo -ne "Installing FreeSWITCH HD sounds (16/8khz). This will take a while
[~10 minutes]"
/bin/sleep 1
/bin/echo -ne "."
/bin/sleep 1
/bin/echo -ne "."
/bin/sleep 1
/bin/echo "."
cd /usr/src/freeswitch
if [ $CORES -gt 1 ]; then
/bin/echo " multicore processor detected. Installing with -j $CORES"
/usr/bin/time /usr/bin/make -j $CORES hd-sounds-install
else
/bin/echo " singlecore processor detected. Starting install sans -j"
/usr/bin/time /usr/bin/make hd-sounds-install
fi
#/usr/bin/time /usr/bin/make hd-sounds-install
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: FreeSWITCH make cdsounds-install ERROR."
exit 1
else
/bin/echo "sounds_done" >> /tmp/install_fusion_status
fi
fi
fi
cd /usr/src/freeswitch
if [ $CORES -gt 1 ]; then
/bin/echo " multicore processor detected. Installing with -j $CORES"
/usr/bin/time /usr/bin/make -j $CORES hd-moh-install
else
/bin/echo " singlecore processor detected. Starting install sans -j"
/usr/bin/time /usr/bin/make hd-moh-install
fi
#/usr/bin/make hd-moh-install
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: FreeSWITCH make cd-moh-install ERROR."
exit 1
else
/bin/echo "moh_done" >> /tmp/install_fusion_status
fi
fi
#DAEMON
/bin/sed -i /etc/init.d/freeswitch -e
s,^DAEMON=.*,DAEMON=/usr/local/freeswitch/bin/freeswitch,
#DAEMON_ARGS
/bin/sed -i /etc/init.d/freeswitch -e s,'^DAEMON_ARGS=.*','DAEMON_ARGS="-u
www-data -g www-data -rp -nc -nonat"',
#PIDFILE
/bin/sed -i /etc/init.d/freeswitch -e
s,^PIDFILE=.*,PIDFILE=/usr/local/freeswitch/run/\$NAME.pid,
#WORKDIR
/bin/sed -i /etc/init.d/freeswitch -e
s,^WORKDIR=.*,WORKDIR=/usr/local/freeswitch/lib/,
fi
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: Couldn't edit FreeSWITCH init script."
exit 1
fi
else
if [ -e /usr/src/freeswitch/debian/freeswitch-sysvinit.freeswitch.default ]; then
/bin/sed /usr/src/freeswitch/debian/freeswitch-sysvinit.freeswitch.default
-e s,false,true, > /etc/default/freeswitch
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: Couldn't edit freeswitch RC script."
exit 1
fi
else
/bin/sed /usr/src/freeswitch/debian/freeswitch.default -e s,false,true, >
/etc/default/freeswitch
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: Couldn't edit freeswitch RC script."
exit 1
fi
fi
if [ $DEBUG -eq 1 ]; then
/bin/echo "Checking for a public IP Address..."
PUBLICIP=no
/bin/grep -e '^10\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$' \
-e '^192\.168\.[0-9]\{1,3\}\.[0-9]\{1,3\}$' \
-e '^127.0.0.1$'
#-e '^172\.[16-31]\.[0-9]\{1,3\}\.[0-9]\{1,3\}' \
if [ $? -ne 0 ]; then
PUBLICIP=yes
fi
done
case "$PUBLICIP" in
[Yy]*)
if [ $DEBUG -eq 1 ]; then
/bin/echo "You appear to have a public IP address."
/bin/echo " I can make sure FreeSWITCH starts
with"
/bin/echo " the -nonat option (starts quicker)."
/bin/echo
read -p "Would you like for me to do this (y/n)? "
SETNONAT
fi
;;
*)
/bin/echo "Dynamic IP. leaving FreeSWITCH for
aggressive nat"
SETNONAT=no
;;
esac
fi
case "$SETNONAT" in
[Yy]*)
/bin/sed /etc/default/freeswitch -i -e s,'FREESWITCH_PARAMS="nc"','FREESWITCH_PARAMS="-nc -nonat -reincarnate"',
/bin/echo "init script set to start 'freeswitch -nc -nonat'"
;;
*)
/bin/echo "OK, not using -nonat option."
;;
esac
/bin/echo
/usr/sbin/update-rc.d -f freeswitch defaults
fi
/bin/echo
#else
/bin/echo "adding freeswitch user"
/usr/sbin/adduser --disabled-password --quiet --system \
--home /usr/local/freeswitch \
--gecos "FreeSWITCH Voice Platform" --ingroup daemon \
freeswitch
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: Failed adding freeswitch user."
exit 1
fi
#fi
#Opt might have been created due to a type in adduser freeswitch (home was /opt)
check...
#this looks to be the case.
#the latest FusionBPX is correctly detecting /usr/local/freeswitch
# probably always did.
#let's try removing opt altogether...
#/bin/echo
/bin/ln -s /usr/local/freeswitch/bin/fs_cli /usr/local/bin/
/bin/echo
/bin/echo
#fi
#case "$RMOPT" in
#[Yy]*)
#
#;;
#*)
#/bin/echo "OK, linking /usr/local/freeswitch to /opt/freeswitch"
#/bin/ln -s /usr/local/freeswitch /opt/freeswitch
#;;
#esac
/bin/echo
read -p "Press Enter to continue (check for errors)"
fi
#----------------#Setup logrotate
#----------------#
if [ -a /etc/logrotate.d/freeswitch ]; then
if [ -a /etc/cron.daily/freeswitch_log_rotation ]; then
/bin/echo "Logrotate for FreeSWITCH Already Done!"
#----------------#harden FreeSWITCH
#----------------/bin/echo -ne "HARDENING"
sleep 1
/bin/echo -ne " ."
sleep 1
/bin/echo -ne " ."
sleep 1
/bin/echo -ne " ."
if [ $? -eq 0 ]; then
#see if it's uncommented
/bin/grep log-auth-failures /usr/local/freeswitch/conf/sip_profiles/internal.xml |
/bin/grep '<!--' > /dev/null
if [ $? -eq 1 ]; then
#Check for true
/bin/grep log-auth-failures
/usr/local/freeswitch/conf/sip_profiles/internal.xml |/bin/grep true > /dev/null
if [ $? -eq 0 ]; then
/bin/echo "
else
#it's false and uncommented, change it to true
/bin/sed -i -e s,'<param name="log-auth-failures"
value="false"/>','<param name="log-auth-failures" value="true"/>', \
/usr/local/freeswitch/conf/sip_profiles/internal.xml
/bin/echo "
fi
else
# It's commented
# check for true
/bin/grep log-auth-failures
/usr/local/freeswitch/conf/sip_profiles/internal.xml |/bin/grep true > /dev/null
if [ $? -eq 0 ]; then
#it's commented and true
/bin/sed -i -e s,'<!-- *<param name="log-auth-failures"
value="true"/>','<param name="log-auth-failures" value="true"/>', \
-e s,'<param name="log-auth-failures" value="true"/> *->','<param name="log-auth-failures" value="true"/>', \
-e s,'<!--<param name="log-auth-failures"
value="true"/>','<param name="log-auth-failures" value="true"/>', \
-e s,'<param name="log-auth-failures" value="true"/>->','<param name="log-auth-failures" value="true"/>', \
/usr/local/freeswitch/conf/sip_profiles/internal.xml
/bin/echo "
else
#it's commented and false.
/bin/sed -i -e s,'<!-- *<param name="log-auth-failures"
value="false"/>','<param name="log-auth-failures" value="true"/>', \
-e s,'<param name="log-auth-failures" value="false"/> *->','<param name="log-auth-failures" value="true"/>', \
-e s,'<!--<param name="log-auth-failures"
value="false"/>','<param name="log-auth-failures" value="true"/>', \
-e s,'<param name="log-auth-failures" value="false"/>->','<param name="log-auth-failures" value="true"/>', \
/usr/local/freeswitch/conf/sip_profiles/internal.xml
/bin/echo "
and False!"
fi
fi
else
#It's not present...
/bin/sed -i -e s,'<settings>','&\n <param name="log-auth-failures"
value="true"/>', \
/usr/local/freeswitch/conf/sip_profiles/internal.xml
/bin/echo "
fi
if [ -a /etc/fail2ban/filter.d/freeswitch.conf ]; then
/bin/echo "fail2ban filter for freeswitch already done!"
else
/bin/cat > /etc/fail2ban/filter.d/freeswitch.conf <<"DELIM"
# Fail2Ban configuration file
#
# Author: Rupa SChomaker
[Definition]
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
#
host must be matched by a group named "host". The tag "<HOST>" can
(?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values: TEXT
#
failregex = \[WARNING\] sofia_reg.c:\d+ SIP auth failure \(REGISTER\) on sofia profile \'\w+\' for
\[.*\] from ip <HOST>
\[WARNING\] sofia_reg.c:\d+ SIP auth failure \(INVITE\) on sofia profile \'\w+\' for \[.*\]
from ip <HOST>
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
DELIM
[Definition]
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
#
host must be matched by a group named "host". The tag "<HOST>" can
(?:::f{4,6}:)?(?P<host>[\w\-.^_]+)
# Values: TEXT
#
failregex = \[WARNING\] sofia_reg.c:\d+ SIP auth challenge \(REGISTER\) on sofia profile \'\w+\'
for \[.*\] from ip <HOST>
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
DELIM
fi
= 5060,5061,5080,5081
protocol = tcp
filter = freeswitch
logpath = /usr/local/freeswitch/log/freeswitch.log
action = iptables-allports[name=freeswitch-tcp, protocol=all]
maxretry = 5
findtime = 600
bantime = 600
#
sendmail-whois[name=FreeSwitch, dest=root, sender=fail2ban@example.org] #no smtp
server installed
[freeswitch-udp]
enabled = true
port
= 5060,5061,5080,5081
protocol = udp
filter = freeswitch
logpath = /usr/local/freeswitch/log/freeswitch.log
action = iptables-allports[name=freeswitch-udp, protocol=all]
maxretry = 5
findtime = 600
bantime = 600
#
sendmail-whois[name=FreeSwitch, dest=root, sender=fail2ban@example.org] #no smtp
server installed
[freeswitch-dos]
enabled = true
port = 5060,5061,5080,5081
protocol = udp
filter = freeswitch-dos
logpath = /usr/local/freeswitch/log/freeswitch.log
action = iptables-allports[name=freeswitch-dos, protocol=all]
maxretry = 50
findtime = 30
bantime = 6000
DELIM
else
/bin/echo"fail2ban jail.local for freeswitch already done!"
fi
fi
#still may have a problem with logrotate causing missing new FS log files.
#should see log lines such as:
#2011-02-13 06:37:59,889 fail2ban.filter : INFO Log rotation detected for
/usr/local/freeswitch/log/freeswitch.log
/etc/init.d/freeswitch start
/etc/init.d/fail2ban restart
/bin/echo "
/bin/echo "
/bin/echo "
SEE http://wiki.freeswitch.org/wiki/Fail2ban"
/bin/echo
/bin/echo
/bin/echo "FreeSWITCH Installation Completed. Have Fun!"
/bin/echo
fi
#--------------------------------------#
#---------------------------------------
#--------------------------------------#
INSTALL FUSIONPBX
#---------------------------------------
if [ $? -ne 0 ]; then
if [ ! -e /etc/apache2/sites-enabled/$GUI_NAME ]; then
#disable the default 000-default site
/usr/sbin/a2dissite default
#let's use a heredoc now, and do this the right way. #no 'quotes' with
variables
/bin/cat >> /etc/apache2/sites-available/$GUI_NAME <<DELIM
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName $FQDN
DocumentRoot $WWW_PATH/$GUI_NAME
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory $WWW_PATH/$GUI_NAME/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
</VirtualHost>
DELIM
/usr/sbin/a2ensite $GUI_NAME
/bin/cat >> /etc/apache2/conf.d/securedb.conf <<'DELIM'
#
# The following lines prevent .db files from being
# viewed by Web clients.
#
<Files ~ "^.*\.db">
Order allow,deny
Deny from all
Satisfy all
</Files>
DELIM
/etc/init.d/apache2 restart
#
/bin/sed -i -e s,"DocumentRoot /var/www","DocumentRoot
/var/www/fusionpbx", \
#
/etc/apache2/sites-enabled/000-default
if [ $? -ne 0 ]; then
#previous had an error
#
default"
$GUI_NAME"
exit 1
else
#
$GUI_NAME"
fi
else
/bin/echo
#/bin/echo "/etc/apache2/sites-enabled/000-default already edited.
Skipping..."
/bin/echo "/etc/apache2/sites-enabled/$GUI_NAME already there.
Skipping..."
fi
#----------------# NGINX
#----------------*)
#elif [ $APACHENGINX == "n" ] || [ $APACHENGINX == "N" ] || [ $APACHENGINX ==
"" ]; then
# ^ would be almost there. empty read isn't caught. switching to case. more flexible...
if [ -e /usr/sbin/apache2 ]; then
#apache2 is installed.
/bin/echo
/bin/echo "Apache2 is installed, and you selected nginx/php5-fpm."
if [ $DEBUG -eq 1 ]; then
/bin/echo
/bin/echo " We need to remove apache2, and php5. The
packages"
/bin/echo " are not purged, so configuration files will stay."
/bin/echo
/bin/echo " Do you want to remove apache2/php5 and install "
read -p "
else
YESNO=y
fi
case "$YESNO" in
[Yy]*)
#remove packages
/usr/bin/apt-get -y remove apache2 apache2-mpmprefork apache2-utils apache2.2-bin \
apache2.2-common libapache2-mod-php5 libapr1
libaprutil1 libaprutil1-dbd-sqlite3 \
libaprutil1-ldap ssl-cert
else
/bin/echo
/bin/echo "/etc/php5/fpm/php.ini already edited. Skipping..."
fi
#change to socket
grep "listen = 127.0.0.1:9000" $PHPCONFFILE |grep \;
if [ $? -ne 0 ]; then
/bin/sed -i $PHPCONFFILE -e s,listen\ \=\ 127\.0\.0\.\1\:9000,listen\ \=\
\/var\/run\/php5-fpm.sock,
fi
#We don't need so many php children. 1 per core should be fine FOR NOW.
#/bin/sed -i -e s,"pm.max_children = 10","pm.max_children = 4",
/etc/php5/fpm/php5-fpm.conf
rm /etc/nginx/sites-enabled/default
if [ -a /etc/nginx/sites-available/$GUI_NAME ]; then
/bin/echo "/etc/nginx/sites-available/$GUI_NAME already exists...
skipping"
else
nginxconfig
fi
if [ $DISTRO = "lucid" ]; then
esac
#----------------# NGINX Done
#-----------------
#else
#
exit 1
#fi
cd $WWW_PATH
/bin/echo
/bin/echo "Press Enter to continue (check for errors)"
read
fi
#
/bin/echo ' http://'`/sbin/ifconfig eth0 | /bin/grep 'inet addr:' | /usr/bin/cut -d: -f2 |
/usr/bin/awk '{ print $1}'`
#added v3
#move the default extensions .noload
#The default FusionPBX install removes the default FreeSWITCH password, so anyone
can register
#with these default FreeSWITCH extensions. They aren't 'in' FusionPBX anyhow, so we
don't need
#them. We will leave them for reference.
/bin/echo "renaming default FreeSWITCH extensions .noload"
for i in /usr/local/freeswitch/conf/directory/default/1*.xml;do mv $i $i.noload ; done
/bin/echo
/bin/echo "Finishing Up FusionPBX installation."
/bin/echo "Now for a database..."
/bin/echo
#-----------------
# MySQL
#----------------#Lets ask... sqlite or mysql -- for user option only
if [ $DEBUG -eq 1 ]; then
/bin/echo "New Option..."
/bin/echo " SQlite is already installed (and required)"
/bin/echo
read -p " Would you like to install MySQL, PostgreSQL, or stay with Sqlite
(m/p/S)? " SQLITEMYSQL
case "$SQLITEMYSQL" in
[pP]*)
if [ $DISTRO = "wheezy" ]; then
echo "precise is PostgreSQL 9.4 by default"
POSTGRES9=9
else
/bin/echo
/bin/echo "OK, PostgreSQL! Would you prefer the stock verion
8.4"
/bin/echo " or verion 9 from PPA?"
/bin/echo
read -p "PostgreSQL 8.4 or 9 [8/9]? " POSTGRES9
fi
echo
;;
esac
fi
case "$SQLITEMYSQL" in
[Mm]*)
#if [ $SQLITEMYSQL == "m" ]; then
/bin/echo "Installing MySQL"
/bin/echo "
first page!!!"
/bin/echo "
/bin/echo "
/bin/echo "
/bin/echo " I will wait here until you get done with that."
/bin/echo -ne " When MySQL is configured come back and press enter. "
read
;;
[Pp]*)
#elif [ $SQLITEMYSQL == "p" ]; then
#/bin/echo -ne "Installing PostgeSQL"
#moving most of this to fs install
/bin/echo "Time to add a $GUI_NAME user for the database."
/bin/echo -ne "
/bin/echo
/bin/echo "Let's repeat that"
read -s -p " Password: " PGSQLPASSWORD2
/bin/echo
#/bin/stty echo
done
if [ -e /usr/sbin/nginx ]; then
#nginx is installed.
/etc/init.d/php5-fpm restart
/etc/init.d/nginx restart
elif [ -e /usr/sbin/apache2 ]; then
#apache2 is installed.
/etc/init.d/apache2 restart
fi
/bin/echo "Now you'll need to manually finish the install and come back"
/bin/echo " This way I can finish up the last bit of permissions issues"
/bin/echo " Just go to"
/bin/echo ' http://'`/sbin/ifconfig eth0 | /bin/grep 'inet addr:' | /usr/bin/cut -d: -f2 |
/usr/bin/awk '{ print $1}'`
/bin/echo "
the first page!!!"
/bin/echo "
/bin/echo "
/bin/echo "
/bin/echo "
/bin/echo "
/bin/echo "
/bin/echo
/bin/echo " I will wait here until you get done with that."
/bin/echo -ne " When PostgreSQL is configured come back and press enter. "
read
;;
*)
#elif [ $SQLITEMYSQL == "s" || $SQLITEMYSQL == "S" || $SQLITEMYSQL == "" ]; then
/bin/echo "SQLITE is chosen. already done. nothing left to install..."
if [ -e /usr/sbin/nginx ]; then
#nginx is installed.
/etc/init.d/php5-fpm restart
/etc/init.d/nginx restart
elif [ -e /usr/sbin/apache2 ]; then
#apache2 is installed.
/etc/init.d/apache2 restart
fi
exit 1
#fi
finish_fpbx_install_permissions
#/bin/echo
#/bin/echo "The FusionPBX installation messed up permissions of
/usr/local/freeswitch/storage"
#/bin/echo " Fixing..."
#
read
#/usr/bin/find /usr/local/freeswitch -type f -exec /bin/chmod g+w {} \;
#/usr/bin/find /usr/local/freeswitch -type d -exec /bin/chmod g+w {} \;
fusionfail2ban
/etc/init.d/fail2ban restart
/bin/echo
/bin/echo
/bin/echo "Installation Completed. Now configure FreeSWITCH via the FusionPBX
browser interface"
/bin/echo
/bin/echo ' http://'`/sbin/ifconfig eth0 | /bin/grep 'inet addr:' | /usr/bin/cut -d: -f2 |
/usr/bin/awk '{ print $1}'`
/bin/echo "Default login is (whatever you picked in the GUI install):"
/bin/echo " User: WhateverUsernameYouPicked"
/bin/echo " Passwd: YourPasswordYouPicked"
fi
#-----------------------------------#
#------------------------------------
#-----------------------------------#
UPGRADE FREESWITCH
#------------------------------------
/bin/echo " so it runs a long time. However, it will not overwrite files in a preexisting"
/bin/echo ' "conf" directory. Also, the clean targets leave the "modules.conf" file.'
/bin/echo " This handles the git pull, cleanup, and rebuild in one step"
/bin/echo '
src: http://wiki.freeswitch.org/wiki/Installation_Guide'
cd /usr/src/freeswitch
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "/usr/src/freeswitch does not exist"
/bin/echo "you probably installed from a FusionPBX ISO which deleted
this"
/bin/echo "Directory to save space. rerun with install-freeswitch option"
exit 1
fi
cd /usr/src/freeswitch
case $YESNO in
[Nn]*)
echo "OK, staying on current...."
FSSTABLE=false
;;
*)
echo "OK, switching to 1.4.x."
FSSTABLE=true
;;
esac
src/mod/applications/mod_httapi/Makefile
exit 1
#fi
else
echo "Staying on dev branch."
fi
cd /usr/src/freeswitch
echo "reconfiguring mod_spandsp"
make spandsp-reconf
/etc/init.d/freeswitch stop
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "Init ERROR, couldn't stop Freeswitch"
exit 1
fi
/usr/bin/make install
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "INSTALL ERROR!"
exit 1
else
/bin/echo "made_current" >> /tmp/install_fusion_status
fi
fi
if [ $? -ne 0 ]; then
#previous had an error
/bin/echo "ERROR: Failed to enable modules in modules.conf.xml."
exit 1
else
/bin/echo "enable_modules" >> /tmp/install_fusion_status
fi
fi
if [ -e $WWW_PATH/$GUI_NAME ]; then
echo "I noticed that FusionPBX is installed too"
echo "now going to fix freeswitch permissions from upgrade to be safe"
www_permissions
else
echo "Standalone FreeSWITCH installation, no permissions to change"
fi
/etc/init.d/freeswitch start
fi
#-----------------------------------#
#------------------------------------
#-----------------------------------#
UPGRADE FusionPBX
#------------------------------------
echo "
echo "
revision is $FUSIONREV"
echo
read -p "Do we want Revision 1877, or latest (1877/latest)? " YESNO2
else
read -p "Ready to upgrade (y/n)? " YESNO2
fi
case $YESNO2 in
[YylL]*)
#svn...
[1]*)
/usr/bin/svn update -r r1877 $FPBXBRANCH $WWW_PATH/$GUI_NAME
/bin/chown -R www-data:www-data $WWW_PATH/$GUI_NAME
/usr/bin/php $WWW_PATH/$GUI_NAME/core/upgrade/upgrade.php"
;;
esac
fusionfail2ban
fi
#------------------------------------
#------------------------------------
#success!!!
if [ -e /tmp/install_fusion_status ]; then
/bin/rm /tmp/install_fusion_status
fi
DONE!"
fi
exit 0
--------#CHANGELOG
#--------# vSVN, now using SVN.... November 2011
Add libssl-dev
#
#
#
#
#
Needs Testing!
#
Added Change Fail2ban on FreeSWITCH with attempts/rate/etc in config file (not default
settings)
#
Added: Option to download GIT from GitHub repository (It's faster), see DEFINES
iso needs to regenerate certificates post install, ideally with 10 year expirations.
ln -s /etc/ssl/private/ssl-cert-snakeoil.key /etc/ssl/private/nginx.key
ln -s /etc/ssl/certs/ssl-cert-snakeoil.pem /etc/ssl/certs/nginx.crt
ln -s /etc/ssl/certs/nginx.crt /var/www/fusionpbx/$HOSTNAME.crt
/etc/init.d/nginx restart
FIXED nginx config to not block html files... Don't do block ~ .ht
Added: smp compile support. Script works, make -j doesn't. see jira FS-3005
Fixed: Set up apache properly (fusionpbx file instead of default, use heredoc)
Added: now prompts for rm -Rf /opt (or variable for auto-install).
if you install nginx, change your mind, install apache, change your mind again
and re-install nginx, the repository for nginx/php5-fpm gets removed proerly
[a '#' covers repo], but when re-enabling, the '#' gets replaced, and an 'n'
Fixed: Checking for nginx/apache2 binary instead of init scripts for if[x] restart
small problem when selecting nginx and sqlite. php5-fpm needed to restart
added an nginx/php-fpm option. You can change a variable (for auto run)
#
#
#
#
TODO: Maybe probe cores and to the -b thing for quicker compile/bootstrap
TODO: IPTABLES
made a state save file. so if there's an error, don't re-bootstrap, configure, etc.
#
#
in /usr/src/freeswitch/src/mod/endpoints/mod_dingaling/mod_dingaling.la
done: have install check for /etc/fail2ban. reinstall (as in from iso) duplicates some txt
#
user
and then update and run the schema upgrade. or get rid of it. Fixed by prompting the
made some changes so the text flows correctly now that we use curl
# to do install.php.
# sent curl output to dev null..
# added apt-get update before we install apache since remastersys removes apt data
# stopping FS before FusionPBX install, and starting afteward.
# changed license to WAF v1