From: Hugo Villeneuve Date: Fri, 1 Mar 2024 04:41:14 +0000 (-0500) Subject: shairport-sync: stop MPD before playing X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=aa56438010d3a4adf45ec1403da2a52489416461;p=yocto%2Fmeta-hvmpd.git shairport-sync: stop MPD before playing --- diff --git a/recipes-multimedia/shairport-sync/files/mpc-stop.sh b/recipes-multimedia/shairport-sync/files/mpc-stop.sh new file mode 100644 index 0000000..03fa34c --- /dev/null +++ b/recipes-multimedia/shairport-sync/files/mpc-stop.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +# This script is used by shairport-sync to stop MPD +# before starting a new playback session, so that it can +# access the sound card. + +mpc stop diff --git a/recipes-multimedia/shairport-sync/shairport-sync_git.bb b/recipes-multimedia/shairport-sync/shairport-sync_git.bb index 9b3d826..9c104dd 100644 --- a/recipes-multimedia/shairport-sync/shairport-sync_git.bb +++ b/recipes-multimedia/shairport-sync/shairport-sync_git.bb @@ -9,6 +9,7 @@ SRC_URI = "git://github.com/mikebrady/shairport-sync;protocol=https;branch=${SRC SRC_URI += " \ file://0001-yocto-disable-user-group-creation.patch \ file://shairport-sync.conf.in \ + file://mpc-stop.sh \ " S = "${WORKDIR}/git" @@ -34,6 +35,13 @@ do_install:append() { ${WORKDIR}/shairport-sync.conf.in > ${WORKDIR}/shairport-sync.conf install -d ${D}${sysconfdir}/ install -m 0644 ${WORKDIR}/shairport-sync.conf ${D}${sysconfdir}/ + + # Modify shairport-sync start arguments to always stop MPD before playing: + sed -i -e "s@^\(ExecStart=.*\)@\1 -w --on-start=${bindir}/mpc-stop.sh@g" \ + ${D}${systemd_unitdir}/system/shairport-sync.service + + install -d ${D}${bindir} + install -m 0755 ${WORKDIR}/mpc-stop.sh ${D}${bindir} } SYSTEMD_SERVICE:${PN} = " \