File: rtpengine-daemon.postinst

package info (click to toggle)
rtpengine 13.5.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,676 kB
  • sloc: ansic: 86,764; perl: 59,422; python: 3,193; sh: 1,030; makefile: 693; asm: 211
file content (69 lines) | stat: -rw-r--r-- 1,728 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh

set -e

default=/etc/default/rtpengine-daemon
modname=xt_RTPENGINE

if [ -x "$(command -v ngcp-virt-identify)" ]; then
	if ngcp-virt-identify --type container; then
		VIRT="yes"
	fi
fi

if [ "$VIRT" = "yes" ]; then
	echo "Container environment detected. Skip kernel module check"
else
	if [ -f $default ]; then
		. $default || true
	fi

	if [ -n "$TABLE" ] && [ "$TABLE" -ge 0 ] && \
		 [ -n "$NO_FALLBACK" ] && \
		 { [ "$NO_FALLBACK" = "1" ] || [ "$NO_FALLBACK" = "yes" ] ; }
	then
		if lsmod | grep -q $modname || modinfo $modname > /dev/null 2> /dev/null; then
			true
		else
			echo "Kernel module $modname not found and NO_FALLBACK is set."
			echo "Daemon restart not performed."
			exit 0
		fi
	fi
fi

if [ "$1" = configure ]; then
	adduser --system --home /nonexistent --gecos rtpengine \
		--no-create-home --disabled-password \
		--group --quiet rtpengine || true

	rtpdir='/var/spool/rtpengine'
	if ! dpkg-statoverride --list "$rtpdir" > /dev/null 2>&1; then
		chown rtpengine:rtpengine "$rtpdir"
		chmod 0770 "$rtpdir"
	fi

	cachedir='/var/cache/rtpengine'
	if ! dpkg-statoverride --list "$cachedir" > /dev/null 2>&1; then
		chown rtpengine:rtpengine "$cachedir"
		chmod 0770 "$cachedir"
	fi

	# set up modprobe.d fragment for auto-load usage
	if ! [ -f /etc/modprobe.d/rtpengine.conf ] || grep -q DPKG-GENERATED /etc/modprobe.d/rtpengine.conf; then
		OPTIONS="options xt_RTPENGINE proc_mask=0x7"

		PUID=$(id -u rtpengine 2> /dev/null)
		test -z "$PUID" || OPTIONS="$OPTIONS proc_uid=$PUID"
		PGID=$(id -g rtpengine 2> /dev/null)
		test -z "$PGID" || OPTIONS="$OPTIONS proc_gid=$PGID"

		( echo "# DPKG-GENERATED FILE";
			echo "$OPTIONS" ) > /etc/modprobe.d/rtpengine.conf
	fi
fi

#DEBHELPER#

exit 0