Add a CYGWIN installer.
This commit is contained in:
+11
@@ -163,12 +163,20 @@ if INSTALL_CONFIG_FILES
|
|||||||
cp scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf.sample
|
cp scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf.sample
|
||||||
[ -f $(DESTDIR)$(sysconfdir)/shairport-sync.conf ] || cp scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf
|
[ -f $(DESTDIR)$(sysconfdir)/shairport-sync.conf ] || cp scripts/shairport-sync.conf $(DESTDIR)$(sysconfdir)/shairport-sync.conf
|
||||||
if USE_DBUS
|
if USE_DBUS
|
||||||
|
if INSTALL_CYGWIN_SERVICE
|
||||||
|
cp scripts/shairport-sync-dbus-policy-cygwin.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-dbus.conf
|
||||||
|
else
|
||||||
cp scripts/shairport-sync-dbus-policy.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-dbus.conf
|
cp scripts/shairport-sync-dbus-policy.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-dbus.conf
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
if USE_MPRIS
|
if USE_MPRIS
|
||||||
|
if INSTALL_CYGWIN_SERVICE
|
||||||
|
cp scripts/shairport-sync-mpris-policy-cygwin.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-dbus.conf
|
||||||
|
else
|
||||||
cp scripts/shairport-sync-mpris-policy.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-mpris.conf
|
cp scripts/shairport-sync-mpris-policy.conf $(DESTDIR)$(sysconfdir)/dbus-1/system.d/shairport-sync-mpris.conf
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
if INSTALL_SYSTEMV
|
if INSTALL_SYSTEMV
|
||||||
getent group shairport-sync &>/dev/null || groupadd -r shairport-sync >/dev/null
|
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
|
getent passwd shairport-sync &> /dev/null || useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null
|
||||||
@@ -189,3 +197,6 @@ if INSTALL_FREEBSD_SERVICE
|
|||||||
[ -f /usr/local/etc/rc.d/shairport_sync ] || cp scripts/shairport-sync.freebsd /usr/local/etc/rc.d/shairport_sync
|
[ -f /usr/local/etc/rc.d/shairport_sync ] || cp scripts/shairport-sync.freebsd /usr/local/etc/rc.d/shairport_sync
|
||||||
chmod 555 /usr/local/etc/rc.d/shairport_sync
|
chmod 555 /usr/local/etc/rc.d/shairport_sync
|
||||||
endif
|
endif
|
||||||
|
if INSTALL_CYGWIN_SERVICE
|
||||||
|
cp scripts/shairport-sync-config /usr/local/bin
|
||||||
|
endif
|
||||||
|
|||||||
@@ -115,6 +115,10 @@ AC_ARG_WITH([freebsd-service],
|
|||||||
[ --with-freebsd-service = install a FreeBSD startup script during a make install], , )
|
[ --with-freebsd-service = install a FreeBSD startup script during a make install], , )
|
||||||
AM_CONDITIONAL([INSTALL_FREEBSD_SERVICE], [test "x$with_freebsd_service" = "xyes"])
|
AM_CONDITIONAL([INSTALL_FREEBSD_SERVICE], [test "x$with_freebsd_service" = "xyes"])
|
||||||
|
|
||||||
|
AC_ARG_WITH([cygwin-service],
|
||||||
|
[ --with-cygwin-service = install a CYGWIN config script during a make install], , )
|
||||||
|
AM_CONDITIONAL([INSTALL_CYGWIN_SERVICE], [test "x$with_cygwin_service" = "xyes"])
|
||||||
|
|
||||||
AC_ARG_WITH([external-mdns],[ --with-external-mdns = support the use of 'avahi-publish-service' or 'mDNSPublish' to advertise the service on Bonjour/ZeroConf ],[ AC_MSG_RESULT(>>Including external mdns support) AC_DEFINE([CONFIG_EXTERNAL_MDNS], 1, [Needed by the compiler.]) ], )
|
AC_ARG_WITH([external-mdns],[ --with-external-mdns = support the use of 'avahi-publish-service' or 'mDNSPublish' to advertise the service on Bonjour/ZeroConf ],[ AC_MSG_RESULT(>>Including external mdns support) AC_DEFINE([CONFIG_EXTERNAL_MDNS], 1, [Needed by the compiler.]) ], )
|
||||||
AM_CONDITIONAL([USE_EXTERNAL_MDNS], [test "x$with_external_mdns" = "xyes" ])
|
AM_CONDITIONAL([USE_EXTERNAL_MDNS], [test "x$with_external_mdns" = "xyes" ])
|
||||||
|
|
||||||
|
|||||||
Executable
+169
@@ -0,0 +1,169 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# shairport-sync-config, Copyright 2019 Mike Brady
|
||||||
|
#
|
||||||
|
# Based, with thanks, on:
|
||||||
|
# avahi-daemon-config, Copyright 2011 Yaakov Selkowitz
|
||||||
|
#
|
||||||
|
# This file is part of the Cygwin port of shairport-sync.
|
||||||
|
|
||||||
|
# ======================================================================
|
||||||
|
# Initialization
|
||||||
|
# ======================================================================
|
||||||
|
PROGNAME=$(basename $0)
|
||||||
|
_tdir=$(dirname $0)
|
||||||
|
PROGDIR=$(cd $_tdir && pwd)
|
||||||
|
|
||||||
|
CSIH_SCRIPT=/usr/share/csih/cygwin-service-installation-helper.sh
|
||||||
|
|
||||||
|
# Subdirectory where the new package is being installed
|
||||||
|
PREFIX=/usr/local/bin
|
||||||
|
|
||||||
|
# Directory where the config files are stored
|
||||||
|
SYSCONFDIR=/etc
|
||||||
|
LOGDIR=/var/log
|
||||||
|
SOCKDIR=/var/run
|
||||||
|
|
||||||
|
source ${CSIH_SCRIPT}
|
||||||
|
|
||||||
|
# ======================================================================
|
||||||
|
# Routine: install_service
|
||||||
|
# Install shairport-sync as a service
|
||||||
|
# ======================================================================
|
||||||
|
install_service() {
|
||||||
|
|
||||||
|
if csih_is_nt
|
||||||
|
then
|
||||||
|
|
||||||
|
# Check if shairport-sync is installed and remove on user request.
|
||||||
|
if cygrunsrv -Q shairport-sync > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
csih_warning "The shairport-sync service is already installed."
|
||||||
|
echo
|
||||||
|
if csih_request "Do you want to reinstall it with different args?"
|
||||||
|
then
|
||||||
|
cygrunsrv -E shairport-sync
|
||||||
|
cygrunsrv -R shairport-sync
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install shairport-sync service if it is not already installed
|
||||||
|
if ! cygrunsrv -Q shairport-sync > /dev/null 2>&1
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
csih_warning "The following function requires administrator privileges!"
|
||||||
|
if csih_request "Do you want to install shairport-sync as a service?"
|
||||||
|
then
|
||||||
|
if cygrunsrv -I shairport-sync --disp "CYGWIN Shairport Sync" --desc "AirPlay Audio. Use your computer's speakers or headphones to listen to audio from your iOS devices or other AirPlay sources on your network." --path $PREFIX/shairport-sync --dep avahi-daemon --dep messagebus
|
||||||
|
then
|
||||||
|
echo
|
||||||
|
csih_inform "The shairport-sync service has been installed under the LocalSystem"
|
||||||
|
csih_inform "account (also known as SYSTEM). To start the service now, call"
|
||||||
|
csih_inform "\`net start shairport-sync' or \`cygrunsrv -S shairport-sync'. Otherwise,"
|
||||||
|
csih_inform "it will start automatically after the next reboot."
|
||||||
|
echo
|
||||||
|
csih_inform "Check ${SYSCONFDIR}/shairport-sync.conf first, if it suits your needs."
|
||||||
|
fi
|
||||||
|
fi # user allowed us to install shairport-sync
|
||||||
|
fi # shairport-sync already installed
|
||||||
|
fi # csih_is_nt
|
||||||
|
} # --- End of install_service --- #
|
||||||
|
|
||||||
|
|
||||||
|
# ======================================================================
|
||||||
|
# Main Entry Point
|
||||||
|
# ======================================================================
|
||||||
|
|
||||||
|
|
||||||
|
# Check how the script has been started. If
|
||||||
|
# (1) it has been started by giving the full path and
|
||||||
|
# that path is /etc/postinstall, OR
|
||||||
|
# (2) Otherwise, if the environment variable
|
||||||
|
# CONFIG_AUTO_ANSWER_NO is set
|
||||||
|
# then set auto_answer to "no". This allows automatic
|
||||||
|
# creation of the config files in /etc w/o overwriting
|
||||||
|
# them if they already exist. In both cases, color
|
||||||
|
# escape sequences are suppressed, so as to prevent
|
||||||
|
# cluttering setup's logfiles.
|
||||||
|
if [ "$PROGDIR" = "/etc/postinstall" ]
|
||||||
|
then
|
||||||
|
csih_auto_answer="no"
|
||||||
|
csih_disable_color
|
||||||
|
fi
|
||||||
|
if [ -n "${CONFIG_AUTO_ANSWER_NO}" ]
|
||||||
|
then
|
||||||
|
csih_auto_answer="no"
|
||||||
|
csih_disable_color
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# ======================================================================
|
||||||
|
# Parse options
|
||||||
|
# ======================================================================
|
||||||
|
while :
|
||||||
|
do
|
||||||
|
case $# in
|
||||||
|
0)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
option=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
case "$option" in
|
||||||
|
-d | --debug )
|
||||||
|
set -x
|
||||||
|
csih_trace_on
|
||||||
|
;;
|
||||||
|
|
||||||
|
-y | --yes )
|
||||||
|
csih_auto_answer=yes
|
||||||
|
;;
|
||||||
|
|
||||||
|
-n | --no )
|
||||||
|
csih_auto_answer=no
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "usage: ${PROGNAME} [OPTION]..."
|
||||||
|
echo
|
||||||
|
echo "This script creates a basic shairport-sync configuration."
|
||||||
|
echo
|
||||||
|
echo "Options:"
|
||||||
|
echo " --debug -d Enable shell's debug output."
|
||||||
|
echo " --yes -y Answer all questions with \"yes\" automatically."
|
||||||
|
echo " --no -n Answer all questions with \"no\" automatically."
|
||||||
|
echo
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
# ======================================================================
|
||||||
|
# Action!
|
||||||
|
# ======================================================================
|
||||||
|
|
||||||
|
# Check for ${SYSCONFDIR} directory
|
||||||
|
csih_make_dir "${SYSCONFDIR}" "Cannot create global configuration files."
|
||||||
|
chmod 775 "${SYSCONFDIR}"
|
||||||
|
setfacl -m u:system:rwx "${SYSCONFDIR}"
|
||||||
|
|
||||||
|
# Check for ${LOGDIR} directory
|
||||||
|
csih_make_dir "${LOGDIR}" "Syslogging using shairport-sync will not work."
|
||||||
|
chmod 775 "${LOGDIR}"
|
||||||
|
setfacl -m u:system:rwx "${LOGDIR}"
|
||||||
|
|
||||||
|
# Check for ${SOCKDIR} directory
|
||||||
|
csih_make_dir "${SOCKDIR}" "SOCKET files of running processes will not be created."
|
||||||
|
chmod 775 "${SOCKDIR}"
|
||||||
|
setfacl -m u:system:rwx "${SOCKDIR}"
|
||||||
|
|
||||||
|
# maybe: csih_auto_answer=no will skip,
|
||||||
|
# interactive user will get a chance to override
|
||||||
|
install_service
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "Configuration finished. Have fun!"
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!-- initial version, based on /etc/dbus-1/system.d/avahi-dbus.conf, with thanks -->
|
||||||
|
<!DOCTYPE busconfig PUBLIC
|
||||||
|
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||||
|
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||||
|
<busconfig>
|
||||||
|
|
||||||
|
<!-- Only user SYSTEM can own the Shairport Sync service -->
|
||||||
|
<policy user="SYSTEM">
|
||||||
|
<allow own="org.gnome.ShairportSync"/>
|
||||||
|
</policy>
|
||||||
|
|
||||||
|
<!-- Allow anyone to invoke methods on Shairport Sync server -->
|
||||||
|
<policy context="default">
|
||||||
|
<allow send_destination="org.gnome.ShairportSync"/>
|
||||||
|
<allow receive_sender="org.gnome.ShairportSync"/>
|
||||||
|
</policy>
|
||||||
|
|
||||||
|
</busconfig>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<!-- initial version, based on /etc/dbus-1/system.d/avahi-dbus.conf, with thanks -->
|
||||||
|
<!DOCTYPE busconfig PUBLIC
|
||||||
|
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
|
||||||
|
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
|
||||||
|
<busconfig>
|
||||||
|
|
||||||
|
<!-- Only user "SYSTEM" can own the Shairport Sync MPRIS service -->
|
||||||
|
<policy user="SYSTEM">
|
||||||
|
<allow own="org.mpris.MediaPlayer2.ShairportSync"/>
|
||||||
|
</policy>
|
||||||
|
|
||||||
|
<!-- Allow anyone to invoke methods on Shairport Sync MPRIS server -->
|
||||||
|
<policy context="default">
|
||||||
|
<allow send_destination="org.mpris.MediaPlayer2.ShairportSync"/>
|
||||||
|
<allow receive_sender="org.mpris.MediaPlayer2.ShairportSync"/>
|
||||||
|
</policy>
|
||||||
|
|
||||||
|
</busconfig>
|
||||||
Reference in New Issue
Block a user