shairport-sync: Add initscript
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 11 Nov 2018 18:55:35 +0000 (18:55 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 11 Nov 2018 18:55:35 +0000 (18:55 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/rootfiles/packages/shairport-sync
lfs/shairport-sync
src/initscripts/packages/shairport-sync [new file with mode: 0755]

index d7c2e11..a0cd5c8 100644 (file)
@@ -1,3 +1,4 @@
+etc/rc.d/init.d/shairport-sync
 etc/shairport-sync.conf
 #etc/shairport-sync.conf.sample
 usr/bin/shairport-sync
index 2894c7a..7703adc 100644 (file)
@@ -92,5 +92,8 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
        install -v -m 644 $(DIR_SRC)/config/backup/includes/shairport-sync \
                /var/ipfire/backup/addons/includes/shairport-sync
 
+       # Initscript
+       $(call INSTALL_INITSCRIPT,shairport-sync)
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
diff --git a/src/initscripts/packages/shairport-sync b/src/initscripts/packages/shairport-sync
new file mode 100755 (executable)
index 0000000..a5d81a9
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/shairport-sync
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+case "${1}" in
+       start)
+               boot_mesg "Starting Shairport Sync..."
+               loadproc /usr/bin/shairport-sync --daemon
+               ;;
+
+       stop)
+               boot_mesg "Stopping Shairport Sync..."
+               killproc /usr/bin/shairport-sync
+               ;;
+
+       reload)
+               boot_mesg "Reloading Shairport Sync..."
+               reloadproc /usr/bin/shairport-sync
+               ;;
+
+       restart)
+               ${0} stop
+               sleep 1
+               ${0} start
+               ;;
+
+       status)
+               statusproc /usr/bin/shairport-sync
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|stop|reload|restart|status}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/shairport-sync