Module: kamailio
Branch: 5.0
Commit: 0c2a5b7dc31751e6753a13f6956795e3ad15cf73
URL:
https://github.com/kamailio/kamailio/commit/0c2a5b7dc31751e6753a13f6956795e…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2017-04-04T13:54:05+02:00
pkg: create /var/run/kamailio with user permissions in centos 7 spec
(cherry picked from commit 8f407a915785a2bd594567399cd52a305ccb274e)
---
Modified: pkg/kamailio/centos/7/kamailio.init
Modified: pkg/kamailio/centos/7/kamailio.spec
---
Diff:
https://github.com/kamailio/kamailio/commit/0c2a5b7dc31751e6753a13f6956795e…
Patch:
https://github.com/kamailio/kamailio/commit/0c2a5b7dc31751e6753a13f6956795e…
---
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 053fe9a..bb5c414 100644
--- a/pkg/kamailio/centos/7/kamailio.spec
+++ b/pkg/kamailio/centos/7/kamailio.spec
@@ -622,6 +622,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 || :