Package: znc Version: 1.6.2-2+b1 Followup-For: Bug #734442 Here is a patch that tries to add this functionality. It adds a package, znc-daemon that creates a system user and runs znc under systemd. Let me know if you don't like this approach and how I should approach this.
-- System Information: Debian Release: stretch/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 4.0.0-2-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages znc depends on: ii libc6 2.21-6 ii libgcc1 1:5.3.1-4 ii libicu55 55.1-6 ii libsasl2-2 2.1.26.dfsg1-14+b1 ii libssl1.0.2 1.0.2e-1 ii libstdc++6 5.3.1-4 ii zlib1g 1:1.2.8.dfsg-2+b1 Versions of packages znc recommends: ii znc-perl 1.6.2-2+b1 ii znc-python 1.6.2-2+b1 ii znc-tcl 1.6.2-2+b1 znc suggests no packages. -- no debconf information
diff -ruN znc-1.6.2.old/debian/control znc-1.6.2/debian/control --- znc-1.6.2.old/debian/control 2015-12-28 16:31:23.228373031 -0500 +++ znc-1.6.2/debian/control 2015-12-29 03:25:02.657680988 -0500 @@ -2,6 +2,7 @@ Section: net Priority: optional Build-Depends: debhelper (>= 9), + dh-systemd, libssl-dev, libperl-dev, libicu-dev, @@ -143,3 +144,21 @@ interface with many plugins supporting other features. . This package contains the znc Tcl extension. + +Package: znc-daemon +Architecture: all +Depends: znc (= ${binary:Version}) +Description: advanced modular IRC bouncer, system daemon + znc is an IRC proxy. It runs as a daemon and connects to IRC server, + then allows you to connect from a workstation and work as the user that + is logged in to the IRC server. After you disconnect, it maintains the + connection to the server. It acts like any normal IRC server, so you can + use any IRC client to connect to it. + . + Some of its features include support for multiple users, multiple clients, + and multiple IRC servers; playback buffers to catch up with what happened + while you were detached, SSL encryption, DCC proxying, and a plugin + interface with many plugins supporting other features. + . + This package contains the files necessary to run znc as a system daemon. + diff -ruN znc-1.6.2.old/debian/rules znc-1.6.2/debian/rules --- znc-1.6.2.old/debian/rules 2015-12-28 16:31:23.228373031 -0500 +++ znc-1.6.2/debian/rules 2015-12-29 03:08:06.163862824 -0500 @@ -21,7 +21,7 @@ --enable-python %: - dh $@ --with python3 + dh $@ --with python3,systemd override_dh_auto_configure: dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_FLAGS) @@ -56,3 +56,9 @@ override_dh_strip: dh_strip --dbg-package=znc-dbg + +override_dh_systemd_enable: + dh_systemd_enable --name=znc + +override_dh_systemd_start: + dh_systemd_start --restart-after-upgrade diff -ruN znc-1.6.2.old/debian/znc-daemon.README.Debian znc-1.6.2/debian/znc-daemon.README.Debian --- znc-1.6.2.old/debian/znc-daemon.README.Debian 1969-12-31 19:00:00.000000000 -0500 +++ znc-1.6.2/debian/znc-daemon.README.Debian 2015-12-29 03:21:50.511604864 -0500 @@ -0,0 +1,4 @@ +Before the system wide znc will run it needs to be configured. To create an +initial configuration run: + +sudo -u _znc /usr/bin/znc --datadir=/var/lib/znc --makeconf diff -ruN znc-1.6.2.old/debian/znc-daemon.postinst znc-1.6.2/debian/znc-daemon.postinst --- znc-1.6.2.old/debian/znc-daemon.postinst 1969-12-31 19:00:00.000000000 -0500 +++ znc-1.6.2/debian/znc-daemon.postinst 2015-12-28 17:16:48.901019316 -0500 @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +case "$1" in + configure) + if ! getent passwd _znc >/dev/null; then + adduser --quiet --system --force-badname \ + --home /var/lib/znc _znc + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 diff -ruN znc-1.6.2.old/debian/znc-daemon.znc.service znc-1.6.2/debian/znc-daemon.znc.service --- znc-1.6.2.old/debian/znc-daemon.znc.service 1969-12-31 19:00:00.000000000 -0500 +++ znc-1.6.2/debian/znc-daemon.znc.service 2015-12-29 02:55:04.223796902 -0500 @@ -0,0 +1,11 @@ +[Unit] +Description=ZNC, an advanced IRC bouncer +After=network.target +ConditionFileNotEmpty=/var/lib/znc/configs/znc.conf + +[Service] +ExecStart=/usr/bin/znc --datadir=/var/lib/znc -f +User=_znc + +[Install] +WantedBy=multi-user.target