blob: 546c4f467a0a58bac169734e2d4e0edcf3f0343d (
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
#!/bin/sh
# $FreeBSD: /tmp/pcvs/ports/audio/squeezeboxserver/files/pkg-install.in,v 1.4 2008-04-02 17:30:27 brooks Exp $
name=slimserver
u=%%SLIMUSER%%
g=%%SLIMGROUP%%
ugid=104
homedir=/nonexistent
shell=/sbin/nologin
comment="Slim Devices SlimServer/SqueezeCenter pseudo-user"
slimdir="%%PREFIX%%/%%SLIMDIR%%"
statedir=%%SLIMDBDIR%%
cachedir=${statedir}/cache
conffile=${statedir}/squeezecenter.conf
playlistdir=${statedir}/playlists
pidfile=/var/run/${name}.pid
newsyslogfile=/etc/newsyslog.conf
logfile=/var/log/squeezecenter.log
logcomment="# added by audio/squeezecenter port"
logline="${logfile} ${u}:${g} 644 3 100 * J ${pidfile}"
case $2 in
PRE-INSTALL)
if pw group show "${g}" >/dev/null 2>&1; then
echo "Using existing group \"${g}\"."
else
echo "Creating group \"${g}\", (gid: ${ugid})."
pw groupadd ${g} -g ${ugid}
if [ $? != 0 ]; then
echo "Failed to add group \"${g}\"."
exit 1
fi
fi
if pw user show "${u}" >/dev/null 2>&1; then
echo "Using existing user \"${u}\"."
else
echo "Creating user \"${u}\", (uid: ${ugid})."
pw useradd ${u} -u ${ugid} -g ${ugid} -h - \
-d ${homedir} -s ${shell} -c "${comment}"
if [ $? != 0 ]; then
echo "Failed to add user \"${u}\"."
exit 1
fi
fi
;;
POST-INSTALL)
if [ -d ${statedir} ]; then
chown -R ${u}:${g} ${statedir}
fi
if [ -d ${cachedir} ]; then
chown -R ${u}:${g} ${cachedir}
fi
if [ -d ${playlistdir} ]; then
chown -R ${u}:${g} ${playlistdir}
fi
if [ -f ${conffile} ]; then
chown ${u}:${g} ${conffile}
fi
if [ -f ${logfile} ]; then
chown ${u}:${g} ${logfile}
fi
if egrep -q "^${logfile}\>" ${newsyslogfile}; then
echo "Using existing ${newsyslogfile} entry."
else
echo "Adding squeezecenter log entry to ${newsyslogfile}."
echo "$logcomment" >> ${newsyslogfile}
echo "$logline" >> ${newsyslogfile}
fi
for file in %%CONFFILES%%; do
path="${slimdir}/${file}"
if [ ! -e ${path} ]; then
cp ${path}.sample ${path}
chmod 644 ${path}
fi
done
;;
esac
|