Dear Maintainers,

I am interested in getting the startup scripts /etc/init.d/zfs- into the packages(s).

Attached is a first patch attempt. (I am completely new to debian packaging...)

It has been (lightly) tested on two machines: after update from the ZoL packages to jessie-backports they no longer imported/mounted the ZFS filesystems after reboot. They do with packages compiled with the patch.

Since the scripts are already in the source package, the only addition is a fix for zfs-zed.in (lintian warned without $local_fs), the install rules are lifted from zfs-pkg [1].

There are two known issues:

one lintian warning for each script, e.g.:
W: zfsutils-linux: init.d-script-does-not-source-init-functions 
etc/init.d/zfs-import
as far as I can see, zfs-functions does include /lib/lsb/init-functions,
but lintian does not know this.  How to fix this?  lintian override?

the zfs-share startup script depends on zfs-zed, but as zfs-zed has been split to a separate package, but depending on zfsutils-linux this is not installed yet when zfsutils-linux tries to start zfs-share and thus fails. How to handle that? (usr/lib/systemd/system/zfs-share.service is in zfsutils-linux so putting /etc/init.d/zfs-share in zfs-zed does not seem right...)

Cheers,
Håkan

[1] https://github.com/zfsonlinux/pkg-zfs/blob/master/debian/jessie/debian/rules
diff --git a/debian/rules b/debian/rules
index 15e0592..347a48f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -112,6 +112,31 @@ override_dh_auto_install:
 	chmod -x $(CURDIR)/debian/tmp/etc/zfs/zfs-functions
 	chmod -x $(CURDIR)/debian/tmp/etc/default/zfs
 
+override_dh_installinit:
+	@# Install the /etc/init.d/zfs-import script.
+	dh_installinit -pzfsutils-linux --onlyscripts --name=zfs-import \
+	  --no-restart-on-upgrade --no-start
+
+	@# Install the /etc/init.d/zfs-mount script.
+	dh_installinit -pzfsutils-linux --onlyscripts --name=zfs-mount \
+	  --no-restart-on-upgrade --no-start
+
+	@# Install the /etc/init.d/zfs-share script.
+	# Disabled, as it does not start on install due to zfs-zed not
+	# being installed yet, and zfs-zed depends on zfsutils-linux.
+	# Error report:
+	# insserv: Service zfs-zed has to be enabled to start service zfs-share
+	# insserv: exiting now!
+	#dh_installinit -pzfsutils-linux --onlyscripts --name=zfs-share \
+	#  --no-restart-on-upgrade --no-start
+
+	@# Add a dummy (link to /dev/null) for zfs-import.service
+	ln -s /dev/null $(CURDIR)/debian/zfsutils-linux/lib/systemd/system/zfs-import.service
+
+	@# Install the ZED init file.
+	dh_installinit -pzfs-zed --onlyscripts --name=zfs-zed \
+	  --no-restart-on-upgrade --no-start
+
 override_dh_dkms:
 	dh_dkms -V $(VERSION)
 
diff --git a/debian/zfs-zed.install b/debian/zfs-zed.install
index a84fff7..f5a4a4e 100644
--- a/debian/zfs-zed.install
+++ b/debian/zfs-zed.install
@@ -1,4 +1,5 @@
 usr/sbin/zed
+etc/init.d/zfs-zed
 etc/zfs/zed.d/*
 usr/lib/*/zfs/zed.d/*
 usr/lib/systemd/system/zfs-zed.service lib/systemd/system/
diff --git a/debian/zfsutils-linux.install b/debian/zfsutils-linux.install
index 4407aa5..f1eedae 100644
--- a/debian/zfsutils-linux.install
+++ b/debian/zfsutils-linux.install
@@ -9,6 +9,8 @@ usr/lib/modules-load.d/ lib/
 lib/udev/
 etc/default/zfs
 etc/zfs/zfs-functions
+etc/init.d/zfs-import
+etc/init.d/zfs-mount
 sbin/fsck.zfs
 sbin/mount.zfs
 sbin/ztest
diff --git a/etc/init.d/zfs-zed.in b/etc/init.d/zfs-zed.in
index 86e3185..8dce0fe 100755
--- a/etc/init.d/zfs-zed.in
+++ b/etc/init.d/zfs-zed.in
@@ -8,8 +8,8 @@
 #
 ### BEGIN INIT INFO
 # Provides:          zfs-zed
-# Required-Start:    zfs-mount
-# Required-Stop:     zfs-mount
+# Required-Start:    $local_fs zfs-mount
+# Required-Stop:     $local_fs zfs-mount
 # Default-Start:     2 3 4 5
 # Default-Stop:      0 1 6
 # X-Stop-After:      zfs-share

Reply via email to