Package: syslog-ng Version: 3.3.9-1 Severity: normal Tags: patch User: pkg-systemd-maintain...@lists.alioth.debian.org Usertags: systemd-units
Hi, the current version of syslog-ng ships systemd service files. Those systemd services need to be enabled explicitly, using "systemctl enable". As packages can't rely on systemd being installed, what syslog-ng currently does is ship a *copy* of those files in multi-user.target.wants (as a conffile). That is not how it's supposed to work (we partially fixed that for the wheezy version by turning those conffiles into symlinks, but this was an imcomplete fix, too). We now have a small helper in init-system-helper which implements the "systemctl enable" parts in a minimal package and a corresponding dh-systemd helper, which generates the corresponding maintainer scripts code. The attached patch uses that helper (via the dh addon) and cleans up the exising conffiles in preinst. The new mechanism will ensure that changes will be preserved. I.e., if an administrator disables the systemd service via "systemctl disable syslog-ng.service", it won't be re-enabled on the next upgrade. We've put up some preliminary documentation up on [1]. Please have a look there if you want to know more. We are also very much interested in feedback, so we can improve the documentation. The attached patch also adds /var/lib/syslog-ng to syslog-ng-core.dirs. While testing the patch, I only had syslog-ng-core installed, and starting the service failed as that directory was missing. I noticed, that the SysV init script creates that directory dynamically. I didn't see a good reason, not to ship that directory in the package itself, so I decided to do just that. If you prefer to create the directory dynamically, the preferred mechanism is, to ship a tmpfile. Please let me know in this case and I will update the patch accordingly. Cheers, Michael [1] https://wiki.debian.org/Systemd/Packaging -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable'), (200, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.9-1-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
diff --git a/debian/control b/debian/control index 4999284..f079d21 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: syslog-ng Section: admin Priority: extra Maintainer: Laszlo Boszormenyi (GCS) <g...@debian.org> -Build-Depends: debhelper (>= 9), dh-autoreconf, libivykis-dev (>= 0.30.1), libnet1-dev, libevtlog-dev (>= 0.2.12-5~), libssl-dev, libmongo-client-dev, libjson0-dev, libwrap0-dev, libglib2.0-dev (>= 2.4), pkg-config, libdbi0-dev | libdbi-dev, libpcre3-dev, flex, bison, help2man, automake, autoconf, autoconf-archive, xsltproc, docbook-xsl, docbook-xml, libcap-dev [linux-any], libsystemd-daemon-dev [linux-any], hardening-includes +Build-Depends: debhelper (>= 9), dh-autoreconf, dh-systemd (>= 1.3), libivykis-dev (>= 0.30.1), libnet1-dev, libevtlog-dev (>= 0.2.12-5~), libssl-dev, libmongo-client-dev, libjson0-dev, libwrap0-dev, libglib2.0-dev (>= 2.4), pkg-config, libdbi0-dev | libdbi-dev, libpcre3-dev, flex, bison, help2man, automake, autoconf, autoconf-archive, xsltproc, docbook-xsl, docbook-xml, libcap-dev [linux-any], libsystemd-daemon-dev [linux-any], hardening-includes Build-Conflicts: autoconf2.13 Standards-Version: 3.9.3 Homepage: http://www.balabit.com/network-security/syslog-ng/opensource-logging-system diff --git a/debian/rules b/debian/rules index 8ac32c3..a8dab16 100755 --- a/debian/rules +++ b/debian/rules @@ -242,4 +242,4 @@ install install-arch install-indep: debian/control # And for the rest, there is debhelper! %: - dh $@ --with autoreconf + dh $@ --with autoreconf,systemd diff --git a/debian/syslog-ng-core.dirs b/debian/syslog-ng-core.dirs index 73a42f6..7551c6c 100644 --- a/debian/syslog-ng-core.dirs +++ b/debian/syslog-ng-core.dirs @@ -1,3 +1,3 @@ /etc/syslog-ng/conf.d/ -/etc/systemd/system/multi-user.target.wants/ /lib/systemd/system/ +/var/lib/syslog-ng/ diff --git a/debian/syslog-ng-core.install b/debian/syslog-ng-core.install index 654026e..856c6c7 100644 --- a/debian/syslog-ng-core.install +++ b/debian/syslog-ng-core.install @@ -17,5 +17,3 @@ usr/lib/syslog-ng/*/libsyslogformat.so usr/share/syslog-ng/include/scl/* usr/share/syslog-ng/xsd/* debian/syslog-ng.conf /etc/syslog-ng/ -debian/systemd/syslog-ng.service /etc/systemd/system/ -debian/systemd/syslog-ng.service /etc/systemd/system/multi-user.target.wants/ diff --git a/debian/syslog-ng-core.preinst b/debian/syslog-ng-core.preinst index 9296632..a88acb8 100644 --- a/debian/syslog-ng-core.preinst +++ b/debian/syslog-ng-core.preinst @@ -12,6 +12,12 @@ if [ "$1" = "install" ]; then fi fi +# Clean up the mess from previous releases +if [ "$1" = upgrade ] && dpkg --compare-versions "$2" lt 3.3.9-2 ; then + rm -f /etc/systemd/system/syslog-ng.service + rm -f /etc/systemd/system/multi-user.target.wants/syslog-ng.service +fi + #DEBHELPER# exit 0 diff --git a/debian/syslog-ng-core.prerm b/debian/syslog-ng-core.prerm index ce45c38..f71beb4 100644 --- a/debian/syslog-ng-core.prerm +++ b/debian/syslog-ng-core.prerm @@ -2,6 +2,11 @@ set -e +# Stop the socket on remove so syslog-ng is not restarted via socket activation +if [ -d /run/systemd/system ] && [ "$1" = remove ]; then + systemctl stop syslog.socket || true +fi + if [ -x "/etc/init.d/syslog-ng" ] && [ "$1" = remove ]; then invoke-rc.d syslog-ng stop || exit $? fi