aboutsummaryrefslogtreecommitdiff
path: root/multimedia/emby-server/files/emby-server.in
blob: b29bbf84e335de917df53f94d701acd49426e140 (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
#!/bin/sh

# $FreeBSD$
#
# PROVIDE: %%PORTNAME%%
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# %%RC_NAME%%_enable:	Set to yes to enable the %%PORTNAME%% service.
#			Default: no
# %%RC_NAME%%_user:	The user account used to run the %%PORTNAME%% daemon.
#			This is optional, however do not specifically set this to an
#			empty string as this will cause the daemon to run as root.
#			Default: %%USER%%
# %%RC_NAME%%_group:	The group account used to run the %%PORTNAME%% daemon.
#			This is optional, however do not specifically set this to an
#			empty string as this will cause the daemon to run with group wheel.
#			Default: %%GROUP%%
# %%RC_NAME%%_data_dir: Directory where %%PORTNAME%% configuration
#			data is stored.
#			Default: /var/db/%%PORTNAME%%
# %%RC_NAME%%_ffdetect: Path of the ffdetect binary.
#			Default: %%PREFIX%%/lib/emby-server/bin/ffdetect
# %%RC_NAME%%_ffmpeg:	Path of the ffmpeg binary.
#			Default: %%PREFIX%%/lib/emby-server/bin/ffmpeg
# %%RC_NAME%%_ffprobe:	Path of the ffprobe binary.
#			Default: %%PREFIX%%/lib/emby-server/bin/ffprobe
# %%RC_NAME%%_pid: 	Path of the pid file.
#			Default: /var/run/%%PORTNAME%%.pid

. /etc/rc.subr
name=%%RC_NAME%%
rcvar=${name}_enable
load_rc_config ${name}

: ${%%RC_NAME%%_enable:="no"}
: ${%%RC_NAME%%_user:="%%USER%%"}
: ${%%RC_NAME%%_group:="%%GROUP%%"}
: ${%%RC_NAME%%_data_dir:="/var/db/%%PORTNAME%%"}
: ${%%RC_NAME%%_ffdetect:="%%PREFIX%%/lib/emby-server/bin/ffdetect"}
: ${%%RC_NAME%%_ffmpeg:="%%PREFIX%%/lib/emby-server/bin/ffmpeg"}
: ${%%RC_NAME%%_ffprobe:="%%PREFIX%%/lib/emby-server/bin/ffprobe"}
: ${%%RC_NAME%%_pid:="/var/run/%%PORTNAME%%.pid"}

procname="%%LOCALBASE%%/bin/mono"
command="/usr/sbin/daemon"
command_args="-f -p ${%%RC_NAME%%_pid} ${procname} %%PREFIX%%/lib/emby-server/system/EmbyServer.exe \
	-os freebsd \
	-ffdetect ${%%RC_NAME%%_ffdetect} \
	-ffmpeg ${%%RC_NAME%%_ffmpeg} \
	-ffprobe ${%%RC_NAME%%_ffprobe} \
	-programdata ${%%RC_NAME%%_data_dir} \
	-updatepackage emby-server-freebsd12_{version}_amd64.txz"

start_precmd=%%RC_NAME%%_precmd
%%RC_NAME%%_precmd()
{
	[ -f ${%%RC_NAME%%_pid} ] || install -g ${%%RC_NAME%%_group} -o ${%%RC_NAME%%_user} -- /dev/null ${%%RC_NAME%%_pid}
	[ -d ${%%RC_NAME%%_data_dir} ] || install -d -g ${%%RC_NAME%%_group} -o ${%%RC_NAME%%_user} -- ${%%RC_NAME%%_data_dir}
}

stop_postcmd=%%RC_NAME%%_postcmd
%%RC_NAME%%_postcmd()
{
	rm -f ${%%RC_NAME%%_pid}
}

run_rc_command "$1"