aboutsummaryrefslogtreecommitdiff
path: root/www/libresonic-standalone/files/libresonic.in
blob: e89d0a038ae72eac86ce185bbce24dd52de0f326 (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

# PROVIDE: libresonic
# REQUIRE: LOGIN
# KEYWORD: shutdown

#
# Configuration settings for libresonic in /etc/rc.conf:
#
# libresonic_enable (bool):
#   Set to "NO" by default.
#   Set it to "YES" to enable libresonic.
#
# libresonic_home (str):
#   Set to "%%LIBRESONIC_HOME%%" by default.
#
# libresonic_host (str):
#   Set to "0.0.0.0" by default.
#   Specify which IP address to listen to.
#
# libresonic_port (int):
#   Set to "4040" by default.
#
# libresonic_context_path (str):
#   Set to "/" by default.
#   Specify the last part of the Libresonic URL, typically "/" or "/libresonic".
#
# libresonic_max_memory (int):
#   Set to "100" by default.
#   Specify the memory limit (Java heap size) in megabytes.
#

. /etc/rc.subr

name=libresonic
rcvar=${name}_enable
procname="%%JAVA%%"

load_rc_config "${name}"

: ${libresonic_enable:="NO"}
: ${libresonic_user:="%%USER%%"}
: ${libresonic_group:="%%GROUP%%"}
: ${libresonic_home:="%%LIBRESONIC_HOME%%"}
: ${libresonic_host:="0.0.0.0"}
: ${libresonic_port:="4040"}
: ${libresonic_context_path:="/"}
: ${libresonic_max_memory:="100"}

if checkyesno libresonic_ssl; then
        err 1 \
"Libresonic SSL/HTTPS support has been removed.
Please see entry 20180924 in UPDATING."
fi

start_precmd="export LC_CTYPE='en_US.UTF-8'"
libresonic_chdir="%%DATADIR%%"
command="/usr/sbin/daemon"
command_args="-f ${procname} \
	-Dlibresonic.home=${libresonic_home} \
	-Dserver.host=${libresonic_host} \
	-Dserver.port=${libresonic_port} \
	-Dserver.contextPath=${libresonic_context_path} \
	-Dlibresonic.defaultMusicFolder=${libresonic_home}/music \
	-Dlibresonic.defaultPodcastFolder=${libresonic_home}/Podcast \
	-Dlibresonic.defaultPlaylistFolder=${libresonic_home}/playlists \
	-Xmx${libresonic_max_memory}m \
	-Djava.awt.headless=true \
	-jar ${libresonic_chdir}/libresonic.war"

run_rc_command "$1"