mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-08 05:41:46 +02:00
add debian package files
This commit is contained in:
parent
391e86b586
commit
d70b4d747b
21 changed files with 629 additions and 0 deletions
0
debian/README.source
vendored
Normal file
0
debian/README.source
vendored
Normal file
24
debian/changelog
vendored
Normal file
24
debian/changelog
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
snapcast (0.15.0-1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* New upstream release.
|
||||||
|
* Drop add_ldflags.patch, fixed upstream.
|
||||||
|
* Disable statically linking libgcc and libstdc++
|
||||||
|
- Add disable_static_linking.patch
|
||||||
|
* Enable all hardening compiler flags.
|
||||||
|
|
||||||
|
-- Felix Geyer <fgeyer@debian.org> Sat, 28 Jul 2018 11:48:26 +0200
|
||||||
|
|
||||||
|
snapcast (0.14.0-1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* New upstream release.
|
||||||
|
* Install the documentation.
|
||||||
|
* Stop repackaging the main tarball and add the aixlog and popl libraries
|
||||||
|
as additional upstream tarballs.
|
||||||
|
|
||||||
|
-- Felix Geyer <fgeyer@debian.org> Sun, 01 Jul 2018 20:01:05 +0200
|
||||||
|
|
||||||
|
snapcast (0.13.0-1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Initial package. (Closes: #895241)
|
||||||
|
|
||||||
|
-- Felix Geyer <fgeyer@debian.org> Sun, 08 Apr 2018 22:05:46 +0200
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
10
|
42
debian/control
vendored
Normal file
42
debian/control
vendored
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
Source: snapcast
|
||||||
|
Section: sound
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Felix Geyer <fgeyer@debian.org>
|
||||||
|
Build-Depends: debhelper (>= 10~),
|
||||||
|
libasound2-dev,
|
||||||
|
libvorbis-dev,
|
||||||
|
libflac-dev,
|
||||||
|
libavahi-client-dev,
|
||||||
|
libasio-dev
|
||||||
|
Standards-Version: 4.1.4
|
||||||
|
Homepage: https://github.com/badaix/snapcast
|
||||||
|
Vcs-Git: https://salsa.debian.org/debian/snapcast.git
|
||||||
|
Vcs-Browser: https://salsa.debian.org/debian/snapcast
|
||||||
|
|
||||||
|
Package: snapclient
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
|
||||||
|
Recommends: avahi-daemon
|
||||||
|
Description: Snapcast client
|
||||||
|
Snapcast is a multi-room client-server audio player, where all clients are
|
||||||
|
time synchronized with the server to play perfectly synced audio. It's not a
|
||||||
|
standalone player, but an extension that turns your existing audio player into
|
||||||
|
a Sonos-like multi-room solution.
|
||||||
|
.
|
||||||
|
This package contains the client which connects to the server and plays the
|
||||||
|
audio.
|
||||||
|
|
||||||
|
Package: snapserver
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser
|
||||||
|
Recommends: avahi-daemon
|
||||||
|
Description: Snapcast server
|
||||||
|
Snapcast is a multi-room client-server audio player, where all clients are
|
||||||
|
time synchronized with the server to play perfectly synced audio. It's not a
|
||||||
|
standalone player, but an extension that turns your existing audio player into
|
||||||
|
a Sonos-like multi-room solution.
|
||||||
|
.
|
||||||
|
The server's audio input is a named pipe `/tmp/snapfifo`. All data that is fed
|
||||||
|
into this file will be send to the connected clients. One of the most generic
|
||||||
|
ways to use Snapcast is in conjunction with the music player daemon or Mopidy,
|
||||||
|
which can be configured to use a named pipe as audio output.
|
109
debian/copyright
vendored
Normal file
109
debian/copyright
vendored
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: Snapcast
|
||||||
|
Upstream-Contact: Johannes Pohl <snapcast@badaix.de>
|
||||||
|
Source: https://github.com/badaix/snapcast
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2014-2018 Johannes Pohl
|
||||||
|
License: GPL-3+
|
||||||
|
|
||||||
|
Files: client/browseZeroConf/browseAvahi.cpp
|
||||||
|
server/publishZeroConf/publishAvahi.cpp
|
||||||
|
Copyright: avahi developers
|
||||||
|
License: LGPL-2.1+
|
||||||
|
|
||||||
|
Files: server/streamreader/base64.*
|
||||||
|
Copyright: 2004-2008 René Nyffenegger
|
||||||
|
License: Zlib
|
||||||
|
|
||||||
|
Files: common/json.hpp
|
||||||
|
Copyright: 2013-2018 Niels Lohmann
|
||||||
|
2009 Florian Loitsch
|
||||||
|
License: Expat
|
||||||
|
|
||||||
|
Files: common/aixlog.hpp
|
||||||
|
common/popl.hpp
|
||||||
|
server/jsonrpcpp.hpp
|
||||||
|
Copyright: 2015-2019 Johannes Pohl
|
||||||
|
License: Expat
|
||||||
|
|
||||||
|
Files: debian/*
|
||||||
|
Copyright: 2018 Felix Geyer
|
||||||
|
2014-2018 Johannes Pohl
|
||||||
|
License: GPL-3+
|
||||||
|
|
||||||
|
License: GPL-3+
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
.
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
.
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
.
|
||||||
|
On Debian systems, the full text of the GNU General Public
|
||||||
|
License version 2 can be found in the file
|
||||||
|
`/usr/share/common-licenses/GPL-3'.
|
||||||
|
|
||||||
|
License: LGPL-2.1+
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2.1 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
.
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
.
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with This program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||||
|
USA.
|
||||||
|
.
|
||||||
|
On Debian systems, the full text of the GNU General Public
|
||||||
|
License version 2 can be found in the file
|
||||||
|
`/usr/share/common-licenses/LGPL-2.1'.
|
||||||
|
|
||||||
|
License: Zlib
|
||||||
|
This source code is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the author be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
.
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
.
|
||||||
|
1. The origin of this source code must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original source code. If you use this source code
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original source code.
|
||||||
|
.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
License: Expat
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
.
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
.
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
1
debian/patches/series
vendored
Normal file
1
debian/patches/series
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
disable_static_linking.patch
|
15
debian/rules
vendored
Executable file
15
debian/rules
vendored
Executable file
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||||
|
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
|
||||||
|
include /usr/share/dpkg/buildflags.mk
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
override_dh_auto_build:
|
||||||
|
dh_auto_build -- STRIP=: DEBUG= ADD_CFLAGS="$(CXXFLAGS) $(CPPFLAGS)" ADD_LDFLAGS="$(LDFLAGS)"
|
||||||
|
|
||||||
|
override_dh_auto_install:
|
||||||
|
dh_auto_install --sourcedir=client --destdir=debian/snapclient/
|
||||||
|
dh_auto_install --sourcedir=server --destdir=debian/snapserver/
|
1
debian/snapclient.default
vendored
Normal file
1
debian/snapclient.default
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
SNAPCLIENT_OPTS=""
|
161
debian/snapclient.init
vendored
Executable file
161
debian/snapclient.init
vendored
Executable file
|
@ -0,0 +1,161 @@
|
||||||
|
#! /bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: snapclient
|
||||||
|
# Required-Start: $remote_fs $syslog $network
|
||||||
|
# Required-Stop: $remote_fs $syslog $network
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Snapclient initscript
|
||||||
|
# Description: Snapclient - Snapcast client
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Author: Johannes Pohl <snapcast@badaix.de>
|
||||||
|
|
||||||
|
# Do NOT "set -e"
|
||||||
|
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||||
|
DESC="Snapcast client"
|
||||||
|
NAME=snapclient
|
||||||
|
DAEMON=/usr/bin/$NAME
|
||||||
|
PIDFILE=/var/run/$NAME/pid
|
||||||
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
# Read configuration variable file if it is present
|
||||||
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
SNAPCLIENT_OPTS="--daemon $SNAPCLIENT_OPTS"
|
||||||
|
|
||||||
|
if [ "$START_SNAPCLIENT" != "true" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load the VERBOSE setting and other rcS variables
|
||||||
|
. /lib/init/vars.sh
|
||||||
|
|
||||||
|
# Define LSB log_* functions.
|
||||||
|
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
||||||
|
# and status_of_proc is working.
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that starts the daemon/service
|
||||||
|
#
|
||||||
|
do_start()
|
||||||
|
{
|
||||||
|
PIDDIR=$(dirname "$PIDFILE")
|
||||||
|
if [ ! -d "$PIDDIR" ]; then
|
||||||
|
mkdir -m 0755 $PIDDIR
|
||||||
|
chown _snapclient:_snapclient $PIDDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Return
|
||||||
|
# 0 if daemon has been started
|
||||||
|
# 1 if daemon was already running
|
||||||
|
# 2 if daemon could not be started
|
||||||
|
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "_snapclient:_snapclient" --exec "$DAEMON" --test > /dev/null || return 1
|
||||||
|
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "_snapclient:_snapclient" --exec "$DAEMON" -- $SNAPCLIENT_OPTS > /dev/null || return 2
|
||||||
|
# Add code here, if necessary, that waits for the process to be ready
|
||||||
|
# to handle requests from services started subsequently which depend
|
||||||
|
# on this one. As a last resort, sleep for some time.
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that stops the daemon/service
|
||||||
|
#
|
||||||
|
do_stop()
|
||||||
|
{
|
||||||
|
# Return
|
||||||
|
# 0 if daemon has been stopped
|
||||||
|
# 1 if daemon was already stopped
|
||||||
|
# 2 if daemon could not be stopped
|
||||||
|
# other if a failure occurred
|
||||||
|
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
|
||||||
|
RETVAL="$?"
|
||||||
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
|
# Wait for children to finish too if this is a daemon that forks
|
||||||
|
# and if the daemon is only ever run from this initscript.
|
||||||
|
# If the above conditions are not satisfied then add some other code
|
||||||
|
# that waits for the process to drop all resources that could be
|
||||||
|
# needed by services started subsequently. A last resort is to
|
||||||
|
# sleep for some time.
|
||||||
|
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
|
||||||
|
[ "$?" = 2 ] && return 2
|
||||||
|
# Many daemons don't delete their pidfiles when they exit.
|
||||||
|
rm -f $PIDFILE
|
||||||
|
return "$RETVAL"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that sends a SIGHUP to the daemon/service
|
||||||
|
#
|
||||||
|
do_reload() {
|
||||||
|
#
|
||||||
|
# If the daemon can reload its configuration without
|
||||||
|
# restarting (for example, when it is sent a SIGHUP),
|
||||||
|
# then implement that here.
|
||||||
|
#
|
||||||
|
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
|
do_start
|
||||||
|
case "$?" in
|
||||||
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
case "$?" in
|
||||||
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
|
;;
|
||||||
|
#reload|force-reload)
|
||||||
|
#
|
||||||
|
# If do_reload() is not implemented then leave this commented out
|
||||||
|
# and leave 'force-reload' as an alias for 'restart'.
|
||||||
|
#
|
||||||
|
#log_daemon_msg "Reloading $DESC" "$NAME"
|
||||||
|
#do_reload
|
||||||
|
#log_end_msg $?
|
||||||
|
#;;
|
||||||
|
restart|force-reload)
|
||||||
|
#
|
||||||
|
# If the "reload" option is implemented then remove the
|
||||||
|
# 'force-reload' alias
|
||||||
|
#
|
||||||
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
case "$?" in
|
||||||
|
0|1)
|
||||||
|
do_start
|
||||||
|
case "$?" in
|
||||||
|
0) log_end_msg 0 ;;
|
||||||
|
1) log_end_msg 1 ;; # Old process is still running
|
||||||
|
*) log_end_msg 1 ;; # Failed to start
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Failed to stop
|
||||||
|
log_end_msg 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
||||||
|
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||||
|
exit 3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
:
|
20
debian/snapclient.postinst
vendored
Normal file
20
debian/snapclient.postinst
vendored
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
USERNAME=_snapclient
|
||||||
|
HOMEDIR=/var/lib/snapclient
|
||||||
|
|
||||||
|
if [ "$1" = configure ]; then
|
||||||
|
if ! getent passwd _snapclient >/dev/null; then
|
||||||
|
adduser --system --quiet --group --home /var/lib/snapclient --no-create-home --force-badname $USERNAME
|
||||||
|
adduser $USERNAME audio
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d $HOMEDIR ]; then
|
||||||
|
mkdir -m 0750 $HOMEDIR
|
||||||
|
chown $USERNAME:$USERNAME $HOMEDIR
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#DEBHELPER#
|
18
debian/snapclient.postrm
vendored
Normal file
18
debian/snapclient.postrm
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
#DEBHELPER#
|
||||||
|
|
||||||
|
USERNAME=_snapclient
|
||||||
|
HOMEDIR=/var/lib/snapclient
|
||||||
|
|
||||||
|
if [ "$1" = "purge" ]; then
|
||||||
|
rm -r $HOMEDIR
|
||||||
|
|
||||||
|
if [ -x "$(command -v deluser)" ]; then
|
||||||
|
deluser --quiet --system $USERNAME > /dev/null || true
|
||||||
|
else
|
||||||
|
echo >&2 "not removing $USERNAME system account because deluser command was not found"
|
||||||
|
fi
|
||||||
|
fi
|
17
debian/snapclient.service
vendored
Normal file
17
debian/snapclient.service
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Snapcast client
|
||||||
|
Documentation=man:snapclient(1)
|
||||||
|
Wants=avahi-daemon.service
|
||||||
|
After=network.target time-sync.target sound.target avahi-daemon.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=-/etc/default/snapclient
|
||||||
|
ExecStart=/usr/bin/snapclient $SNAPCLIENT_OPTS
|
||||||
|
User=_snapclient
|
||||||
|
Group=_snapclient
|
||||||
|
# very noisy on stdout
|
||||||
|
StandardOutput=null
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
1
debian/snapserver.default
vendored
Normal file
1
debian/snapserver.default
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
SNAPSERVER_OPTS=""
|
2
debian/snapserver.docs
vendored
Normal file
2
debian/snapserver.docs
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
README.md
|
||||||
|
doc/player_setup.md
|
161
debian/snapserver.init
vendored
Executable file
161
debian/snapserver.init
vendored
Executable file
|
@ -0,0 +1,161 @@
|
||||||
|
#! /bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: snapserver
|
||||||
|
# Required-Start: $remote_fs $syslog $network
|
||||||
|
# Required-Stop: $remote_fs $syslog $network
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Snapserver initscript
|
||||||
|
# Description: Snapserver - Snapcast server
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
# Author: Johannes Pohl <snapcast@badaix.de>
|
||||||
|
|
||||||
|
# Do NOT "set -e"
|
||||||
|
|
||||||
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||||
|
DESC="Snapcast server"
|
||||||
|
NAME=snapserver
|
||||||
|
DAEMON=/usr/bin/$NAME
|
||||||
|
PIDFILE=/var/run/$NAME/pid
|
||||||
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
|
||||||
|
# Exit if the package is not installed
|
||||||
|
[ -x "$DAEMON" ] || exit 0
|
||||||
|
|
||||||
|
# Read configuration variable file if it is present
|
||||||
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
SNAPSERVER_OPTS="--daemon $SNAPSERVER_OPTS"
|
||||||
|
|
||||||
|
if [ "$START_SNAPSERVER" != "true" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load the VERBOSE setting and other rcS variables
|
||||||
|
. /lib/init/vars.sh
|
||||||
|
|
||||||
|
# Define LSB log_* functions.
|
||||||
|
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
|
||||||
|
# and status_of_proc is working.
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that starts the daemon/service
|
||||||
|
#
|
||||||
|
do_start()
|
||||||
|
{
|
||||||
|
PIDDIR=$(dirname "$PIDFILE")
|
||||||
|
if [ ! -d "$PIDDIR" ]; then
|
||||||
|
mkdir -m 0755 $PIDDIR
|
||||||
|
chown _snapserver:_snapserver $PIDDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Return
|
||||||
|
# 0 if daemon has been started
|
||||||
|
# 1 if daemon was already running
|
||||||
|
# 2 if daemon could not be started
|
||||||
|
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "_snapclient:_snapclient" --exec "$DAEMON" --test > /dev/null || return 1
|
||||||
|
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "_snapclient:_snapclient" --exec "$DAEMON" -- $SNAPSERVER_OPTS || return 2
|
||||||
|
# Add code here, if necessary, that waits for the process to be ready
|
||||||
|
# to handle requests from services started subsequently which depend
|
||||||
|
# on this one. As a last resort, sleep for some time.
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that stops the daemon/service
|
||||||
|
#
|
||||||
|
do_stop()
|
||||||
|
{
|
||||||
|
# Return
|
||||||
|
# 0 if daemon has been stopped
|
||||||
|
# 1 if daemon was already stopped
|
||||||
|
# 2 if daemon could not be stopped
|
||||||
|
# other if a failure occurred
|
||||||
|
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
|
||||||
|
RETVAL="$?"
|
||||||
|
[ "$RETVAL" = 2 ] && return 2
|
||||||
|
# Wait for children to finish too if this is a daemon that forks
|
||||||
|
# and if the daemon is only ever run from this initscript.
|
||||||
|
# If the above conditions are not satisfied then add some other code
|
||||||
|
# that waits for the process to drop all resources that could be
|
||||||
|
# needed by services started subsequently. A last resort is to
|
||||||
|
# sleep for some time.
|
||||||
|
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
|
||||||
|
[ "$?" = 2 ] && return 2
|
||||||
|
# Many daemons don't delete their pidfiles when they exit.
|
||||||
|
rm -f $PIDFILE
|
||||||
|
return "$RETVAL"
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Function that sends a SIGHUP to the daemon/service
|
||||||
|
#
|
||||||
|
do_reload() {
|
||||||
|
#
|
||||||
|
# If the daemon can reload its configuration without
|
||||||
|
# restarting (for example, when it is sent a SIGHUP),
|
||||||
|
# then implement that here.
|
||||||
|
#
|
||||||
|
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
|
||||||
|
do_start
|
||||||
|
case "$?" in
|
||||||
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
case "$?" in
|
||||||
|
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||||
|
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
|
;;
|
||||||
|
#reload|force-reload)
|
||||||
|
#
|
||||||
|
# If do_reload() is not implemented then leave this commented out
|
||||||
|
# and leave 'force-reload' as an alias for 'restart'.
|
||||||
|
#
|
||||||
|
#log_daemon_msg "Reloading $DESC" "$NAME"
|
||||||
|
#do_reload
|
||||||
|
#log_end_msg $?
|
||||||
|
#;;
|
||||||
|
restart|force-reload)
|
||||||
|
#
|
||||||
|
# If the "reload" option is implemented then remove the
|
||||||
|
# 'force-reload' alias
|
||||||
|
#
|
||||||
|
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||||
|
do_stop
|
||||||
|
case "$?" in
|
||||||
|
0|1)
|
||||||
|
do_start
|
||||||
|
case "$?" in
|
||||||
|
0) log_end_msg 0 ;;
|
||||||
|
1) log_end_msg 1 ;; # Old process is still running
|
||||||
|
*) log_end_msg 1 ;; # Failed to start
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# Failed to stop
|
||||||
|
log_end_msg 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
|
||||||
|
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||||
|
exit 3
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
:
|
17
debian/snapserver.postinst
vendored
Normal file
17
debian/snapserver.postinst
vendored
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
USERNAME=_snapserver
|
||||||
|
HOMEDIR=/var/lib/snapserver
|
||||||
|
|
||||||
|
if [ "$1" = configure ]; then
|
||||||
|
adduser --system --quiet --group --home /var/lib/snapserver --no-create-home --force-badname $USERNAME
|
||||||
|
|
||||||
|
if [ ! -d $HOMEDIR ]; then
|
||||||
|
mkdir -m 0750 $HOMEDIR
|
||||||
|
chown $USERNAME:$USERNAME $HOMEDIR
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
#DEBHELPER#
|
18
debian/snapserver.postrm
vendored
Normal file
18
debian/snapserver.postrm
vendored
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
#DEBHELPER#
|
||||||
|
|
||||||
|
USERNAME=_snapserver
|
||||||
|
HOMEDIR=/var/lib/snapserver
|
||||||
|
|
||||||
|
if [ "$1" = "purge" ]; then
|
||||||
|
rm -rf $HOMEDIR
|
||||||
|
|
||||||
|
if [ -x "$(command -v deluser)" ]; then
|
||||||
|
deluser --quiet --system $USERNAME > /dev/null || true
|
||||||
|
else
|
||||||
|
echo >&2 "not removing $USERNAME system account because deluser command was not found"
|
||||||
|
fi
|
||||||
|
fi
|
15
debian/snapserver.service
vendored
Normal file
15
debian/snapserver.service
vendored
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Snapcast server
|
||||||
|
Documentation=man:snapserver(1)
|
||||||
|
Wants=avahi-daemon.service
|
||||||
|
After=network.target time-sync.target avahi-daemon.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=-/etc/default/snapserver
|
||||||
|
ExecStart=/usr/bin/snapserver $SNAPSERVER_OPTS
|
||||||
|
User=_snapserver
|
||||||
|
Group=_snapserver
|
||||||
|
Restart=on-failure
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
3.0 (quilt)
|
2
debian/source/local-options
vendored
Normal file
2
debian/source/local-options
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
unapply-patches
|
||||||
|
abort-on-upstream-changes
|
3
debian/watch
vendored
Normal file
3
debian/watch
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
version=4
|
||||||
|
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/snapcast-$1\.tar\.gz/ \
|
||||||
|
https://github.com/badaix/snapcast/tags .*/v?(\d\S+)\.tar\.gz
|
Loading…
Add table
Add a link
Reference in a new issue