diff --git a/server/Makefile b/server/Makefile index 0efed4bd..d55e339a 100644 --- a/server/Makefile +++ b/server/Makefile @@ -61,6 +61,14 @@ install: install -D -g root -o root $(BIN) $(TARGET_DIR)/sbin/$(BIN) install -D -g root -o root $(BIN).1 $(TARGET_DIR)/share/man/man1/$(BIN).1 +else ifeq ($(TARGET), FREEBSD) + +install: + echo BSD + install -g wheel -o root -m 555 $(BIN) $(TARGET_DIR)/local/sbin/$(BIN) + install -g wheel -o root -m 555 $(BIN).1 $(TARGET_DIR)/local/man/man1/$(BIN).1 + install -g wheel -o root -m 555 debian/$(BIN).bsd /usr/local/etc/rc.d/$(BIN) + else install: @@ -93,6 +101,9 @@ installsysv: update-rc.d $(BIN) defaults; \ /etc/init.d/$(BIN) start; \ +installbsd: + @echo using bsd; \ + cp debian/$(BIN).bsd /usr/local/etc/rc.d/$(BIN); \ uninstall: rm -f $(TARGET_DIR)/share/man/man1/$(BIN).1 diff --git a/server/debian/snapserver.bsd b/server/debian/snapserver.bsd new file mode 100644 index 00000000..9c9b49a7 --- /dev/null +++ b/server/debian/snapserver.bsd @@ -0,0 +1,36 @@ +#!/bin/sh + +# PROVIDE: snapserver +# REQUIRE: DAEMON +# KEYWORD: Snapserver +# +# Snapserver - Snapcast server +# +# Add the following line to /etc/rc.conf to enable snapserver: +# snapserver_enable=YES +# Add snapserver_opts= to configure command line arguments + +snapserver_opts="-d" + +. /etc/rc.subr + +name=snapserver +rcvar=snapserver_enable +desc="Snapserver - Snapcast server" + +load_rc_config $name + +: ${snapserver_enable:=NO} + +command=/usr/local/sbin/${name} +pidfile="/var/run/${name}.pid" + +start_cmd=snapserver_start + + +snapserver_start() { + checkyesno snapserver_enable && echo "Starting snapserver." && ${command} ${snapserver_opts} +} + +run_rc_command $1 +