Control: tags -1 + patch

Hello!

The attached debdiff implements the simples possible solution to this
bug report, namely a wrapper unit around the init script.

It would be quite simple to improve on this and create a real native
unit file which does not rely on invoking the init script at all. This
would have the added benefit of real monitoring of the started daemon,
which could be automatically restarted if it crashed, etc.
To accomplish this one would have to split out the
upgrade_zpool_cache_location() function from the init script into a
separate helper program (script).

Regards,
Andreas Henriksson


PS. I've checked and fedora also does a unit wrapping a script helper
although they're not identical to the debian init script:
http://pkgs.fedoraproject.org/cgit/rpms/zfs-fuse.git/tree/


PPS. The init scripts (but does not use) the "/etc/default ENABLE_FOO" anti-
pattern. It should really be dropped in favour of letting the sysadmin
run "update-rc.d zfs-fuse disable" if they want the service disabled.


diff -Nru zfs-fuse-0.7.0/debian/changelog zfs-fuse-0.7.0/debian/changelog
--- zfs-fuse-0.7.0/debian/changelog     2015-06-27 04:28:34.000000000 +0200
+++ zfs-fuse-0.7.0/debian/changelog     2016-05-25 21:22:05.000000000 +0200
@@ -1,3 +1,19 @@
+zfs-fuse (0.7.0-13.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Add debian/zfs-fuse.service (Closes: #796705)
+    - this is a simple wrapper around the init script with room for
+      improvement. Mostly copied from the by systemd-sysv-generator
+      autogenerated unit with minor modifications. Future work would be
+      to split out the program parts of the init script
+      (upgrade_zpool_cache_location(), et.al.), run that from
+      ExecStartPre= and turn the rest into a real native unit file
+      supporting monitoring/restarting of the daemon, etc.
+   * Add dh-systemd build-dependency and --with systemd to debian/rules.
+     - to activate helpers that takes care of the above unit file.
+
+ -- Andreas Henriksson <andr...@fatal.se>  Wed, 25 May 2016 21:08:21 +0200
+
 zfs-fuse (0.7.0-13) unstable; urgency=medium
 
   * Fix ""zfs list -t snapshot" missing entries" (Closes: #780308)
diff -Nru zfs-fuse-0.7.0/debian/control zfs-fuse-0.7.0/debian/control
--- zfs-fuse-0.7.0/debian/control       2014-06-28 02:34:47.000000000 +0200
+++ zfs-fuse-0.7.0/debian/control       2016-05-25 21:08:19.000000000 +0200
@@ -2,7 +2,7 @@
 Section: otherosfs
 Priority: optional
 Maintainer: Asias He <as...@debian.org>
-Build-Depends: debhelper (>= 7.0.50~), scons, libfuse-dev (>= 2.8.7-2), 
zlib1g-dev, libaio-dev, libssl-dev, libattr1-dev, autotools-dev
+Build-Depends: debhelper (>= 7.0.50~), dh-systemd (>= 1.5), scons, libfuse-dev 
(>= 2.8.7-2), zlib1g-dev, libaio-dev, libssl-dev, libattr1-dev, autotools-dev
 Standards-Version: 3.9.2
 Homepage: http://zfs-fuse.net
 Vcs-Git: git://git.debian.org/collab-maint/zfs-fuse.git
diff -Nru zfs-fuse-0.7.0/debian/rules zfs-fuse-0.7.0/debian/rules
--- zfs-fuse-0.7.0/debian/rules 2014-06-28 02:41:32.000000000 +0200
+++ zfs-fuse-0.7.0/debian/rules 2016-05-25 21:08:01.000000000 +0200
@@ -35,4 +35,4 @@
        dh_installinit --no-start -- start 38 S . stop 39 0 6 .
 
 %:
-       dh $@
+       dh $@ --with systemd
diff -Nru zfs-fuse-0.7.0/debian/zfs-fuse.service 
zfs-fuse-0.7.0/debian/zfs-fuse.service
--- zfs-fuse-0.7.0/debian/zfs-fuse.service      1970-01-01 01:00:00.000000000 
+0100
+++ zfs-fuse-0.7.0/debian/zfs-fuse.service      2016-05-25 21:07:44.000000000 
+0200
@@ -0,0 +1,22 @@
+[Unit]
+Documentation=man:zfs-fuse(8)
+Description=Daemon for ZFS support via FUSE
+DefaultDependencies=no
+Before=sysinit.target
+Before=shutdown.target
+After=remote-fs.target
+Conflicts=shutdown.target
+
+[Service]
+Type=forking
+Restart=no
+TimeoutSec=0
+IgnoreSIGPIPE=no
+KillMode=process
+GuessMainPID=no
+RemainAfterExit=yes
+ExecStart=/etc/init.d/zfs-fuse start
+ExecStop=/etc/init.d/zfs-fuse stop
+
+[Install]
+WantedBy=sysinit.target

Reply via email to