Remove the requirement for Avahi in the systemd startup file unless Avahi is included in the build.

This commit is contained in:
Mike Brady
2022-04-05 07:22:34 +01:00
parent bc97f76a16
commit 38bbad6f63
5 changed files with 25 additions and 3 deletions
+1
View File
@@ -25,6 +25,7 @@ stamp-h1
man/Makefile
man/Makefile.in
scripts/shairport-sync.service
scripts/shairport-sync.service-avahi
scripts/shairport-sync
shairport-sync.core
gitversion.h
+4
View File
@@ -236,8 +236,12 @@ if INSTALL_SYSTEMD
getent group shairport-sync &>/dev/null || groupadd -r shairport-sync >/dev/null
getent passwd shairport-sync &> /dev/null || useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null
[ -e $(DESTDIR)$(systemdsystemunitdir) ] || mkdir -p $(DESTDIR)$(systemdsystemunitdir)
if USE_AVAHI
[ -e $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service ] || cp scripts/shairport-sync.service-avahi $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service
else
[ -e $(DESTDIR)$(systemdsystemunitdir)/shairport-sync.service ] || cp scripts/shairport-sync.service $(DESTDIR)$(systemdsystemunitdir)
endif
endif
if INSTALL_FREEBSD_SERVICE
# Choose a uid and gid of 801 completely arbitrarity, except that it should be below 1000. FreeBSD doesn't seem to allow you to say "an ID in the range of..."
pw showgroup shairport-sync > /dev/null 2>&1 || pw addgroup -n shairport-sync -g 801 > /dev/null 2>&1
+5 -1
View File
@@ -230,6 +230,9 @@ if test "x$with_avahi" = "xyes" ; then
AC_DEFINE([CONFIG_AVAHI], 1, [Include Avahi-based mDNS support.])
AC_CHECK_LIB([avahi-client], [avahi_client_new], , AC_MSG_ERROR(Avahi support requires the avahi-client library!))
AC_CHECK_LIB([avahi-common],[avahi_strerror], , AC_MSG_ERROR(Avahi support requires the avahi-common library!))
AC_CONFIG_FILES([scripts/shairport-sync.service-avahi])
else
AC_CONFIG_FILES([scripts/shairport-sync.service])
fi
AM_CONDITIONAL([USE_AVAHI], [test "x$with_avahi" = "xyes"])
@@ -473,6 +476,7 @@ AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_CHECK_FUNCS([atexit clock_gettime gethostname inet_ntoa memchr memmove memset mkfifo pow select socket stpcpy strcasecmp strchr strdup strerror strstr strtol strtoul])
AC_CONFIG_FILES([Makefile man/Makefile scripts/shairport-sync.service])
# Note -- there are AC_CONFIG_FILES directives further back, conditional on Avahi
AC_CONFIG_FILES([Makefile man/Makefile])
AC_CONFIG_FILES([scripts/shairport-sync],[chmod +x scripts/shairport-sync])
AC_OUTPUT
+15
View File
@@ -0,0 +1,15 @@
[Unit]
Description=Shairport Sync - AirPlay Audio Receiver
After=sound.target
Requires=avahi-daemon.service
After=avahi-daemon.service
Wants=network-online.target
After=network.target network-online.target
[Service]
ExecStart=@prefix@/bin/shairport-sync
User=shairport-sync
Group=shairport-sync
[Install]
WantedBy=multi-user.target
-2
View File
@@ -1,8 +1,6 @@
[Unit]
Description=Shairport Sync - AirPlay Audio Receiver
After=sound.target
Requires=avahi-daemon.service
After=avahi-daemon.service
Wants=network-online.target
After=network.target network-online.target