mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-07 05:11:43 +02:00
dpkg use default file for program options
This commit is contained in:
parent
94fe037f52
commit
3e8842b941
8 changed files with 65 additions and 28 deletions
|
@ -39,12 +39,8 @@ clean:
|
|||
.PHONY: dpkg
|
||||
#sudo apt-get install build-essential debhelper dh-make dh-systemd quilt fakeroot lintian
|
||||
dpkg:
|
||||
cp ../init.scripts/sysv/$(BIN) debian/$(BIN).init
|
||||
cp ../init.scripts/systemd/$(BIN).service debian/$(BIN).service
|
||||
dpkg-buildpackage -rfakeroot -b
|
||||
dh_clean
|
||||
rm -f debian/$(BIN).service
|
||||
rm -f debian/$(BIN).init
|
||||
|
||||
ifdef DESTDIR
|
||||
|
||||
|
@ -71,14 +67,16 @@ endif
|
|||
|
||||
installsystemd:
|
||||
@echo using systemd; \
|
||||
cp ../init.scripts/systemd/$(BIN).service /lib/systemd/system/$(BIN).service; \
|
||||
cp debian/$(BIN).service /lib/systemd/system/$(BIN).service; \
|
||||
cp debian/$(BIN).default /etc/default/$(BIN); \
|
||||
systemctl daemon-reload; \
|
||||
systemctl enable $(BIN); \
|
||||
systemctl start $(BIN); \
|
||||
|
||||
installsysv:
|
||||
@echo using sysv; \
|
||||
cp ../init.scripts/sysv/$(BIN) /etc/init.d/$(BIN); \
|
||||
cp debian/$(BIN).init /etc/init.d/$(BIN); \
|
||||
cp debian/$(BIN).default /etc/default/$(BIN); \
|
||||
update-rc.d $(BIN) defaults; \
|
||||
/etc/init.d/$(BIN) start; \
|
||||
|
||||
|
@ -100,6 +98,7 @@ uninstallsysv:
|
|||
killall -9 $(BIN); \
|
||||
rm -f /usr/sbin/$(BIN); \
|
||||
rm -f /etc/init.d/$(BIN); \
|
||||
rm -f /etc/default/$(BIN); \
|
||||
update-rc.d -f $(BIN) remove; \
|
||||
|
||||
uninstallsystemd:
|
||||
|
@ -108,5 +107,6 @@ uninstallsystemd:
|
|||
killall -9 $(BIN); \
|
||||
rm -f /usr/sbin/$(BIN); \
|
||||
rm -f /lib/systemd/system/$(BIN).service; \
|
||||
rm -f /etc/default/$(BIN); \
|
||||
systemctl daemon-reload; \
|
||||
|
||||
|
|
|
@ -1,2 +1,16 @@
|
|||
# defaults file for snapclient
|
||||
# currently not used
|
||||
|
||||
# start snapclient automatically?
|
||||
START_SNAPCLIENT=true
|
||||
|
||||
# Allowed options:
|
||||
# --help produce help message
|
||||
# -v, --version show version number
|
||||
# -l, --list list pcm devices
|
||||
# -h, --host arg server hostname or ip address
|
||||
# -p, --port arg (=1704) server port
|
||||
# -s, --soundcard arg (=default) index or name of the soundcard
|
||||
# -d, --daemon [=arg(=-3)] daemonize, optional process priority [-20..19]
|
||||
# --latency arg (=0) latency of the soundcard
|
||||
|
||||
SNAPCLIENT_OPTS="-d"
|
||||
|
|
|
@ -18,7 +18,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/
|
|||
DESC="Snapcast client"
|
||||
NAME=snapclient
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
DAEMON_ARGS="-d"
|
||||
SNAPCLIENT_OPTS="-d"
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
|
@ -28,6 +28,10 @@ SCRIPTNAME=/etc/init.d/$NAME
|
|||
# Read configuration variable file if it is present
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
if [ "$START_SNAPCLIENT" != "true" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
. /lib/init/vars.sh
|
||||
|
||||
|
@ -45,11 +49,8 @@ do_start()
|
|||
# 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 --exec $DAEMON --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
$DAEMON_ARGS \
|
||||
|| return 2
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null || return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $SNAPCLIENT_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.
|
|
@ -1,10 +1,11 @@
|
|||
[Unit]
|
||||
Description=Snapcast client
|
||||
After=network.target
|
||||
EnvironmentFile=-/etc/default/snapclient
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/usr/sbin/snapclient -d
|
||||
ExecStart=/usr/sbin/snapclient $SNAPCLIENT_OPTS
|
||||
PIDFile=/var/run/snapclient.pid
|
||||
|
||||
[Install]
|
|
@ -31,12 +31,8 @@ clean:
|
|||
.PHONY: dpkg
|
||||
#sudo apt-get install build-essential debhelper dh-make dh-systemd quilt fakeroot lintian
|
||||
dpkg:
|
||||
cp ../init.scripts/sysv/$(BIN) debian/$(BIN).init
|
||||
cp ../init.scripts/systemd/$(BIN).service debian/$(BIN).service
|
||||
dpkg-buildpackage -rfakeroot -b
|
||||
dh_clean
|
||||
rm -f debian/$(BIN).service
|
||||
rm -f debian/$(BIN).init
|
||||
|
||||
ifdef DESTDIR
|
||||
|
||||
|
@ -63,14 +59,16 @@ endif
|
|||
|
||||
installsystemd:
|
||||
@echo using systemd; \
|
||||
cp ../init.scripts/systemd/$(BIN).service /lib/systemd/system/$(BIN).service; \
|
||||
cp debian/$(BIN).service /lib/systemd/system/$(BIN).service; \
|
||||
cp debian/$(BIN).default /etc/default/$(BIN); \
|
||||
systemctl daemon-reload; \
|
||||
systemctl enable $(BIN); \
|
||||
systemctl start $(BIN); \
|
||||
|
||||
installsysv:
|
||||
@echo using sysv; \
|
||||
cp ../init.scripts/sysv/$(BIN) /etc/init.d/$(BIN); \
|
||||
cp debian/$(BIN).init /etc/init.d/$(BIN); \
|
||||
cp debian/$(BIN).default /etc/default/$(BIN); \
|
||||
update-rc.d $(BIN) defaults; \
|
||||
/etc/init.d/$(BIN) start; \
|
||||
|
||||
|
@ -92,6 +90,7 @@ uninstallsysv:
|
|||
killall -9 $(BIN); \
|
||||
rm -f /usr/sbin/$(BIN); \
|
||||
rm -f /etc/init.d/$(BIN); \
|
||||
rm -f /etc/default/$(BIN); \
|
||||
update-rc.d -f $(BIN) remove; \
|
||||
|
||||
uninstallsystemd:
|
||||
|
@ -100,4 +99,5 @@ uninstallsystemd:
|
|||
killall -9 $(BIN); \
|
||||
rm -f /usr/sbin/$(BIN); \
|
||||
rm -f /lib/systemd/system/$(BIN).service; \
|
||||
rm -f /etc/default/$(BIN); \
|
||||
systemctl daemon-reload; \
|
|
@ -1,2 +1,21 @@
|
|||
# defaults file for snapserver
|
||||
# currently not used
|
||||
|
||||
# start snapserver automatically?
|
||||
START_SNAPSERVER=true
|
||||
|
||||
# Allowed options:
|
||||
# -h, --help produce help message
|
||||
# -v, --version show version number
|
||||
# -p, --port arg (=1704) server port
|
||||
# --controlPort arg (=1705) Remote control port
|
||||
# -s, --sampleformat arg (=48000:16:2)
|
||||
# sample format
|
||||
# -c, --codec arg (=flac) transport codec [flac|ogg|pcm][:options]
|
||||
# Type codec:? to get codec specific options
|
||||
# -f, --fifo arg (=/tmp/snapfifo) name of the input fifo file
|
||||
# -d, --daemon [=arg(=0)] daemonize
|
||||
# optional process priority [-20..19]
|
||||
# -b, --buffer arg (=1000) buffer [ms]
|
||||
# --pipeReadBuffer arg (=20) pipe read buffer [ms]
|
||||
|
||||
SNAPSERVER_OPTS="-d"
|
||||
|
|
|
@ -18,7 +18,7 @@ PATH=/sbin:/usr/sbin:/bin:/usr/bin:/
|
|||
DESC="Snapcast server"
|
||||
NAME=snapserver
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
DAEMON_ARGS="-d"
|
||||
SNAPSERVER_OPTS="-d"
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
|
@ -28,6 +28,10 @@ SCRIPTNAME=/etc/init.d/$NAME
|
|||
# Read configuration variable file if it is present
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
|
||||
if [ "$START_SNAPSERVER" != "true" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Load the VERBOSE setting and other rcS variables
|
||||
. /lib/init/vars.sh
|
||||
|
||||
|
@ -45,11 +49,8 @@ do_start()
|
|||
# 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 --exec $DAEMON --test > /dev/null \
|
||||
|| return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
||||
$DAEMON_ARGS \
|
||||
|| return 2
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null || return 1
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --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.
|
|
@ -1,10 +1,11 @@
|
|||
[Unit]
|
||||
Description=Snapcast server
|
||||
After=network.target
|
||||
EnvironmentFile=-/etc/default/snapserver
|
||||
|
||||
[Service]
|
||||
Type=forking
|
||||
ExecStart=/usr/sbin/snapserver -d
|
||||
ExecStart=/usr/sbin/snapserver $SNAPSERVER_OPTS
|
||||
PIDFile=/var/run/snapserver.pid
|
||||
|
||||
[Install]
|
Loading…
Add table
Add a link
Reference in a new issue