aboutsummaryrefslogtreecommitdiffstats
path: root/testing/shairport-sync
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-04-11 12:56:41 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-04-11 13:52:14 +0200
commitb8722d30267e9bbb46f9a7aab70ff024cf79d006 (patch)
tree5dbcdb5cd1f3a5661089d97a0187332f5de10b33 /testing/shairport-sync
parentb47a17bdc2d36bcd637baa8bf38742e38c79555f (diff)
downloadaports-b8722d30267e9bbb46f9a7aab70ff024cf79d006.tar.bz2
aports-b8722d30267e9bbb46f9a7aab70ff024cf79d006.tar.xz
testing/shairport-sync: don't start with --daemon
Diffstat (limited to 'testing/shairport-sync')
-rw-r--r--testing/shairport-sync/APKBUILD7
-rw-r--r--testing/shairport-sync/dont-check-pidfile-when-not-daemonised.patch42
-rw-r--r--testing/shairport-sync/shairport-sync.initd6
3 files changed, 52 insertions, 3 deletions
diff --git a/testing/shairport-sync/APKBUILD b/testing/shairport-sync/APKBUILD
index 871f6fc007..a5f7d65b25 100644
--- a/testing/shairport-sync/APKBUILD
+++ b/testing/shairport-sync/APKBUILD
@@ -12,7 +12,8 @@ makedepends="autoconf automake libtool alsa-lib-dev libdaemon-dev popt-dev
libressl-dev soxr-dev avahi-dev libconfig-dev"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/mikebrady/$pkgname/archive/$pkgver.tar.gz
- $pkgname.initd"
+ $pkgname.initd
+ dont-check-pidfile-when-not-daemonised.patch"
builddir="$srcdir/$pkgname-$pkgver"
prepare() {
@@ -31,6 +32,7 @@ build() {
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--localstatedir=/var \
+ --with-piddir=/run \
--with-alsa \
--with-avahi \
--with-ssl=openssl \
@@ -46,4 +48,5 @@ package() {
}
sha512sums="071593cd264848209031469469d182a428ec132cb646a402eb30ae51e5d2eb78c436d6c4567d2e0583cf10788a5a5221e35cf81c95fab628d7da9bc0f3ff0328 shairport-sync-3.0.2.tar.gz
-4fc22ddaa566c23b02d5cbd5cecf5374ea264e864d735170e6194e4b2c940f57515875a28e5c0886982ab32c75fa0eee0d33a0ed60438420da2478bc0d441b21 shairport-sync.initd"
+aeead51ef0f17d360bb1e2d2ae897974ef507ef56db84e6aeb79d8ec522c3bb9336f01ff4150e70fecfebf9808dd7190cb2839e287cf0ef6e1886504c1f1edc6 shairport-sync.initd
+32a63cd86e8eb81e66c0ed39053f57ff3dfdfc3396c4a683368fb3222ad08e1c330f33b548f094e6f64ffb5129bfa1d4ce1794190651f9e6f77228a2f3336cd6 dont-check-pidfile-when-not-daemonised.patch"
diff --git a/testing/shairport-sync/dont-check-pidfile-when-not-daemonised.patch b/testing/shairport-sync/dont-check-pidfile-when-not-daemonised.patch
new file mode 100644
index 0000000000..aabeb818c8
--- /dev/null
+++ b/testing/shairport-sync/dont-check-pidfile-when-not-daemonised.patch
@@ -0,0 +1,42 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Tue, 11 Apr 2017 12:24:00 +0200
+Subject: [PATCH] Don't check pidfile when not --daemon
+
+shairport reads pidfile to check if it's not already running even when
+started without -d / --daemon. Thus it cannot be properly started by
+init system without enabling --daemon (that's a bad practice).
+
+This patch fixes this behaviour.
+
+--- a/shairport.c
++++ b/shairport.c
+@@ -87,7 +87,9 @@
+ shairport_shutdown();
+ // daemon_log(LOG_NOTICE, "exit...");
+ daemon_retval_send(255);
+- daemon_pid_file_remove();
++ if (config.daemonise) {
++ daemon_pid_file_remove();
++ }
+ exit(0);
+ }
+
+@@ -997,7 +999,7 @@
+ }
+
+ /* Check that the daemon is not running twice at the same time */
+- if ((pid = daemon_pid_file_is_running()) >= 0) {
++ if (config.daemonise && (pid = daemon_pid_file_is_running()) >= 0) {
+ daemon_log(LOG_ERR, "Daemon already running on PID file %u", pid);
+ return 1;
+ }
+@@ -1257,6 +1259,8 @@
+ finish:
+ daemon_log(LOG_NOTICE, "Unexpected exit...");
+ daemon_retval_send(255);
+- daemon_pid_file_remove();
++ if (config.daemonise) {
++ daemon_pid_file_remove();
++ }
+ return 1;
+ }
diff --git a/testing/shairport-sync/shairport-sync.initd b/testing/shairport-sync/shairport-sync.initd
index 31f7643c83..02b0df9eb2 100644
--- a/testing/shairport-sync/shairport-sync.initd
+++ b/testing/shairport-sync/shairport-sync.initd
@@ -2,8 +2,12 @@
description="Implements a synchronous (multi-room-capable) AirPlay receiver"
command="/usr/bin/shairport-sync"
-command_args="-d"
+command_background="yes"
+
pidfile="/run/$RC_SVCNAME.pid"
+start_stop_daemon_args="
+ --stdout /var/log/$RC_SVCNAME.log
+ --stderr /var/log/$RC_SVCNAME.log"
depend() {
need net localmount avahi-daemon