Als erstes laden wir uns das Debian Paket mit wget herunter und installieren dies mit dpkg.
root:~# wget https://launchpad.net/~bubbleguuum/+archive/bubbleupnpserver/+files/bubbleupnpserver_0.9-5_all.deb
root:~# dpkg -i bubbleupnpserver_0.9-5_all.deb
Dann löschen wir die Dateien /etc/init/bubbleupnpserver.conf
und /etc/init.d/bubbleupnpserver
. Sie funktionieren nicht korrekt mit dem SystemD.
root:~# rm /etc/init/bubbleupnpserver.conf
root:~# rm /etc/init.d/bubbleupnpserver
Nun erstellen wir ein Startskript.
root:~# vi /usr/share/bubbleupnpserver/startService.sh
Der Inhalt des Startskript sieht wie folgt aus.
#!/bin/bash
if [ -f "$DEFAULTFILE" ]; then
. "$DEFAULTFILE"
else
DAEMONUSER=root
DAEMONGROUP=root
DATADIR=/root/.bubbleupnpserver
HTTP_PORT=58050
HTTPS_PORT=58051
fi
# Create the directory, if not exists and set the right permissions
test -d ${DATADIR} || mkdir -p ${DATADIR}
chown -R ${DAEMONUSER}.${DAEMONGROUP} ${DATADIR}
# Make sure daemon is started with system locale
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG
fi
OPTS="-dataDir ${DATADIR} -httpPort ${HTTP_PORT} -httpsPort ${HTTPS_PORT} -nologstdout"
Die Konfiguration des Startskript wird in der Datei /etc/default/bubbleupnpserver
definiert. Diese Datei wird dann vom Startskript geladen.
root:~# vi /etc/default/bubbleupnpserver
Der Inhalt der Konfiguration sieht wie folgt aus.
# Defaults for bubbleupnpserver initscript
# sourced by /etc/init/bubbleupnpserver.conf
#
# This is a POSIX shell fragment
#
#
# User under which to run BubbleUPnP Server
#
# It is OK to run BubbleUPnP Server with an unpriviledged user
# as long as you do not use http or https ports < 1024
#
# if not running as root, for auto-update to work, you will have
# to make the install dir (/usr/share/bubbleupnpserver) and its files writable
# by the user defined here
DAEMONUSER="tux"
DAEMONGROUP="tux"
DAEMON_OPTS="-lanIp 192.168.1.1"
#
# DATA dir is where all data files aer stored:
# configuration, logs, image cache, OpenHome Playlists
#
if [ "${SYSUSER}" = "root" ]; then
DATADIR="/root/.bubbleupnpserver"
else
DATADIR="/var/lib/bubbleupnpserver"
fi
#
# HTTP and HTTPS port used by BubbleUPnP Server
# NOTE you need to run the server as root user if using ports < 1024
#
HTTP_PORT=58050
HTTPS_PORT=58051
Danach erstellen wir eine SystemD Unit Datei unter /lib/systemd/system/bubbleupnpserver.service
.
root:~# vi /lib/systemd/system/bubbleupnpserver.service
Der Inhalt der SystemD Unit Datei sieht wie folgt aus. Ich habe hier den Benutzer/Gruppe eingetragen, unter dem der Service laufen soll. Leider werden nur unter den Schlüsseln Exec* Variablen ausgewertet.
[Unit]
Description=BubbleUPnP Server
Requires=network-online.target
After=network-online.target
[Service]
Type=simple
Environment=DEFAULTFILE=/etc/default/bubbleupnpserver
ExecStartPre=/usr/share/bubbleupnpserver/startService.sh
ExecStart=/usr/share/bubbleupnpserver/launch.sh ${OPTS}
User=tux
Group=tux
Restart=on-failure
[Install]
WantedBy=multi-user.target
Nun reloaden wir den SystemDaemon und aktivieren den bubbleupnpserver Service.
root:~# systemctl daemon-reload
root:~# systemctl enable bubbleupnpserver.service
Als letztes starten wir den bubbleupnpserver Service.
root:~# systemctl start bubbleupnpserver.service