summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoerg Seitter <adk@seitter.net>2020-04-30 23:06:01 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2020-05-05 09:25:20 +0200
commit7dc649ed6dfb737d3af603ad8b41e2162b9abec9 (patch)
treea2124ad33d9d107d1b2d955aefd99188d58433b1
parent90c8be2b41f2866021c186338a9ee3b01765e761 (diff)
shairpoint-sync: proper startup integration
Signed-off-by: Joerg Seitter <adk@seitter.net>
-rw-r--r--package/shairport-sync/Makefile7
-rw-r--r--package/shairport-sync/files/shairport-sync.init28
-rw-r--r--package/shairport-sync/files/shairport-sync.postinst7
3 files changed, 39 insertions, 3 deletions
diff --git a/package/shairport-sync/Makefile b/package/shairport-sync/Makefile
index d9279f0dc..6b3abcec3 100644
--- a/package/shairport-sync/Makefile
+++ b/package/shairport-sync/Makefile
@@ -9,7 +9,7 @@ PKG_RELEASE:= 1
PKG_GIT:= tag
PKG_DESCR:= airplay daemon
PKG_SECTION:= mm/audio
-PKG_DEPENDS:= libressl popt libdaemon libconfig jack mosquitto
+PKG_DEPENDS:= libressl libpopt libdaemon libconfig jack mosquitto
PKG_BUILDDEP:= libressl popt libdaemon libconfig jack mosquitto
PKG_URL:= https://github.com/mikebrady/shairport-sync
PKG_SITES:= https://github.com/mikebrady/shairport-sync.git
@@ -32,9 +32,10 @@ CONFIGURE_ARGS+= --with-pkg-config \
shairport-sync-install:
$(INSTALL_DIR) $(IDIR_SHAIRPORT_SYNC)/usr/bin
+ $(INSTALL_DIR) $(IDIR_SHAIRPORT_SYNC)/etc/shairport-sync
$(INSTALL_BIN) $(WRKINST)/usr/bin/shairport-sync \
$(IDIR_SHAIRPORT_SYNC)/usr/bin
- $(INSTALL_DATA) $(WRKINST)/etc/shairport-sync.conf \
- $(IDIR_SHAIRPORT_SYNC)/etc/shairport-sync.conf
+ $(INSTALL_DATA) $(WRKINST)/etc/* \
+ $(IDIR_SHAIRPORT_SYNC)/etc/shairport-sync/
include $(ADK_TOPDIR)/mk/pkg-bottom.mk
diff --git a/package/shairport-sync/files/shairport-sync.init b/package/shairport-sync/files/shairport-sync.init
new file mode 100644
index 000000000..c9bcb92bf
--- /dev/null
+++ b/package/shairport-sync/files/shairport-sync.init
@@ -0,0 +1,28 @@
+#!/bin/sh
+#PKG shairport-sync
+#INIT 80
+. /etc/rc.conf
+
+case $1 in
+autostop) ;;
+autostart)
+ test x"${shairport_sync:-NO}" = x"NO" && exit 0
+ test x"$shairport_sync" = x"DAEMON" && test -x /bin/mksh && exec mksh -T- $0 start
+ exec sh $0 start
+ ;;
+start)
+ /usr/bin/shairport-sync -c /etc/shairport/shairport-sync.conf -d $shairport_sync_flags
+ ;;
+stop)
+ /usr/bin/shairport-sync -k
+ ;;
+restart)
+ sh $0 stop
+ sh $0 start
+ ;;
+*)
+ echo "Usage: $0 {start | stop | restart}"
+ exit 1
+ ;;
+esac
+exit $?
diff --git a/package/shairport-sync/files/shairport-sync.postinst b/package/shairport-sync/files/shairport-sync.postinst
new file mode 100644
index 000000000..9558f175a
--- /dev/null
+++ b/package/shairport-sync/files/shairport-sync.postinst
@@ -0,0 +1,7 @@
+#!/bin/sh
+. $IPKG_INSTROOT/etc/functions.sh
+add_rcconf shairport_sync NO
+add_rcconf shairport_sync_flags " "
+gid=$(get_next_gid)
+add_group shairport-sync $gid
+add_user shairport-sync $(get_next_uid) $gid /etc/shairport-sync