From 00478e1b5141f8b6ceaf14c173382d1aa11878b9 Mon Sep 17 00:00:00 2001
From: Tony Hutter <hutter2@llnl.gov>
Date: Thu, 6 Feb 2020 09:28:20 -0800
Subject: [PATCH] Fix zfs-functions packaging bug

This fixes a bug where the generated zfs-functions was being included along
with original zfs-functions.in in the make dist tarball.  This caused an
unfortunate series of events during build/packaging that resulted in the
RPM-installed /etc/zfs/zfs-functions listing the paths as:

ZFS="/usr/local/sbin/zfs"
ZED="/usr/local/sbin/zed"
ZPOOL="/usr/local/sbin/zpool"

When they should have been:

ZFS="/sbin/zfs"
ZED="/sbin/zed"
ZPOOL="/sbin/zpool"

This affects init.d (non-systemd) distros like CentOS 6.

Fixes: #9443

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
---
 contrib/initramfs/Makefile.am | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/contrib/initramfs/Makefile.am b/contrib/initramfs/Makefile.am
index 52bdeb2afe5..4e52e8ea5e9 100644
--- a/contrib/initramfs/Makefile.am
+++ b/contrib/initramfs/Makefile.am
@@ -6,15 +6,12 @@ initrd_SCRIPTS = \
 SUBDIRS = hooks scripts
 
 EXTRA_DIST = \
-	$(top_srcdir)/etc/init.d/zfs \
-	$(top_srcdir)/etc/init.d/zfs-functions \
+	$(top_srcdir)/etc/init.d/zfs.in \
+	$(top_srcdir)/etc/init.d/zfs-functions.in \
 	$(top_srcdir)/contrib/initramfs/conf.d/zfs \
 	$(top_srcdir)/contrib/initramfs/conf-hooks.d/zfs \
 	$(top_srcdir)/contrib/initramfs/README.initramfs.markdown
 
-$(top_srcdir)/etc/init.d/zfs $(top_srcdir)/etc/init.d/zfs-functions:
-	$(MAKE) -C $(top_srcdir)/etc/init.d zfs zfs-functions
-
 install-initrdSCRIPTS: $(EXTRA_DIST)
 	for d in conf.d conf-hooks.d scripts/local-top; do \
 		$(MKDIR_P) $(DESTDIR)$(initrddir)/$$d; \
