#!/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"