Merge pull request #563 in FS/freeswitch from ~NIEKVLESSERT/freeswitch:feature/FS-8369-additions-to-make-installation-of to master
* commit '389d24da145531e3abb7dc943f6c2609286cf685': FS-8369 Fixes FS-8369 Debian8/CentOS7 systemd installer additions FS-8369 Debian8/CentOS7 systemd installer additions
This commit is contained in:
commit
8b73c1bd4e
|
@ -1,5 +1,6 @@
|
|||
MK=`echo $(MAKE) | $(AWK) '{printf "%5s\n", $$0}' `
|
||||
|
||||
|
||||
all:
|
||||
@echo " +---------- FreeSWITCH Build Complete ----------+"
|
||||
@echo " + FreeSWITCH has been successfully built. +"
|
||||
|
@ -54,6 +55,13 @@ install:
|
|||
@echo " + Install/Re-install default config: +"
|
||||
@echo " + ---------------------------------- +"
|
||||
@echo " + $(MK) samples +"
|
||||
if SYSTEMD_INIT
|
||||
@echo " + +"
|
||||
@echo " + Install systemd startup scripts: +"
|
||||
@echo " + -------------------------------- +"
|
||||
@echo " + +"
|
||||
@echo " + build/startup/install_systemd.sh +"
|
||||
endif
|
||||
@echo " + +"
|
||||
@echo " + +"
|
||||
@echo " + Additional resources: +"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
d /run/freeswitch 0750 freeswitch daemon -
|
|
@ -1,17 +0,0 @@
|
|||
[Unit]
|
||||
Description=FreeSWITCH
|
||||
After=syslog.target network.target
|
||||
After=postgresql.service postgresql-9.3.service postgresql-9.4.service mysqld.service httpd.service
|
||||
|
||||
[Service]
|
||||
User=freeswitch
|
||||
EnvironmentFile=-/etc/sysconfig/freeswitch
|
||||
# RuntimeDirectory is not yet supported in CentOS 7. A workaround is to use /etc/tmpfiles.d/freeswitch.conf
|
||||
#RuntimeDirectory=/run/freeswitch
|
||||
#RuntimeDirectoryMode=0750
|
||||
WorkingDirectory=/run/freeswitch
|
||||
ExecStart=/usr/bin/freeswitch -nc -nf $FREESWITCH_PARAMS
|
||||
ExecReload=/usr/bin/kill -HUP $MAINPID
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,2 @@
|
|||
# /etc/default/freeswitch
|
||||
DAEMON_OPTS="-nonat"
|
|
@ -0,0 +1,32 @@
|
|||
[Unit]
|
||||
Description=freeswitch
|
||||
After=syslog.target network.target local-fs.target
|
||||
|
||||
[Service]
|
||||
; service
|
||||
Type=forking
|
||||
PIDFile=@runtimedir@/freeswitch.pid
|
||||
PermissionsStartOnly=true
|
||||
Environment="DAEMON_OPTS=-nonat"
|
||||
EnvironmentFile=-/etc/sysconfig/freeswitch
|
||||
EnvironmentFile=-/etc/default/freeswitch
|
||||
ExecStart=@bindir_expanded@/freeswitch -u freeswitch -g freeswitch -ncwait -rp ${DAEMON_OPTS}
|
||||
TimeoutSec=20s
|
||||
Restart=on-failure
|
||||
; exec
|
||||
User=root
|
||||
Group=daemon
|
||||
LimitCORE=infinity
|
||||
LimitNOFILE=100000
|
||||
LimitNPROC=60000
|
||||
;LimitSTACK=240
|
||||
LimitRTPRIO=infinity
|
||||
LimitRTTIME=7000000
|
||||
IOSchedulingClass=realtime
|
||||
IOSchedulingPriority=2
|
||||
CPUSchedulingPolicy=rr
|
||||
CPUSchedulingPriority=89
|
||||
UMask=0007
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1 @@
|
|||
d /var/run/freeswitch 0755 freeswitch freeswitch - -
|
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
# Niek Vlessert
|
||||
|
||||
USER=`whoami`
|
||||
DISTRO=$(source /etc/os-release && echo $PRETTY_NAME)
|
||||
if [ $USER != "root" ] ; then
|
||||
SUDO=`which sudo | awk -F"/" '{print $NF}'`
|
||||
if [ -z $SUDO ] ; then
|
||||
echo "No root and no sudo... please run this as root or install sudo and make sure your user has permissions to use it."
|
||||
exit
|
||||
else
|
||||
read -p "The currently active user is not root but sudo is available... do you want to install using sudo? (y/n) " -n 1 -r
|
||||
if ! [[ $REPLY =~ ^[yY]$ ]]
|
||||
then
|
||||
echo
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "This will do several things on your $DISTRO installation:"
|
||||
echo "- Create user freeswitch and add it to group freeswitch"
|
||||
FSPATH=@prefix@
|
||||
if [[ $FSPATH == *"freeswitch"* ]]
|
||||
then
|
||||
echo "- Set permissions on @prefix@ and files in @bindir_expanded@"
|
||||
fi
|
||||
echo "- Install systemd unit file and other required files"
|
||||
echo
|
||||
read -p "Do you want to continue? (y/n) " -n 1 -r
|
||||
if [[ $REPLY =~ ^[yY]$ ]]
|
||||
then
|
||||
echo
|
||||
echo "Installing..."
|
||||
$SUDO useradd -d @confdir@ -r -U -s /bin/false -c "FreeSWITCH open source softswitch" freeswitch
|
||||
if [[ $FSPATH == *"freeswitch"* ]]
|
||||
then
|
||||
$SUDO chown -R freeswitch:freeswitch @prefix@
|
||||
$SUDO chmod -R ug=rwX,o= @prefix@
|
||||
$SUDO chmod -R u=rwx,g=rx @bindir_expanded@/*
|
||||
fi
|
||||
$SUDO cp build/startup/freeswitch.service /etc/systemd/system/
|
||||
$SUDO cp build/startup/freeswitch.tmpfile /etc/tmpfiles.d/freeswitch.conf
|
||||
if [ -d /etc/sysconfig ]; then
|
||||
$SUDO cp build/startup/freeswitch.default /etc/sysconfig/freeswitch
|
||||
else
|
||||
$SUDO cp build/startup/freeswitch.default /etc/default/freeswitch
|
||||
fi
|
||||
$SUDO systemd-tmpfiles --clean --create
|
||||
$SUDO systemctl daemon-reload
|
||||
echo
|
||||
if [ -f @confdir@/vars.xml ] ; then
|
||||
echo "You may now start Freeswitch using 'systemctl start freeswitch'"
|
||||
else
|
||||
echo "Make sure your config files are in place in @confdir@, if they are you can start Freeswitch using 'systemctl start freeswitch'"
|
||||
fi
|
||||
echo "Then start fs_cli by running @bindir_expanded@/fs_cli"
|
||||
fi
|
10
configure.ac
10
configure.ac
|
@ -83,6 +83,8 @@ default_certsdir="$prefix/certs"
|
|||
default_fontsdir="$prefix/fonts"
|
||||
default_imagesdir="$prefix/images"
|
||||
|
||||
eval bindir_expanded="${bindir}"
|
||||
|
||||
if test "${enable_fhs}" = "yes"; then
|
||||
eval full_datadir="${datadir}/freeswitch"
|
||||
eval datadir=$full_datadir
|
||||
|
@ -771,6 +773,14 @@ case "$host" in
|
|||
;;
|
||||
*linux*)
|
||||
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
|
||||
systemdinit=false
|
||||
if test -d /run/systemd/system; then
|
||||
systemdinit=true
|
||||
AC_SUBST(bindir_expanded)
|
||||
AC_CONFIG_FILES([build/startup/install_systemd.sh], [chmod +x build/startup/install_systemd.sh])
|
||||
AC_CONFIG_FILES([build/startup/freeswitch.service])
|
||||
fi
|
||||
AM_CONDITIONAL([SYSTEMD_INIT], [test x$systemdinit = xtrue])
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
Loading…
Reference in New Issue