export DH_VERBOSE=1
%:
- dh $@
+ dh $@ --with-systemd
override_dh_auto_configure:
dh_auto_configure -- ${AUTOBUILD_CONFIGURE_EXTRA} ${JOBSARGS}
dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
override_dh_auto_install:
+ dh_systemd_enable || true
+ dh_systemd_start || true
dh_auto_install --destdir=debian/tvheadend
override_dh_auto_clean:
-
#
# Default configuration for tvheadend
-#
+# systemd
+# See tvheadend --help for more - default "-u hts -g video"
+OPTIONS="-u hts -g video"
+
+# sysvinit
# TVH_ENABLED
# set to 0 to disable upstart job
TVH_ENABLED=1
HTS_USER=hts
+. /usr/share/debconf/confmodule
+db_version 2.0
+
case "$1" in
purge)
if getent passwd $HTS_USER >/dev/null; then
HTS_HOME=`getent passwd $HTS_USER | cut -d':' -f6`
rm -rf "${HTS_HOME}/.hts/tvheadend"
fi
+ if db_get tvheadend/admin_username; then
+ db_reset tvheadend/admin_username;
+ fi
+
+ if db_get tvheadend/admin_password; then
+ db_reset tvheadend/admin_password;
+ fi
;;
esac
--- /dev/null
+[Unit]
+Description=Tvheadend - a TV streaming server and DVR
+After=syslog.target network.target auditd.service
+
+[Service]
+EnvironmentFile=/etc/default/tvheadend
+ExecStart=/usr/bin/tvheadend -f -p /var/run/tvheadend.pid $OPTIONS
+PIDFile=/var/run/tvheadend.pid
+Type=forking
+Restart=on-failure
+RestartSec=54s
+
+[Install]
+WantedBy=multi-user.target