Module: kamailio
Branch: master
Commit: 8f407a915785a2bd594567399cd52a305ccb274e
URL:
https://github.com/kamailio/kamailio/commit/8f407a915785a2bd594567399cd52a3…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-04-03T15:40:20+02:00
pkg: create /var/run/kamailio with user permissions in centos 7 spec
---
Modified: pkg/kamailio/centos/7/kamailio.init
Modified: pkg/kamailio/centos/7/kamailio.spec
---
Diff:
https://github.com/kamailio/kamailio/commit/8f407a915785a2bd594567399cd52a3…
Patch:
https://github.com/kamailio/kamailio/commit/8f407a915785a2bd594567399cd52a3…
---
diff --git a/pkg/kamailio/centos/7/kamailio.init b/pkg/kamailio/centos/7/kamailio.init
index 3ee9677..2cdae7a 100644
--- a/pkg/kamailio/centos/7/kamailio.init
+++ b/pkg/kamailio/centos/7/kamailio.init
@@ -23,7 +23,8 @@
KAM=/usr/sbin/kamailio
KAMCFG=/etc/kamailio/kamailio.cfg
PROG=kamailio
-PID_FILE=/var/run/kamailio.pid
+HOMEDIR=/var/run/$PROG
+PID_FILE=/var/run/$PROG/kamailio.pid
LOCK_FILE=/var/lock/subsys/kamailio
RETVAL=0
DEFAULTS=/etc/sysconfig/kamailio
@@ -101,6 +102,12 @@ if test "$DUMP_CORE" = "yes" ; then
echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
fi
+# /var/run can be a tmpfs
+if [ ! -d $HOMEDIR ]; then
+ mkdir -p $HOMEDIR
+ chown ${USER}:${GROUP} $HOMEDIR
+fi
+
OPTIONS="-P $PID_FILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP
$EXTRA_OPTIONS"
diff --git a/pkg/kamailio/centos/7/kamailio.spec b/pkg/kamailio/centos/7/kamailio.spec
index f8207e2..9376953 100644
--- a/pkg/kamailio/centos/7/kamailio.spec
+++ b/pkg/kamailio/centos/7/kamailio.spec
@@ -623,6 +623,8 @@ install -m644 pkg/kamailio/centos/%{?centos}/kamailio.sysconfig \
/usr/sbin/groupadd -r kamailio 2> /dev/null || :
/usr/sbin/useradd -r -g kamailio -s /bin/false -c "Kamailio daemon" -d \
%{_libdir}/kamailio kamailio 2> /dev/null || :
+mkdir -p %{_var}/run/kamailio 2> /dev/null || :
+chown kamailio:kamailio %{_var}/run/kamailio 2> /dev/null || :