aboutsummaryrefslogtreecommitdiffstats
path: root/debian/postinst
blob: 5dedec48b0c34fa2f6ade8806c6e78b87c9753a2 (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
#!/bin/sh -e
# Debian's postinst script is called on both installation and upgrade. Call the
# post-upgrade script in both cases, it won't do anything if there is nothing
# to do.
/usr/share/osmocom/osmo-hlr-post-upgrade.sh

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)
		chown osmocom:osmocom /etc/osmocom/osmo-hlr.cfg
		chmod 0660 /etc/osmocom/osmo-hlr.cfg
		chown root:osmocom /etc/osmocom
		chmod 2775 /etc/osmocom
		mkdir -p /var/lib/osmocom
		chown -R osmocom:osmocom /var/lib/osmocom
		;;
esac

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