mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-05 12:21: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
|
.PHONY: dpkg
|
||||||
#sudo apt-get install build-essential debhelper dh-make dh-systemd quilt fakeroot lintian
|
#sudo apt-get install build-essential debhelper dh-make dh-systemd quilt fakeroot lintian
|
||||||
dpkg:
|
dpkg:
|
||||||
cp ../init.scripts/sysv/$(BIN) debian/$(BIN).init
|
|
||||||
cp ../init.scripts/systemd/$(BIN).service debian/$(BIN).service
|
|
||||||
dpkg-buildpackage -rfakeroot -b
|
dpkg-buildpackage -rfakeroot -b
|
||||||
dh_clean
|
dh_clean
|
||||||
rm -f debian/$(BIN).service
|
|
||||||
rm -f debian/$(BIN).init
|
|
||||||
|
|
||||||
ifdef DESTDIR
|
ifdef DESTDIR
|
||||||
|
|
||||||
|
@ -71,14 +67,16 @@ endif
|
||||||
|
|
||||||
installsystemd:
|
installsystemd:
|
||||||
@echo using systemd; \
|
@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 daemon-reload; \
|
||||||
systemctl enable $(BIN); \
|
systemctl enable $(BIN); \
|
||||||
systemctl start $(BIN); \
|
systemctl start $(BIN); \
|
||||||
|
|
||||||
installsysv:
|
installsysv:
|
||||||
@echo using sysv; \
|
@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; \
|
update-rc.d $(BIN) defaults; \
|
||||||
/etc/init.d/$(BIN) start; \
|
/etc/init.d/$(BIN) start; \
|
||||||
|
|
||||||
|
@ -100,6 +98,7 @@ uninstallsysv:
|
||||||
killall -9 $(BIN); \
|
killall -9 $(BIN); \
|
||||||
rm -f /usr/sbin/$(BIN); \
|
rm -f /usr/sbin/$(BIN); \
|
||||||
rm -f /etc/init.d/$(BIN); \
|
rm -f /etc/init.d/$(BIN); \
|
||||||
|
rm -f /etc/default/$(BIN); \
|
||||||
update-rc.d -f $(BIN) remove; \
|
update-rc.d -f $(BIN) remove; \
|
||||||
|
|
||||||
uninstallsystemd:
|
uninstallsystemd:
|
||||||
|
@ -108,5 +107,6 @@ uninstallsystemd:
|
||||||
killall -9 $(BIN); \
|
killall -9 $(BIN); \
|
||||||
rm -f /usr/sbin/$(BIN); \
|
rm -f /usr/sbin/$(BIN); \
|
||||||
rm -f /lib/systemd/system/$(BIN).service; \
|
rm -f /lib/systemd/system/$(BIN).service; \
|
||||||
|
rm -f /etc/default/$(BIN); \
|
||||||
systemctl daemon-reload; \
|
systemctl daemon-reload; \
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,16 @@
|
||||||
# defaults file for snapclient
|
# 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"
|
DESC="Snapcast client"
|
||||||
NAME=snapclient
|
NAME=snapclient
|
||||||
DAEMON=/usr/sbin/$NAME
|
DAEMON=/usr/sbin/$NAME
|
||||||
DAEMON_ARGS="-d"
|
SNAPCLIENT_OPTS="-d"
|
||||||
PIDFILE=/var/run/$NAME.pid
|
PIDFILE=/var/run/$NAME.pid
|
||||||
SCRIPTNAME=/etc/init.d/$NAME
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
|
||||||
|
@ -28,6 +28,10 @@ SCRIPTNAME=/etc/init.d/$NAME
|
||||||
# Read configuration variable file if it is present
|
# Read configuration variable file if it is present
|
||||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
|
if [ "$START_SNAPCLIENT" != "true" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Load the VERBOSE setting and other rcS variables
|
# Load the VERBOSE setting and other rcS variables
|
||||||
. /lib/init/vars.sh
|
. /lib/init/vars.sh
|
||||||
|
|
||||||
|
@ -45,11 +49,8 @@ do_start()
|
||||||
# 0 if daemon has been started
|
# 0 if daemon has been started
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null || return 1
|
||||||
|| return 1
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $SNAPCLIENT_OPTS || return 2
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
|
||||||
$DAEMON_ARGS \
|
|
||||||
|| return 2
|
|
||||||
# Add code here, if necessary, that waits for the process to be ready
|
# Add code here, if necessary, that waits for the process to be ready
|
||||||
# to handle requests from services started subsequently which depend
|
# to handle requests from services started subsequently which depend
|
||||||
# on this one. As a last resort, sleep for some time.
|
# on this one. As a last resort, sleep for some time.
|
|
@ -1,10 +1,11 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Snapcast client
|
Description=Snapcast client
|
||||||
After=network.target
|
After=network.target
|
||||||
|
EnvironmentFile=-/etc/default/snapclient
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
ExecStart=/usr/sbin/snapclient -d
|
ExecStart=/usr/sbin/snapclient $SNAPCLIENT_OPTS
|
||||||
PIDFile=/var/run/snapclient.pid
|
PIDFile=/var/run/snapclient.pid
|
||||||
|
|
||||||
[Install]
|
[Install]
|
|
@ -31,12 +31,8 @@ clean:
|
||||||
.PHONY: dpkg
|
.PHONY: dpkg
|
||||||
#sudo apt-get install build-essential debhelper dh-make dh-systemd quilt fakeroot lintian
|
#sudo apt-get install build-essential debhelper dh-make dh-systemd quilt fakeroot lintian
|
||||||
dpkg:
|
dpkg:
|
||||||
cp ../init.scripts/sysv/$(BIN) debian/$(BIN).init
|
|
||||||
cp ../init.scripts/systemd/$(BIN).service debian/$(BIN).service
|
|
||||||
dpkg-buildpackage -rfakeroot -b
|
dpkg-buildpackage -rfakeroot -b
|
||||||
dh_clean
|
dh_clean
|
||||||
rm -f debian/$(BIN).service
|
|
||||||
rm -f debian/$(BIN).init
|
|
||||||
|
|
||||||
ifdef DESTDIR
|
ifdef DESTDIR
|
||||||
|
|
||||||
|
@ -63,14 +59,16 @@ endif
|
||||||
|
|
||||||
installsystemd:
|
installsystemd:
|
||||||
@echo using systemd; \
|
@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 daemon-reload; \
|
||||||
systemctl enable $(BIN); \
|
systemctl enable $(BIN); \
|
||||||
systemctl start $(BIN); \
|
systemctl start $(BIN); \
|
||||||
|
|
||||||
installsysv:
|
installsysv:
|
||||||
@echo using sysv; \
|
@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; \
|
update-rc.d $(BIN) defaults; \
|
||||||
/etc/init.d/$(BIN) start; \
|
/etc/init.d/$(BIN) start; \
|
||||||
|
|
||||||
|
@ -92,6 +90,7 @@ uninstallsysv:
|
||||||
killall -9 $(BIN); \
|
killall -9 $(BIN); \
|
||||||
rm -f /usr/sbin/$(BIN); \
|
rm -f /usr/sbin/$(BIN); \
|
||||||
rm -f /etc/init.d/$(BIN); \
|
rm -f /etc/init.d/$(BIN); \
|
||||||
|
rm -f /etc/default/$(BIN); \
|
||||||
update-rc.d -f $(BIN) remove; \
|
update-rc.d -f $(BIN) remove; \
|
||||||
|
|
||||||
uninstallsystemd:
|
uninstallsystemd:
|
||||||
|
@ -100,4 +99,5 @@ uninstallsystemd:
|
||||||
killall -9 $(BIN); \
|
killall -9 $(BIN); \
|
||||||
rm -f /usr/sbin/$(BIN); \
|
rm -f /usr/sbin/$(BIN); \
|
||||||
rm -f /lib/systemd/system/$(BIN).service; \
|
rm -f /lib/systemd/system/$(BIN).service; \
|
||||||
|
rm -f /etc/default/$(BIN); \
|
||||||
systemctl daemon-reload; \
|
systemctl daemon-reload; \
|
|
@ -1,2 +1,21 @@
|
||||||
# defaults file for snapserver
|
# 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"
|
DESC="Snapcast server"
|
||||||
NAME=snapserver
|
NAME=snapserver
|
||||||
DAEMON=/usr/sbin/$NAME
|
DAEMON=/usr/sbin/$NAME
|
||||||
DAEMON_ARGS="-d"
|
SNAPSERVER_OPTS="-d"
|
||||||
PIDFILE=/var/run/$NAME.pid
|
PIDFILE=/var/run/$NAME.pid
|
||||||
SCRIPTNAME=/etc/init.d/$NAME
|
SCRIPTNAME=/etc/init.d/$NAME
|
||||||
|
|
||||||
|
@ -28,6 +28,10 @@ SCRIPTNAME=/etc/init.d/$NAME
|
||||||
# Read configuration variable file if it is present
|
# Read configuration variable file if it is present
|
||||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||||
|
|
||||||
|
if [ "$START_SNAPSERVER" != "true" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
# Load the VERBOSE setting and other rcS variables
|
# Load the VERBOSE setting and other rcS variables
|
||||||
. /lib/init/vars.sh
|
. /lib/init/vars.sh
|
||||||
|
|
||||||
|
@ -45,11 +49,8 @@ do_start()
|
||||||
# 0 if daemon has been started
|
# 0 if daemon has been started
|
||||||
# 1 if daemon was already running
|
# 1 if daemon was already running
|
||||||
# 2 if daemon could not be started
|
# 2 if daemon could not be started
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null || return 1
|
||||||
|| return 1
|
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $SNAPSERVER_OPTS || return 2
|
||||||
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
|
|
||||||
$DAEMON_ARGS \
|
|
||||||
|| return 2
|
|
||||||
# Add code here, if necessary, that waits for the process to be ready
|
# Add code here, if necessary, that waits for the process to be ready
|
||||||
# to handle requests from services started subsequently which depend
|
# to handle requests from services started subsequently which depend
|
||||||
# on this one. As a last resort, sleep for some time.
|
# on this one. As a last resort, sleep for some time.
|
|
@ -1,10 +1,11 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Snapcast server
|
Description=Snapcast server
|
||||||
After=network.target
|
After=network.target
|
||||||
|
EnvironmentFile=-/etc/default/snapserver
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=forking
|
Type=forking
|
||||||
ExecStart=/usr/sbin/snapserver -d
|
ExecStart=/usr/sbin/snapserver $SNAPSERVER_OPTS
|
||||||
PIDFile=/var/run/snapserver.pid
|
PIDFile=/var/run/snapserver.pid
|
||||||
|
|
||||||
[Install]
|
[Install]
|
Loading…
Add table
Add a link
Reference in a new issue