summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorArvind Sankar <[email protected]>2020-07-11 19:35:58 -0400
committerBrian Behlendorf <[email protected]>2020-07-14 17:33:44 -0700
commit38e2e9ce8327284b2d516874308300aa96102fe9 (patch)
tree0761f7f696e4da7888a0c99ffb3a91a63ecefdd4 /etc
parentbdb518c13abb9eca8d6f8f1d9e2096dc5163a9e7 (diff)
Centralize variable substitution
A bunch of places need to edit files to incorporate the configured paths i.e. bindir, sbindir etc. Move this logic into a common file. Create arc_summary by copying arc_summary[23] as appropriate at build time instead of install time. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Arvind Sankar <[email protected]> Closes #10559
Diffstat (limited to 'etc')
-rw-r--r--etc/default/Makefile.am13
-rw-r--r--etc/init.d/Makefile.am39
-rwxr-xr-x[-rw-r--r--]etc/init.d/zfs-import.in2
-rwxr-xr-x[-rw-r--r--]etc/init.d/zfs-mount.in2
-rwxr-xr-x[-rw-r--r--]etc/init.d/zfs-share.in6
-rwxr-xr-x[-rw-r--r--]etc/init.d/zfs-zed.in2
-rw-r--r--etc/modules-load.d/Makefile.am12
-rw-r--r--etc/modules-load.d/zfs.conf (renamed from etc/modules-load.d/zfs.conf.in)0
-rw-r--r--etc/systemd/system-generators/Makefile.am14
-rw-r--r--etc/systemd/system/Makefile.am23
-rw-r--r--etc/zfs/Makefile.am15
11 files changed, 24 insertions, 104 deletions
diff --git a/etc/default/Makefile.am b/etc/default/Makefile.am
index afc3a81f6..0ec868e13 100644
--- a/etc/default/Makefile.am
+++ b/etc/default/Makefile.am
@@ -1,12 +1,5 @@
-initconfdir = $(DEFAULT_INITCONF_DIR)
-initconf_SCRIPTS = zfs
-
-EXTRA_DIST = \
- zfs.in
+include $(top_srcdir)/config/Substfiles.am
-$(initconf_SCRIPTS):%:%.in Makefile
- $(SED) \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- $< >'$@'
+initconf_SCRIPTS = zfs
-CLEANFILES = $(initconf_SCRIPTS)
+SUBSTFILES += $(initconf_SCRIPTS)
diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am
index f97459803..9285a995a 100644
--- a/etc/init.d/Makefile.am
+++ b/etc/init.d/Makefile.am
@@ -1,38 +1,7 @@
-initdir = $(DEFAULT_INIT_DIR)
-init_SCRIPTS = zfs-import zfs-mount zfs-share zfs-zed
-
-initconfdir = $(DEFAULT_INITCONF_DIR)
+include $(top_srcdir)/config/Substfiles.am
-EXTRA_DIST = \
- zfs-share.in \
- zfs-import.in \
- zfs-mount.in \
- zfs-zed.in \
- README.md
+EXTRA_DIST += README.md
-$(init_SCRIPTS):%:%.in Makefile
- -(if [ -e /etc/debian_version ]; then \
- NFS_SRV=nfs-kernel-server; \
- else \
- NFS_SRV=nfs; \
- fi; \
- if [ -e /sbin/openrc-run ]; then \
- SHELL=/sbin/openrc-run; \
- else \
- SHELL=/bin/sh; \
- fi; \
- $(SED) \
- -e 's,@bindir\@,$(bindir),g' \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@udevdir\@,$(udevdir),g' \
- -e 's,@udevruledir\@,$(udevruledir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- -e 's,@initconfdir\@,$(initconfdir),g' \
- -e 's,@initdir\@,$(initdir),g' \
- -e 's,@runstatedir\@,$(runstatedir),g' \
- -e "s,@SHELL\@,$$SHELL,g" \
- -e "s,@NFS_SRV\@,$$NFS_SRV,g" \
- $< >'$@'; \
- chmod +x '$@')
+init_SCRIPTS = zfs-import zfs-mount zfs-share zfs-zed
-CLEANFILES = $(init_SCRIPTS)
+SUBSTFILES += $(init_SCRIPTS)
diff --git a/etc/init.d/zfs-import.in b/etc/init.d/zfs-import.in
index 47c957baa..714cc6c08 100644..100755
--- a/etc/init.d/zfs-import.in
+++ b/etc/init.d/zfs-import.in
@@ -1,4 +1,4 @@
-#!@SHELL@
+#!@DEFAULT_INIT_SHELL@
#
# zfs-import This script will import ZFS pools
#
diff --git a/etc/init.d/zfs-mount.in b/etc/init.d/zfs-mount.in
index fa954e093..9b400916f 100644..100755
--- a/etc/init.d/zfs-mount.in
+++ b/etc/init.d/zfs-mount.in
@@ -1,4 +1,4 @@
-#!@SHELL@
+#!@DEFAULT_INIT_SHELL@
#
# zfs-mount This script will mount/umount the zfs filesystems.
#
diff --git a/etc/init.d/zfs-share.in b/etc/init.d/zfs-share.in
index bdbadf6fe..3256d1d06 100644..100755
--- a/etc/init.d/zfs-share.in
+++ b/etc/init.d/zfs-share.in
@@ -1,4 +1,4 @@
-#!@SHELL@
+#!@DEFAULT_INIT_SHELL@
#
# zfs-share This script will network share zfs filesystems and volumes.
#
@@ -13,8 +13,8 @@
# Required-Stop: $local_fs $network $remote_fs zfs-mount
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
-# Should-Start: iscsi iscsitarget istgt scst @NFS_SRV@ samba samba4 zfs-mount zfs-zed
-# Should-Stop: iscsi iscsitarget istgt scst @NFS_SRV@ samba samba4 zfs-mount zfs-zed
+# Should-Start: iscsi iscsitarget istgt scst @DEFAULT_INIT_NFS_SERVER@ samba samba4 zfs-mount zfs-zed
+# Should-Stop: iscsi iscsitarget istgt scst @DEFAULT_INIT_NFS_SERVER@ samba samba4 zfs-mount zfs-zed
# Short-Description: Network share ZFS datasets and volumes.
# Description: Run the `zfs share -a` or `zfs unshare -a` commands
# for controlling iSCSI, NFS, or CIFS network shares.
diff --git a/etc/init.d/zfs-zed.in b/etc/init.d/zfs-zed.in
index fe3c22594..6af9ee60c 100644..100755
--- a/etc/init.d/zfs-zed.in
+++ b/etc/init.d/zfs-zed.in
@@ -1,4 +1,4 @@
-#!@SHELL@
+#!@DEFAULT_INIT_SHELL@
#
# zfs-zed
#
diff --git a/etc/modules-load.d/Makefile.am b/etc/modules-load.d/Makefile.am
index 1c1f8458a..8a2955767 100644
--- a/etc/modules-load.d/Makefile.am
+++ b/etc/modules-load.d/Makefile.am
@@ -1,12 +1,2 @@
-modulesload_DATA = \
+dist_modulesload_DATA = \
zfs.conf
-
-EXTRA_DIST = \
- zfs.conf.in
-
-$(modulesload_DATA):%:%.in
- -$(SED) \
- -e '' \
- $< >'$@'
-
-CLEANFILES = $(modulesload_DATA)
diff --git a/etc/modules-load.d/zfs.conf.in b/etc/modules-load.d/zfs.conf
index 44e1bb3ed..44e1bb3ed 100644
--- a/etc/modules-load.d/zfs.conf.in
+++ b/etc/modules-load.d/zfs.conf
diff --git a/etc/systemd/system-generators/Makefile.am b/etc/systemd/system-generators/Makefile.am
index 1a3efce32..fee88dad8 100644
--- a/etc/systemd/system-generators/Makefile.am
+++ b/etc/systemd/system-generators/Makefile.am
@@ -1,14 +1,6 @@
+include $(top_srcdir)/config/Substfiles.am
+
systemdgenerator_SCRIPTS = \
zfs-mount-generator
-EXTRA_DIST = \
- zfs-mount-generator.in
-
-$(systemdgenerator_SCRIPTS): %: %.in
- -$(SED) -e 's,@bindir\@,$(bindir),g' \
- -e 's,@runstatedir\@,$(runstatedir),g' \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- $< >'$@'
-
-CLEANFILES = $(systemdgenerator_SCRIPTS)
+SUBSTFILES += $(systemdgenerator_SCRIPTS)
diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am
index 6476fb1bd..c374a52ac 100644
--- a/etc/systemd/system/Makefile.am
+++ b/etc/systemd/system/Makefile.am
@@ -1,3 +1,5 @@
+include $(top_srcdir)/config/Substfiles.am
+
systemdpreset_DATA = \
50-zfs.preset
@@ -12,27 +14,8 @@ systemdunit_DATA = \
zfs-volumes.target \
zfs.target
-EXTRA_DIST = \
- zfs-zed.service.in \
- zfs-import-cache.service.in \
- zfs-import-scan.service.in \
- zfs-mount.service.in \
- zfs-share.service.in \
- zfs-import.target.in \
- zfs-volume-wait.service.in \
- zfs-volumes.target.in \
- zfs.target.in \
- 50-zfs.preset.in
-
-$(systemdunit_DATA) $(systemdpreset_DATA):%:%.in
- -$(SED) -e 's,@bindir\@,$(bindir),g' \
- -e 's,@runstatedir\@,$(runstatedir),g' \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- $< >'$@'
+SUBSTFILES += $(systemdpreset_DATA) $(systemdunit_DATA)
install-data-hook:
$(MKDIR_P) "$(DESTDIR)$(systemdunitdir)"
ln -sf /dev/null "$(DESTDIR)$(systemdunitdir)/zfs-import.service"
-
-CLEANFILES = $(systemdunit_DATA) $(systemdpreset_DATA)
diff --git a/etc/zfs/Makefile.am b/etc/zfs/Makefile.am
index 8e44affaa..b9123c176 100644
--- a/etc/zfs/Makefile.am
+++ b/etc/zfs/Makefile.am
@@ -1,5 +1,6 @@
+include $(top_srcdir)/config/Substfiles.am
+
pkgsysconfdir = $(sysconfdir)/zfs
-initconfdir = $(DEFAULT_INITCONF_DIR)
dist_pkgsysconf_DATA = \
vdev_id.conf.alias.example \
@@ -7,16 +8,8 @@ dist_pkgsysconf_DATA = \
vdev_id.conf.sas_switch.example \
vdev_id.conf.multipath.example \
vdev_id.conf.scsi.example
+
pkgsysconf_SCRIPTS = \
zfs-functions
-EXTRA_DIST = zfs-functions.in
-
-$(pkgsysconf_SCRIPTS):%:%.in Makefile
- -$(SED) \
- -e 's,@sbindir\@,$(sbindir),g' \
- -e 's,@sysconfdir\@,$(sysconfdir),g' \
- -e 's,@initconfdir\@,$(initconfdir),g' \
- $< >'$@'
-
-CLEANFILES = $(pkgsysconf_SCRIPTS)
+SUBSTFILES += $(pkgsysconf_SCRIPTS)