Subject: bug#14: Patch for ZFS 0.7.6-1

From: Chris Dos <[email-masked]>
Date: Sun, 4 Mar 2018 11:19:45 -0700

I've attached a patch that patches against Debian's 0.7.6-1 package.
diff --git a/debian/rules b/debian/rules
index f445b58..ecb9448 100755
--- a/debian/rules
+++ b/debian/rules
@@ -112,6 +112,31 @@ override_dh_auto_install:
 	chmod a-x $(CURDIR)/debian/tmp/etc/zfs/zfs-functions
 	chmod a-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 $(DEB_VERSION_UPSTREAM)
 
diff --git a/debian/zfs-zed.install b/debian/zfs-zed.install
index b7c1fa9..998471b 100644
--- a/debian/zfs-zed.install
+++ b/debian/zfs-zed.install
@@ -1,4 +1,5 @@
 etc/zfs/zed.d/*
+etc/init.d/zfs-zed
 lib/systemd/system/zfs-zed.service
 usr/lib/*/zfs/zed.d/*
 usr/sbin/zed
diff --git a/debian/zfsutils-linux.install b/debian/zfsutils-linux.install
index b985ade..2cc4cb4 100644
--- a/debian/zfsutils-linux.install
+++ b/debian/zfsutils-linux.install
@@ -1,6 +1,8 @@
 ../tree/zfsutils-linux/* /
 etc/default/zfs
 etc/zfs/zfs-functions
+etc/init.d/zfs-import
+etc/init.d/zfs-mount
 etc/zfs/zpool.d/
 lib/systemd/system-preset/
 lib/systemd/system/zfs-import-cache.service
diff --git a/etc/init.d/zfs-zed.in b/etc/init.d/zfs-zed.in
index d0086ee..a5bb2e3 100755
--- a/etc/init.d/zfs-zed.in
+++ b/etc/init.d/zfs-zed.in
@@ -10,6 +10,8 @@
 # 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
diff --git a/etc/init.d/zfs-functions.in b/etc/init.d/zfs-functions.in
index 97f2ea0..589cb6d 100644
--- a/etc/init.d/zfs-functions.in
+++ b/etc/init.d/zfs-functions.in
@@ -89,7 +89,7 @@ fi
 
 # Paths to what we need
 ZFS="@sbindir@/zfs"
-ZED="@sbindir@/zed"
+ZED="/usr/sbin/zed"
 ZPOOL="@sbindir@/zpool"
 ZPOOL_CACHE="@sysconfdir@/zfs/zpool.cache"