parent
d5520a6612
commit
ff12bd6cfc
|
@ -55,10 +55,10 @@ install:
|
||||||
@echo " + Install/Re-install default config: +"
|
@echo " + Install/Re-install default config: +"
|
||||||
@echo " + ---------------------------------- +"
|
@echo " + ---------------------------------- +"
|
||||||
@echo " + $(MK) samples +"
|
@echo " + $(MK) samples +"
|
||||||
if SYSTEMD_INIT
|
if KNOWN_INIT
|
||||||
@echo " + +"
|
@echo " + +"
|
||||||
@echo " + Install systemd startup scripts: +"
|
@echo " + Install startup scripts: +"
|
||||||
@echo " + -------------------------------- +"
|
@echo " + ------------------------ +"
|
||||||
@echo " + +"
|
@echo " + +"
|
||||||
@echo " + build/startup/install_systemd.sh +"
|
@echo " + build/startup/install_systemd.sh +"
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -5,12 +5,11 @@ After=syslog.target network.target local-fs.target
|
||||||
[Service]
|
[Service]
|
||||||
; service
|
; service
|
||||||
Type=forking
|
Type=forking
|
||||||
PIDFile=@runtimedir@/freeswitch.pid
|
PIDFile=@rundir@/freeswitch.pid
|
||||||
PermissionsStartOnly=true
|
PermissionsStartOnly=true
|
||||||
Environment="DAEMON_OPTS=-nonat"
|
Environment="DAEMON_OPTS=-nonat"
|
||||||
EnvironmentFile=-/etc/sysconfig/freeswitch
|
EnvironmentFile=-/etc/@environmentfilelocation@/freeswitch
|
||||||
EnvironmentFile=-/etc/default/freeswitch
|
ExecStart=@bindir@/freeswitch -u freeswitch -g freeswitch -ncwait -rp ${DAEMON_OPTS}
|
||||||
ExecStart=@bindir_expanded@/freeswitch -u freeswitch -g freeswitch -ncwait -rp ${DAEMON_OPTS}
|
|
||||||
TimeoutSec=20s
|
TimeoutSec=20s
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
; exec
|
; exec
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
# @DISTRO@ installer
|
||||||
# Niek Vlessert
|
# Niek Vlessert
|
||||||
|
|
||||||
USER=`whoami`
|
USER=`whoami`
|
||||||
DISTRO=$(source /etc/os-release && echo $PRETTY_NAME)
|
DISTRO=@DISTRO@
|
||||||
if [ $USER != "root" ] ; then
|
if [ $USER != "root" ] ; then
|
||||||
SUDO=`which sudo | awk -F"/" '{print $NF}'`
|
SUDO=`which sudo | awk -F"/" '{print $NF}'`
|
||||||
if [ -z $SUDO ] ; then
|
if [ -z $SUDO ] ; then
|
||||||
|
@ -19,34 +20,36 @@ if [ $USER != "root" ] ; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "This will do several things on your $DISTRO installation:"
|
echo "This will do several things on your @DISTRO@ installation:"
|
||||||
echo "- Create user freeswitch and add it to group freeswitch"
|
echo "- Create user freeswitch and add it to group freeswitch"
|
||||||
FSPATH=@prefix@
|
FSPATH=@prefix@
|
||||||
if [[ $FSPATH == *"freeswitch"* ]]
|
if [[ $FSPATH == *"freeswitch"* ]]
|
||||||
then
|
then
|
||||||
echo "- Set permissions on @prefix@ and files in @bindir_expanded@"
|
echo "- Set permissions on @prefix@ and files in @bindir_expanded@"
|
||||||
fi
|
fi
|
||||||
echo "- Install systemd unit file and other required files"
|
echo "- Install systemd unit file"
|
||||||
|
echo "- Install /etc/@environmentfilelocation@/freeswitch"
|
||||||
echo
|
echo
|
||||||
read -p "Do you want to continue? (y/n) " -n 1 -r
|
read -p "Do you want to continue? (y/n) " -n 1 -r
|
||||||
if [[ $REPLY =~ ^[yY]$ ]]
|
if [[ $REPLY =~ ^[yY]$ ]]
|
||||||
then
|
then
|
||||||
echo
|
echo
|
||||||
echo "Installing..."
|
echo "Installing..."
|
||||||
$SUDO useradd -d @confdir@ -r -U -s /bin/false -c "FreeSWITCH open source softswitch" freeswitch
|
$SUDO groupadd freeswitch
|
||||||
|
if DISTRO="debian8"; then
|
||||||
|
$SUDO adduser --disabled-password --quiet --system --home @confdir@ --gecos "FreeSWITCH open source softswitch" --ingroup freeswitch freeswitch
|
||||||
|
elif DISTRO="centos7"; then
|
||||||
|
$SUDO adduser --system --home @confdir@ -c "FreeSWITCH open source softswitch" -g freeswitch freeswitch
|
||||||
|
fi
|
||||||
if [[ $FSPATH == *"freeswitch"* ]]
|
if [[ $FSPATH == *"freeswitch"* ]]
|
||||||
then
|
then
|
||||||
$SUDO chown -R freeswitch:freeswitch @prefix@
|
$SUDO chown -R freeswitch:freeswitch @prefix@
|
||||||
$SUDO chmod -R ug=rwX,o= @prefix@
|
$SUDO chmod -R ug=rwX,o= @prefix@
|
||||||
$SUDO chmod -R u=rwx,g=rx @bindir_expanded@/*
|
$SUDO chmod -R u=rwx,g=rx @bindir_expanded@/*
|
||||||
fi
|
fi
|
||||||
$SUDO cp build/startup/freeswitch.service /etc/systemd/system/
|
$SUDO cp init/freeswitch.service /etc/systemd/system/
|
||||||
$SUDO cp build/startup/freeswitch.tmpfile /etc/tmpfiles.d/freeswitch.conf
|
$SUDO cp init/freeswitch.tmpfile /etc/tmpfiles.d/freeswitch.conf
|
||||||
if [ -d /etc/sysconfig ]; then
|
$SUDO cp init/freeswitch.default /etc/@environmentfilelocation@/freeswitch
|
||||||
$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 systemd-tmpfiles --clean --create
|
||||||
$SUDO systemctl daemon-reload
|
$SUDO systemctl daemon-reload
|
||||||
echo
|
echo
|
||||||
|
|
33
configure.ac
33
configure.ac
|
@ -773,14 +773,33 @@ case "$host" in
|
||||||
;;
|
;;
|
||||||
*linux*)
|
*linux*)
|
||||||
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
|
APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
|
||||||
systemdinit=false
|
if test -f /etc/os-release; then
|
||||||
if test -d /run/systemd/system; then
|
DISTRO="$(source /etc/os-release && echo $ID$VERSION_ID)"
|
||||||
systemdinit=true
|
case "$DISTRO" in
|
||||||
AC_SUBST(bindir_expanded)
|
*debian8*)
|
||||||
AC_CONFIG_FILES([build/startup/install_systemd.sh], [chmod +x build/startup/install_systemd.sh])
|
environmentfilelocation="default"
|
||||||
AC_CONFIG_FILES([build/startup/freeswitch.service])
|
;;&
|
||||||
|
*centos7*)
|
||||||
|
environmentfilelocation="sysconfig"
|
||||||
|
;;&
|
||||||
|
*debian8*|*centos7*)
|
||||||
|
knowninit=false
|
||||||
|
if test -d /run/systemd/system; then
|
||||||
|
knowninit=true
|
||||||
|
AC_SUBST(DISTRO)
|
||||||
|
AC_SUBST(rundir)
|
||||||
|
AC_SUBST(environmentfilelocation)
|
||||||
|
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
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
knowninit=false
|
||||||
|
;;
|
||||||
|
esac
|
||||||
fi
|
fi
|
||||||
AM_CONDITIONAL([SYSTEMD_INIT], [test x$systemdinit = xtrue])
|
AM_CONDITIONAL([KNOWN_INIT], [test x$knowninit = xtrue])
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue