]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-8369 Fixes
authorNiek Vlessert <niekvlessert@gmail.com>
Tue, 10 Nov 2015 18:43:46 +0000 (19:43 +0100)
committerNiek Vlessert <niekvlessert@gmail.com>
Tue, 10 Nov 2015 18:43:46 +0000 (19:43 +0100)
- Don't check OS, current patch should be compatible with Debian and RHEL derivatives and ArchLinux
- Make useradd the tool to add the usera nd group to work on all

build/Makefile.am
build/startup/freeswitch.service.in
build/startup/install_systemd.sh.in
configure.ac

index dbda77330ed389fee97a9b6c3f9609c3b0154a8e..936ab56843f8509df85c25d750df75a6e37ff26d 100644 (file)
@@ -55,10 +55,10 @@ install:
        @echo " +       Install/Re-install default config:        +"
        @echo " +       ----------------------------------        +"
        @echo " +               $(MK) samples                     +"
-if KNOWN_INIT
+if SYSTEMD_INIT
        @echo " +                                                 +"
-       @echo " +       Install startup scripts:                  +"
-       @echo " +       ------------------------                  +"
+       @echo " +       Install systemd startup scripts:          +"
+       @echo " +       --------------------------------          +"
        @echo " +                                                 +"
        @echo " +       build/startup/install_systemd.sh          +"
 endif
index 930c8c2b930b18b73050bd87664e6b29acd98624..f580ba2480f524e052586cf5de6d22b059b3d29d 100644 (file)
@@ -5,11 +5,12 @@ After=syslog.target network.target local-fs.target
 [Service]
 ; service
 Type=forking
-PIDFile=@rundir@/freeswitch.pid
+PIDFile=@runtimedir@/freeswitch.pid
 PermissionsStartOnly=true
 Environment="DAEMON_OPTS=-nonat"
-EnvironmentFile=-/etc/@environmentfilelocation@/freeswitch
-ExecStart=@bindir@/freeswitch -u freeswitch -g freeswitch -ncwait -rp ${DAEMON_OPTS}
+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
index 6fe5374a5c24dc4a3cf36a3848fc409abf8a6686..3f77c4f8b3bc35c4e311d44ab31bc3c1f569e608 100644 (file)
@@ -1,9 +1,8 @@
 #!/bin/bash
-# @DISTRO@ installer
 # Niek Vlessert
 
 USER=`whoami`
-DISTRO=@DISTRO@
+DISTRO=$(source /etc/os-release && echo $PRETTY_NAME)
 if [ $USER != "root" ] ; then
        SUDO=`which sudo | awk -F"/" '{print $NF}'`
        if [ -z $SUDO ] ; then
@@ -20,36 +19,34 @@ if [ $USER != "root" ] ; then
 fi
 
 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"
 FSPATH=@prefix@
 if [[ $FSPATH == *"freeswitch"* ]]
 then
        echo "- Set permissions on @prefix@ and files in @bindir_expanded@"
 fi
-echo "- Install systemd unit file"
-echo "- Install /etc/@environmentfilelocation@/freeswitch"
+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 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
+       $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 init/freeswitch.service /etc/systemd/system/
-       $SUDO cp init/freeswitch.tmpfile /etc/tmpfiles.d/freeswitch.conf
-       $SUDO cp init/freeswitch.default /etc/@environmentfilelocation@/freeswitch
+       $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
index a1d8010a397b373ba3c5062788d87eab1a86a89e..4f3e0d24e6d6f3922d7b3d16cffb0cf2e01cc6e6 100644 (file)
@@ -773,33 +773,14 @@ case "$host" in
     ;;
     *linux*)
        APR_ADDTO([PLATFORM_CORE_LIBS], [-ldl -lcrypt -lrt])
-       if test -f /etc/os-release; then
-               DISTRO="$(source /etc/os-release && echo $ID$VERSION_ID)"
-               case "$DISTRO" in
-                       *debian8*)
-                               environmentfilelocation="default"
-                               ;;&
-                       *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
+       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([KNOWN_INIT], [test x$knowninit = xtrue])
+       AM_CONDITIONAL([SYSTEMD_INIT], [test x$systemdinit = xtrue])
     ;;
 esac