summaryrefslogtreecommitdiff
path: root/audio/logitechmediaserver/files/pkg-install.in
blob: f3fd1d166073b2cbd79c599a3df6ba19ce9ff99f (plain) (blame)
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
#!/bin/sh
# $FreeBSD: /tmp/pcvs/ports/audio/squeezeboxserver/files/pkg-install.in,v 1.11 2011-07-09 17:44:14 crees Exp $

name=%%PORTNAME%%
comment="Slim Devices SlimServer/SqueezeCenter pseudo-user"
slimdir="%%PREFIX%%/%%SLIMDIR%%"
statedir=%%SLIMDBDIR%%
cachedir=${statedir}/cache
prefsdir=${statedir}/prefs
playlistdir=${statedir}/playlists
oldprefsdir=/var/db/squeezecenter/prefs
logdir=/var/log/${name}
conffile=${prefsdir}/server.prefs
pidfile=/var/run/${name}/${name}.pid
newsyslogfile=/etc/newsyslog.conf
logcomment="# added by audio/${name} port"
serverlogfile=/var/log/${name}/server.log
serverlogline="${serverlogfile}	${u}:${g} 644 3	   100	*     J     ${pidfile}"

case $2 in
POST-INSTALL)
	if egrep -q "^${serverlogfile}\>" ${newsyslogfile}; then
		echo "Using existing ${newsyslogfile} entry."
	else
		echo "Adding ${name} log entry to ${newsyslogfile}."
		echo "$logcomment" >> ${newsyslogfile}
		echo "$serverlogline" >> ${newsyslogfile}
	fi
	for file in %%CONFFILES%%; do
		path="${slimdir}/${file}"
		if [ ! -e ${path} ]; then
			cp ${path}.sample ${path}
			chmod 644 ${path}
		fi
	done

	if [ ! -f ${serverlogfile} ]; then
		touch ${serverlogfile}
		chown -H ${u}:${g} ${serverlogfile}
	fi

	if [ ! -e ${conffile} ]; then
		if [ -e ${oldprefsdir}/server.prefs ]; then
			mkdir -p ${statedir}
			cp -r ${oldprefsdir}* ${statedir}
			chown -RH ${u}:${g} ${prefsdir}
		fi
	fi
	;;
esac