diff --git audio/spotifyd/Makefile audio/spotifyd/Makefile index 401f28427f93..71b299c115ee 100644 --- audio/spotifyd/Makefile +++ audio/spotifyd/Makefile @@ -2,7 +2,7 @@ PORTNAME= spotifyd DISTVERSION= 0.2.9 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= audio MAINTAINER= tobik@FreeBSD.org @@ -15,6 +15,8 @@ LIB_DEPENDS= libogg.so:audio/libogg USES= cargo ssl:build USE_GITHUB= yes +USE_RC_SUBR= ${PORTNAME} + GH_ACCOUNT= Spotifyd GH_TUPLE= plietar:dns-parser:1d3e5a5591bc72eb061c23bd426c4a25f2f73791:dnsparser \ librespot-org:librespot:5d2cb32e20815f3b7879962e8af2fb9ef4c3870d:librespot \ @@ -337,7 +339,8 @@ CARGO_BUILD_ARGS= --no-default-features CARGO_INSTALL_ARGS= --no-default-features CARGO_TEST_ARGS= --no-default-features -PLIST_FILES= bin/spotifyd +PLIST_FILES= bin/spotifyd \ + "@sample ${PREFIX}/etc/spotifyd.conf.sample" PORTDOCS= README.md OPTIONS_DEFINE= DBUS DOCS PORTAUDIO PULSEAUDIO @@ -359,6 +362,7 @@ post-patch: post-install: ${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/spotifyd + ${INSTALL_DATA} ${FILESDIR}/spotifyd.conf ${STAGEDIR}${PREFIX}/etc/spotifyd.conf.sample post-install-DOCS-on: @${MKDIR} ${STAGEDIR}${DOCSDIR} diff --git audio/spotifyd/files/spotifyd.conf audio/spotifyd/files/spotifyd.conf new file mode 100644 index 000000000000..df18fa86e36c --- /dev/null +++ audio/spotifyd/files/spotifyd.conf @@ -0,0 +1,3 @@ +[global] +username = user +password = pass diff --git audio/spotifyd/files/spotifyd.in audio/spotifyd/files/spotifyd.in new file mode 100644 index 000000000000..8f884445ba97 --- /dev/null +++ audio/spotifyd/files/spotifyd.in @@ -0,0 +1,38 @@ +#!/bin/sh + +# PROVIDE: spotifyd +# REQUIRE: DAEMON NETWORKING +# KEYWORD: shutdown + +# +# Add the following lines to /etc/rc.conf.local, /etc/rc.conf or +# /etc/rc.conf.d/spotifyd to enable this service: +# +# spotifyd_enable (bool): Set to NO by default. +# Set it to "YES" to enable spotifyd. +# spotifyd_config (str): Set to $PREFIX/etc/etc/spotifyd.conf by default. +# Path to configuration file. + +. /etc/rc.subr + +name=spotifyd +rcvar=spotifyd_enable +start_precmd="${name}_precmd" + +load_rc_config $name + +: ${spotifyd_enable:="NO"} +: ${spotifyd_config:="%%PREFIX%%/etc/spotifyd.conf"} + +pidfile="/var/run/${name}/${name}.pid" +procname="%%PREFIX%%/bin/${name}" +command="/usr/sbin/daemon" +spotifyd_args="-c ${spotifyd_config}" +command_args="-S -m 3 -s "info" -l "daemon" -p ${pidfile} ${procname} --no-daemon ${spotifyd_args}" + +spotifyd_precmd() +{ + /usr/bin/install -d -m 0755 -o ${spotifyd_user} /var/run/${name} +} + +run_rc_command "$1"