summarylogtreecommitdiffstats
path: root/evostreamms.install
blob: b9bb955774e4fd0979b9379c364502a9ec1e6c22 (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
40
EVOUSER=evostreamd
EVOGROUP=evostreamd

testError ()
{
	if [ "$?" -ne "0" ]
	then
		echo $1
		exit 1
	fi
}


createUserAndGroup ()
{
	if ! getent group $EVOGROUP >/dev/null
	then
		echo adding group $EVOGROUP
		groupadd $EVOGROUP
		testError "Unable to create group $EVOGROUP"
	fi

	if ! getent passwd $EVOUSER >/dev/null
	then
		echo adding user $EVOUSER
		useradd -c "EvoStream Media Server Daemon" -g $EVOGROUP -r -N -s /usr/sbin/nologin $EVOUSER
	fi
}

applyPermissions ()
{
	chown -R root:$EVOGROUP /var/evostreamms
	chown -R root:$EVOGROUP /var/log/evostreamms
	chown -R root:$EVOGROUP /run/evostreamms
}

post_install() {
	createUserAndGroup
	applyPermissions
}