aboutsummaryrefslogtreecommitdiffstats
path: root/debian/osmo-bts-trx.postinst
blob: af5d8218b2bbf1dfbf47ba621f6940344a119aa9 (plain)
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
#!/bin/sh -e
case "$1" in
	configure)
		# Create the osmocom group and user (if it doesn't exist yet)
		if ! getent group osmocom >/dev/null; then
			groupadd --system osmocom
		fi
		if ! getent passwd osmocom >/dev/null; then
			useradd \
				--system \
				--gid osmocom \
				--home-dir /var/lib/osmocom \
				--shell /sbin/nologin \
				--comment "Open Source Mobile Communications" \
				osmocom
		fi

		# Fix permissions of previous (root-owned) install (OS#4107)
		if dpkg --compare-versions "$2" le "1.13.0"; then
			if [ -e /etc/osmocom/osmo-bts-trx.cfg ]; then
				chown -v osmocom:osmocom /etc/osmocom/osmo-bts-trx.cfg
				chmod -v 0660 /etc/osmocom/osmo-bts-trx.cfg
			fi

			if [ -d /etc/osmocom ]; then
				chown -v root:osmocom /etc/osmocom
				chmod -v 2775 /etc/osmocom
			fi

			mkdir -p /var/lib/osmocom
			chown -R -v osmocom:osmocom /var/lib/osmocom
		fi
		;;
esac

# dh_installdeb(1) will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#