[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#743638: RFP: shairport -- Play music streamed from iTunes/iPads/iPods



On Sun, 20 Dec 2015 09:47:23 +0000 Chris Boot <debian@bootc.net> wrote:
>
> I would *definitely* appreciate patches from anyone who wishes to help,
> or even co-maintenance.

Nice work.  

I just put a bit of effort into getting the systemd service side of things working.  Happy to contribute those, see attached diff. (not sure how alioth works, cant see how to do a pull request there?).  The patch for the systemd unit path i have done a pull request for, so if that is accepted you can drop that.

Though perhaps you intend this not to be a daemon package?

Regards,
Dan.


diff --git a/debian/control b/debian/control
index d7b5e00..c777519 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: shairport-sync
 Section: sound
 Priority: extra
 Maintainer: Chris Boot <debian@bootc.net>
-Build-Depends: debhelper (>= 9), dh-autoreconf, dh-systemd, libasound2-dev, libavahi-client-dev, libconfig-dev, libdaemon-dev, libpopt-dev, libpulse-dev, libsoxr-dev, libssl-dev
+Build-Depends: debhelper (>= 9), dh-autoreconf, dh-systemd, systemd, libasound2-dev, libavahi-client-dev, libconfig-dev, libdaemon-dev, libpopt-dev, libpulse-dev, libsoxr-dev, libssl-dev
 Standards-Version: 3.9.6
 Homepage: https://github.com/mikebrady/shairport-sync
 Vcs-Git: git://anonscm.debian.org/collab-maint/shairport-sync.git
@@ -10,7 +10,7 @@ Vcs-Browser: http://anonscm.debian.org/cgit/collab-maint/shairport-sync.git/
 
 Package: shairport-sync
 Architecture: linux-any
-Depends: ${shlibs:Depends}, ${misc:Depends}
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
 Description: AirPlay audio player
  Plays audio streamed from iTunes, iOS devices and third-party AirPlay
  sources such as ForkedDaapd and others. Audio played by a Shairport
diff --git a/debian/patches/correct-systemd-unit-path.diff b/debian/patches/correct-systemd-unit-path.diff
new file mode 100644
index 0000000..84b8f6c
--- /dev/null
+++ b/debian/patches/correct-systemd-unit-path.diff
@@ -0,0 +1,36 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -61,6 +61,6 @@ if INSTALL_SYSTEMV
+ 	[ -f $(DESTDIR)/etc/init.d/shairport-sync ] || cp scripts/shairport-sync $(DESTDIR)/etc/init.d/
+ endif
+ if INSTALL_SYSTEMD
+-	[ -e $(DESTDIR)/usr/lib/systemd/system ] || mkdir -p $(DESTDIR)/usr/lib/systemd/system
+-	cp scripts/shairport-sync.service $(DESTDIR)/usr/lib/systemd/system
++	[ -e $(DESTDIR)$(systemdsystemunitdir) ] || mkdir -p $(DESTDIR)$(systemdsystemunitdir)
++	cp scripts/shairport-sync.service $(DESTDIR)$(systemdsystemunitdir)
+ endif
+--- a/configure.ac
++++ b/configure.ac
+@@ -213,6 +213,22 @@ AC_ARG_WITH(dns_sd, [  --with-dns_sd = c
+   AC_SEARCH_LIBS([DNSServiceRefDeallocate], [dns_sd], , AC_MSG_ERROR(dns_sd support requires the dns_sd library!))], )
+ AM_CONDITIONAL([USE_DNS_SD], [test "x$HAS_DNS_SD" = "x1"])
+ 
++# Find systemd unit dir
++AC_ARG_WITH([systemdsystemunitdir],
++     [AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])],,
++     [with_systemdsystemunitdir=auto])
++AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], [
++     def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
++
++     AS_IF([test "x$def_systemdsystemunitdir" = "x"],
++   [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
++    [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
++    with_systemdsystemunitdir=no],
++   [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
++AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
++      [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
++AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"])
++
+ # Checks for header files.
+ AC_HEADER_STDC
+ AC_CHECK_HEADERS([getopt_long.h])
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..6a10cf6
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+correct-systemd-unit-path.diff
+use-usr-bin-not-usr-local-bin-in-systemd.diff
+use-usr-bin-not-usr-local-bin-in-init.diff
diff --git a/debian/patches/use-usr-bin-not-usr-local-bin-in-init.diff b/debian/patches/use-usr-bin-not-usr-local-bin-in-init.diff
new file mode 100644
index 0000000..9340d5b
--- /dev/null
+++ b/debian/patches/use-usr-bin-not-usr-local-bin-in-init.diff
@@ -0,0 +1,11 @@
+--- a/scripts/shairport-sync
++++ b/scripts/shairport-sync
+@@ -17,7 +17,7 @@
+ PATH=/sbin:/usr/sbin:/bin:/usr/bin
+ DESC="AirPlay Synchronous Audio Service"
+ NAME=shairport-sync
+-DAEMON=/usr/local/bin/$NAME
++DAEMON=/usr/bin/$NAME
+ 
+ # We don't use the DAEMON_ARGS variable here because some of the identifiers may have spaces in them, and so are
+ # impossible to pass as arguments.
diff --git a/debian/patches/use-usr-bin-not-usr-local-bin-in-systemd.diff b/debian/patches/use-usr-bin-not-usr-local-bin-in-systemd.diff
new file mode 100644
index 0000000..2b1571c
--- /dev/null
+++ b/debian/patches/use-usr-bin-not-usr-local-bin-in-systemd.diff
@@ -0,0 +1,11 @@
+--- a/scripts/shairport-sync.service
++++ b/scripts/shairport-sync.service
+@@ -5,7 +5,7 @@ Requires=avahi-daemon.service
+ After=avahi-daemon.service
+ 
+ [Service]
+-ExecStart=/usr/local/bin/shairport-sync
++ExecStart=/usr/bin/shairport-sync
+ User=shairport-sync
+ Group=shairport-sync
+ 
diff --git a/debian/rules b/debian/rules
index f275b20..f348571 100755
--- a/debian/rules
+++ b/debian/rules
@@ -28,8 +28,8 @@ override_dh_auto_configure:
 		--with-metadata \
 		--with-avahi \
 		--with-alsa \
-		--with-pulseaudio \
-		--without-configfiles
+		--without-configfiles \
+		--with-systemd
 
 override_dh_installchangelogs:
 	dh_installchangelogs --keep RELEASENOTES.md
diff --git a/debian/shairport-sync.postinst b/debian/shairport-sync.postinst
new file mode 100644
index 0000000..4074f5f
--- /dev/null
+++ b/debian/shairport-sync.postinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+# postinst script for shairport-sync
+
+case "$1" in
+
+  configure)
+    adduser --system --group --no-create-home shairport-sync
+    adduser shairport-sync audio
+  
+esac
+
+#DEBHELPER#

Reply to: