Changeset View
Changeset View
Standalone View
Standalone View
www/libresonic-standalone/files/libresonic.in
- This file was added.
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
svn:keywords | null | FreeBSD=%H \ No newline at end of property |
svn:mime-type | null | text/plain \ No newline at end of property |
#!/bin/sh | |||||
# | |||||
# $FreeBSD$ | |||||
# | |||||
# 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. | |||||
# Specify which port to listen on for HTTP(S). | |||||
# | |||||
# libresonic_ssl (bool): | |||||
# Set to "NO" by default. | |||||
# Set it to "YES" to enable SSL. | |||||
# | |||||
# libresonic_ssl_keystore (str): | |||||
# Optionally set path to custom SSL keystore. | |||||
# | |||||
# libresonic_ssl_password (str): | |||||
# Optionally set password for custom SSL keystore. | |||||
# | |||||
# 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_ssl:="NO"} | |||||
: ${libresonic_context_path:="/"} | |||||
: ${libresonic_max_memory:="100"} | |||||
if checkyesno libresonic_ssl; then | |||||
LIBRESONIC_SSL_FLAGS="-Dlibresonic.httpsPort=${libresonic_port}" && libresonic_port="0" | |||||
if [ ! -z ${libresonic_ssl_keystore} ]; then | |||||
LIBRESONIC_SSL_FLAGS=${LIBRESONIC_SSL_FLAGS}" -Dlibresonic.ssl.keystore=${libresonic_ssl_keystore} -Dlibresonic.ssl.password=${libresonic_ssl_password}" | |||||
fi | |||||
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} \ | |||||
-Dlibresonic.host=${libresonic_host} \ | |||||
-Dlibresonic.port=${libresonic_port} \ | |||||
${LIBRESONIC_SSL_FLAGS} \ | |||||
-Dlibresonic.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" |