blob: 526cd959822b3b8f13255eb57eafb1ed33726e9a (
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
|
#!/bin/sh
# PROVIDE: go_librespot
# REQUIRE: DAEMON NETWORKING
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local, /etc/rc.conf or
# /etc/rc.conf.d/go-librespot to enable this service:
#
# go_librespot_enable (bool): Set to NO by default.
# Set it to "YES" to enable go-librespot.
# go_librespot_config_dir (str): Set to %%PREFIX%%/etc/go-librespot by default.
# Path to configuration file.
# go_librespot_user (str): Set to "nobody" by default.
# User to run go-librespot
. /etc/rc.subr
name=go_librespot
rcvar=go_librespot_enable
start_precmd="${name}_precmd"
load_rc_config $name
: ${go_librespot_enable:="NO"}
: ${go_librespot_config_dir:="%%PREFIX%%/etc/go-librespot"}
: ${go_librespot_user:="nobody"}
pidfile="/var/run/${name}/${name}.pid"
procname="%%PREFIX%%/bin/go-librespot"
command="/usr/sbin/daemon"
command_args="-S -m 3 -s info -l daemon -p ${pidfile} ${procname} --config_dir ${go_librespot_config_dir}"
go_librespot_precmd()
{
/usr/bin/install -d -m 0755 -o ${go_librespot_user} ${go_librespot_config_dir}
/usr/bin/install -d -m 0755 -o ${go_librespot_user} /var/run/${name}
}
run_rc_command "$1"
|