summarylogtreecommitdiffstats
path: root/evostream-mediaserver.install
blob: 078b23788c19acc243972bfe24bf6559e99ae483 (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 $EVOUSER:$EVOGROUP /var/evostreamms
	chown -R $EVOUSER:$EVOGROUP /var/log/evostreamms
	chown -R $EVOUSER:$EVOGROUP /run/evostreamms
}

post_install() {
	createUserAndGroup
	applyPermissions
}