blob: d71c1a1e1b9fbc2a8618b427f0f3da98847be201 (
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
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
|
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: %%PORTNAME%%
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable %%PORTNAME%%:
#
#%%PORTNAME%%_enable="YES"
#
. /etc/rc.subr
name=%%PORTNAME%%
start_precmd="%%PORTNAME%%_start_precmd"
stop_postcmd="%%PORTNAME%%_stop_postcmd"
rcvar=%%PORTNAME%%_enable
command=%%PREFIX%%/%%SLIMDIR%%/slimserver.pl
command_interpreter=%%PERL%%
pidfile=/var/run/${name}/${name}.pid
logdir=/var/log/${name}
statedir=%%SLIMDBDIR%%
cachedir=${statedir}/cache
prefsdir=${statedir}/prefs
playlistdir=${statedir}/playlists
u=%%SLIMUSER%%
g=%%SLIMGROUP%%
command_args="--daemon --pidfile=${pidfile} --user=${u} --group=${g}"
%%PORTNAME%%_user=${u}
%%PORTNAME%%_group=${g}
%%PORTNAME%%_start_precmd()
{
# This is stuff is here and not in pkg-install because
# /var/run may be destroyed at any time and we've had issues
# with permissions on the various directories under /var getting
# screwed up in the past.
mkdir -p /var/run/${name}
chown -RH ${u}:${g} /var/run/${name}
mkdir -p ${logdir}
chown -RH ${u}:${g} ${logdir}
mkdir -p ${statedir}
mkdir -p ${cachedir}
mkdir -p ${prefsdir}
mkdir -p ${playlistdir}
chown -RH ${u}:${g} ${statedir}
}
%%PORTNAME%%_stop_postcmd()
{
pids=`pgrep -u $u`
if [ -n "${pids}" ]; then
sleep 1
kill $pids > /dev/null 2>&1
fi
pids=`pgrep -u $u`
if [ -n "${pids}" ]; then
wait_for_pids $pids
fi
}
load_rc_config ${name}
%%PORTNAME%%_enable=${%%PORTNAME%%_enable:-"NO"}
%%PORTNAME%%_flags=${%%PORTNAME%%_flags:-""}
run_rc_command "$1"
|