Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Add debian package
Browse files Browse the repository at this point in the history
  • Loading branch information
badaix committed Jul 15, 2022
1 parent d77d1bb commit 0a8e5b8
Show file tree
Hide file tree
Showing 24 changed files with 1,202 additions and 0 deletions.
Empty file added debian/README.source
Empty file.
573 changes: 573 additions & 0 deletions debian/changelog

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10
45 changes: 45 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
Source: snapcast
Section: sound
Priority: optional
Maintainer: Johannes Pohl <snapcast@badaix.de>
Build-Depends: debhelper (>= 10~),
libasound2-dev,
libpulse-dev,
libvorbis-dev,
libflac-dev,
libopus-dev,
libavahi-client-dev,
libasio-dev,
libsoxr-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 multiroom 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 multiroom 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 multiroom 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 multiroom 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 changes: 109 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -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-2021 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-2021 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.
14 changes: 14 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/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 $@ --buildsystem=cmake

override_dh_auto_configure:
dh_auto_configure -- $(CMAKEFLAGS)

#override_dh_auto_build:
# dh_auto_build -- STRIP=: DEBUG= ADD_CFLAGS="$(CXXFLAGS) $(CPPFLAGS)" ADD_LDFLAGS="$(LDFLAGS)"
7 changes: 7 additions & 0 deletions debian/snapclient.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Start the client, used only by the init.d script
START_SNAPCLIENT=true

# Additional command line options that will be passed to snapclient
# note that user/group should be configured in the init.d script or the systemd unit file
# For a list of available options, invoke "snapclient --help"
SNAPCLIENT_OPTS=""
162 changes: 162 additions & 0 deletions debian/snapclient.init
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#! /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
USERNAME=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 --logsink=system --user $USERNAME:$USERNAME $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 $USERNAME:$USERNAME $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 "$USERNAME:$USERNAME" --exec "$DAEMON" --test > /dev/null || return 1
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --chuid "$USERNAME:$USERNAME" --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

:
2 changes: 2 additions & 0 deletions debian/snapclient.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
usr/bin/snapclient usr/bin/
usr/share/pixmaps/snapcast.svg usr/share/pixmaps/
1 change: 1 addition & 0 deletions debian/snapclient.manpages
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
client/snapclient.1
20 changes: 20 additions & 0 deletions debian/snapclient.postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh

set -e

USERNAME=snapclient
HOMEDIR=/var/lib/snapclient

if [ "$1" = configure ]; then
if ! getent passwd $USERNAME >/dev/null; then
adduser --system --quiet --group --home $HOMEDIR --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 changes: 18 additions & 0 deletions debian/snapclient.postrm
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 0a8e5b8

Please sign in to comment.