Browse code

pkg: rpm, alpine - switch from deprecated /var/run to /run

The FHS 3.0 [F] has deprecated /var/run in favor of /run. Current
distributions have done so for a long time (for example in Debian
since 6.0 “squeeze”), even though they provide a compatibility
symlink from /var/run to /run. But software like systemd have
started emitting warnings when using /var/run, for example for
its PIDFile directive, which pollutes the logs.

Guillem Jover authored on 25/10/2019 09:52:05 • Daniel-Constantin Mierla committed on 25/10/2019 10:00:46
Showing 9 changed files
... ...
@@ -290,7 +290,7 @@ prepare() {
290 290
 	cd "$builddir"
291 291
 
292 292
 	cd utils/kamctl/
293
-	sed -i -e 's:/var/run/kamailio.pid:/var/run/kamailio/kamailio.pid:g' \
293
+	sed -i -e 's:/run/kamailio.pid:/run/kamailio/kamailio.pid:g' \
294 294
 		kamctl.base kamctlrc || return 1
295 295
 	# we actually dont need bash
296 296
 	sed -i -e 's:/bin/bash:/bin/sh:' kamctl kamdbctl \
... ...
@@ -318,7 +318,7 @@ package() {
318 318
 	make  FREERADIUS=1 -j1 install || return 1
319 319
 
320 320
 	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
321
-	install -d -o kamailio "$pkgdir"/var/run/kamailio
321
+	install -d -o kamailio "$pkgdir"/run/kamailio
322 322
 }
323 323
 
324 324
 _mv_mod() {
... ...
@@ -1,7 +1,7 @@
1 1
 #!/sbin/openrc-run
2 2
 
3 3
 daemon=/usr/sbin/kamailio
4
-pidfile=/var/run/kamailio/kamailio.pid
4
+pidfile=/run/kamailio/kamailio.pid
5 5
 
6 6
 extra_started_commands="reload"
7 7
 
... ...
@@ -12,7 +12,7 @@ depend() {
12 12
 
13 13
 start() {
14 14
 	ebegin "Starting Kamailio"
15
-	checkpath -d -o kamailio:kamailio /var/run/kamailio
15
+	checkpath -d -o kamailio:kamailio /run/kamailio
16 16
 	start-stop-daemon --start --quiet --pidfile $pidfile --exec $daemon \
17 17
 		-- \
18 18
 		-u ${KAMAILIO_USER:-kamailio} \
... ...
@@ -6,7 +6,7 @@
6 6
 # description: Kamailio (OpenSER) - the Open Source SIP Server
7 7
 #
8 8
 # processname: kamailio
9
-# pidfile: /var/run/kamailio.pid
9
+# pidfile: /run/kamailio.pid
10 10
 # config: /etc/kamailio/kamailio.cfg
11 11
 #
12 12
 ### BEGIN INIT INFO
... ...
@@ -23,8 +23,8 @@
23 23
 KAM=/usr/sbin/kamailio
24 24
 KAMCFG=/etc/kamailio/kamailio.cfg
25 25
 PROG=kamailio
26
-HOMEDIR=/var/run/$PROG
27
-PID_FILE=/var/run/$PROG/kamailio.pid
26
+HOMEDIR=/run/$PROG
27
+PID_FILE=/run/$PROG/kamailio.pid
28 28
 LOCK_FILE=/var/lock/subsys/kamailio
29 29
 RETVAL=0
30 30
 DEFAULTS=/etc/sysconfig/kamailio
... ...
@@ -102,7 +102,7 @@ if test "$DUMP_CORE" = "yes" ; then
102 102
     echo "$COREDIR/core.%e.sig%s.%p" > /proc/sys/kernel/core_pattern
103 103
 fi
104 104
 
105
-# /var/run can be a tmpfs
105
+# /run can be a tmpfs
106 106
 if [ ! -d $HOMEDIR ]; then
107 107
     mkdir -p $HOMEDIR
108 108
 	chown ${USER}:${GROUP} $HOMEDIR
... ...
@@ -11,7 +11,7 @@ Environment='CFGFILE=/etc/kamailio/kamailio.cfg'
11 11
 Environment='SHM_MEMORY=64'
12 12
 Environment='PKG_MEMORY=4'
13 13
 EnvironmentFile=-/etc/sysconfig/kamailio
14
-ExecStart=/usr/sbin/kamailio -DD -P /var/run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
14
+ExecStart=/usr/sbin/kamailio -DD -P /run/kamailio/kamailio.pid -f $CFGFILE -m $SHM_MEMORY -M $PKG_MEMORY
15 15
 Restart=on-failure
16 16
 
17 17
 [Install]
... ...
@@ -4,8 +4,8 @@ $OpenBSD$
4 4
 @@ -135,7 +135,7 @@
5 5
  
6 6
  ## OPENSER START Options
7
- ## PID file path - default is: /var/run/kamailio.pid
8
--# PID_FILE=/var/run/kamailio.pid
7
+ ## PID file path - default is: /run/kamailio.pid
8
+-# PID_FILE=/run/kamailio.pid
9 9
 +PID_FILE=/var/kamailio/kamailio.pid
10 10
  
11 11
  ## Extra start options - default is: not set
... ...
@@ -6,7 +6,7 @@
6 6
 # description: Kamailio is a fast SIP Server.
7 7
 #
8 8
 # processname: kamailio
9
-# pidfile: /var/run/kamailio.pid
9
+# pidfile: /run/kamailio.pid
10 10
 # config: /etc/kamailio/kamailio.cfg
11 11
 
12 12
 # Source function library.
... ...
@@ -15,7 +15,7 @@
15 15
 KAM=/usr/sbin/kamailio
16 16
 KAMCFG=/etc/kamailio/kamailio.cfg
17 17
 PROG=kamailio
18
-PID_FILE=/var/run/kamailio.pid
18
+PID_FILE=/run/kamailio.pid
19 19
 LOCK_FILE=/var/lock/subsys/kamailio
20 20
 RETVAL=0
21 21
 DEFAULTS=/etc/default/kamailio
... ...
@@ -5,8 +5,8 @@ After=syslog.target network-online.target auditd.service
5 5
 
6 6
 [Service]
7 7
 EnvironmentFile=/etc/sysconfig/kamailio
8
-ExecStartPre=/usr/bin/mkdir -m=2770 -p /var/run/kamailio
9
-ExecStartPre=/usr/bin/chown kamailio:kamailio /var/run/kamailio
8
+ExecStartPre=/usr/bin/mkdir -m=2770 -p /run/kamailio
9
+ExecStartPre=/usr/bin/chown kamailio:kamailio /run/kamailio
10 10
 ExecStart=/usr/sbin/kamailio -f $CFG_FILE -P $PID_FILE -m $SHM_MEMORY -M $PKG_MEMORY -u $USER -g $GROUP $EXTRA_OPTIONS
11 11
 ExecReload=/bin/kill -HUP $MAINPID
12 12
 KillMode=control-group
... ...
@@ -31,6 +31,6 @@ DUMP_CORE=no
31 31
 
32 32
 CFG_FILE=/etc/kamailio/kamailio.cfg
33 33
 
34
-PID_FILE=/var/run/kamailio/kamailio.pid
34
+PID_FILE=/run/kamailio/kamailio.pid
35 35
 
36 36
 LOCK_FILE=/var/lock/subsys/kamailio
... ...
@@ -2,6 +2,6 @@
2 2
 {
3 3
     sharedscripts
4 4
     postrotate
5
-	/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
5
+	/bin/kill -HUP `cat /run/syslogd.pid 2> /dev/null` 2> /dev/null || true
6 6
     endscript
7 7
 }