diff --git a/Makefile.am b/Makefile.am index 4e46257947..0c0114661c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,7 +54,7 @@ CLEANFILES = $(GITREV) PHONY = gitrev gitrev: - ZFS_GITREV=$$(cd $(top_srcdir) && \ + $(AM_V_GEN)ZFS_GITREV=$$(cd $(top_srcdir) && \ git describe --always --long --dirty 2>/dev/null); \ ZFS_GITREV=$${ZFS_GITREV:-unknown}; \ printf '#define\tZFS_META_GITREV "%s"\n' \ diff --git a/cmd/arc_summary/.gitignore b/cmd/arc_summary/.gitignore new file mode 100644 index 0000000000..50ba15f034 --- /dev/null +++ b/cmd/arc_summary/.gitignore @@ -0,0 +1 @@ +arc_summary diff --git a/cmd/arc_summary/Makefile.am b/cmd/arc_summary/Makefile.am index ee758006e3..1a26c2c199 100644 --- a/cmd/arc_summary/Makefile.am +++ b/cmd/arc_summary/Makefile.am @@ -1,4 +1,7 @@ -transform = $(program_transform_name) +bin_SCRIPTS = arc_summary + +CLEANFILES = arc_summary +EXTRA_DIST = arc_summary2 arc_summary3 if USING_PYTHON_2 SCRIPT = arc_summary2 @@ -6,9 +9,5 @@ else SCRIPT = arc_summary3 endif -dist_bin_SCRIPTS = $(SCRIPT) - -install-exec-hook: - before=$$(echo $(SCRIPT) | sed '$(transform)'); \ - after=$$(echo arc_summary | sed '$(transform)'); \ - mv "$(DESTDIR)$(bindir)/$$before" "$(DESTDIR)$(bindir)/$$after" +arc_summary: $(SCRIPT) + cp $< $@ diff --git a/cmd/arcstat/.gitignore b/cmd/arcstat/.gitignore new file mode 100644 index 0000000000..6d6cd1ab75 --- /dev/null +++ b/cmd/arcstat/.gitignore @@ -0,0 +1 @@ +arcstat diff --git a/cmd/arcstat/Makefile.am b/cmd/arcstat/Makefile.am index a0728f9cec..d1ba989a0c 100644 --- a/cmd/arcstat/Makefile.am +++ b/cmd/arcstat/Makefile.am @@ -1,13 +1,5 @@ -dist_bin_SCRIPTS = arcstat +include $(top_srcdir)/config/Substfiles.am -# -# The arcstat script is compatible with both Python 2.6 and 3.4. -# As such the python 3 shebang can be replaced at install time when -# targeting a python 2 system. This allows us to maintain a single -# version of the source. -# -if USING_PYTHON_2 -install-exec-hook: - $(SED) ${ac_inplace} -e 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \ - $(DESTDIR)$(bindir)/arcstat -endif +bin_SCRIPTS = arcstat + +SUBSTFILES += $(bin_SCRIPTS) diff --git a/cmd/arcstat/arcstat b/cmd/arcstat/arcstat.in similarity index 99% rename from cmd/arcstat/arcstat rename to cmd/arcstat/arcstat.in index 5ce7e755cb..b230e4b852 100755 --- a/cmd/arcstat/arcstat +++ b/cmd/arcstat/arcstat.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env @PYTHON_SHEBANG@ # # Print out ZFS ARC Statistics exported via kstat(1) # For a definition of fields, or usage, use arcstat -v diff --git a/cmd/dbufstat/.gitignore b/cmd/dbufstat/.gitignore new file mode 100644 index 0000000000..2c2e913cef --- /dev/null +++ b/cmd/dbufstat/.gitignore @@ -0,0 +1 @@ +dbufstat diff --git a/cmd/dbufstat/Makefile.am b/cmd/dbufstat/Makefile.am index f3b7ed809f..e672a01a42 100644 --- a/cmd/dbufstat/Makefile.am +++ b/cmd/dbufstat/Makefile.am @@ -1,13 +1,5 @@ -dist_bin_SCRIPTS = dbufstat +include $(top_srcdir)/config/Substfiles.am -# -# The dbufstat script is compatible with both Python 2.6 and 3.4. -# As such the python 3 shebang can be replaced at install time when -# targeting a python 2 system. This allows us to maintain a single -# version of the source. -# -if USING_PYTHON_2 -install-exec-hook: - $(SED) ${ac_inplace} -e 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \ - $(DESTDIR)$(bindir)/dbufstat -endif +bin_SCRIPTS = dbufstat + +SUBSTFILES += $(bin_SCRIPTS) diff --git a/cmd/dbufstat/dbufstat b/cmd/dbufstat/dbufstat.in similarity index 99% rename from cmd/dbufstat/dbufstat rename to cmd/dbufstat/dbufstat.in index 4a57d81130..95749bd80e 100755 --- a/cmd/dbufstat/dbufstat +++ b/cmd/dbufstat/dbufstat.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env @PYTHON_SHEBANG@ # # Print out statistics for all cached dmu buffers. This information # is available through the dbufs kstat and may be post-processed as diff --git a/cmd/zed/zed.d/Makefile.am b/cmd/zed/zed.d/Makefile.am index 5cf51e4fdf..8b2d0c2002 100644 --- a/cmd/zed/zed.d/Makefile.am +++ b/cmd/zed/zed.d/Makefile.am @@ -1,8 +1,7 @@ include $(top_srcdir)/config/Rules.am +include $(top_srcdir)/config/Substfiles.am -EXTRA_DIST = \ - README \ - history_event-zfs-list-cacher.sh.in +EXTRA_DIST += README zedconfdir = $(sysconfdir)/zfs/zed.d @@ -29,12 +28,7 @@ dist_zedexec_SCRIPTS = \ nodist_zedexec_SCRIPTS = history_event-zfs-list-cacher.sh -$(nodist_zedexec_SCRIPTS): %: %.in - -$(SED) -e 's,@bindir\@,$(bindir),g' \ - -e 's,@runstatedir\@,$(runstatedir),g' \ - -e 's,@sbindir\@,$(sbindir),g' \ - -e 's,@sysconfdir\@,$(sysconfdir),g' \ - $< >'$@' +SUBSTFILES += $(nodist_zedexec_SCRIPTS) zedconfdefaults = \ all-syslog.sh \ diff --git a/config/Substfiles.am b/config/Substfiles.am new file mode 100644 index 0000000000..63697bfa2b --- /dev/null +++ b/config/Substfiles.am @@ -0,0 +1,34 @@ +subst_sed_cmd = \ + -e 's|@bindir[@]|$(bindir)|g' \ + -e 's|@sbindir[@]|$(sbindir)|g' \ + -e 's|@datadir[@]|$(datadir)|g' \ + -e 's|@sysconfdir[@]|$(sysconfdir)|g' \ + -e 's|@runstatedir[@]|$(runstatedir)|g' \ + -e 's|@initconfdir[@]|$(initconfdir)|g' \ + -e 's|@initdir[@]|$(initdir)|g' \ + -e 's|@mounthelperdir[@]|$(mounthelperdir)|g' \ + -e 's|@systemdgeneratordir[@]|$(systemdgeneratordir)|g' \ + -e 's|@systemdunitdir[@]|$(systemdunitdir)|g' \ + -e 's|@udevdir[@]|$(udevdir)|g' \ + -e 's|@udevruledir[@]|$(udevruledir)|g' \ + -e 's|@zfsexecdir[@]|$(zfsexecdir)|g' \ + -e 's|@PYTHON[@]|$(PYTHON)|g' \ + -e 's|@PYTHON_SHEBANG[@]|$(PYTHON_SHEBANG)|g' \ + -e 's|@DEFAULT_INIT_NFS_SERVER[@]|$(DEFAULT_INIT_NFS_SERVER)|g' \ + -e 's|@DEFAULT_INIT_SHELL[@]|$(DEFAULT_INIT_SHELL)|g' + +SUBSTFILES = +CLEANFILES = $(SUBSTFILES) +EXTRA_DIST = $(SUBSTFILES:=.in) + +$(SUBSTFILES):%:%.in Makefile + $(AM_V_GEN)set -e; \ + $(MKDIR_P) $$(dirname $@); \ + $(RM) $@~; \ + $(SED) $(subst_sed_cmd) $< >$@~; \ + if grep -E '@[a-zA-Z0-9_]+@' $@~ >&2; then \ + echo "Undefined substitution" >&2; \ + exit 1; \ + else test $$? -eq 1; fi; \ + test -x $< && chmod +x $@~; \ + mv -f $@~ $@ diff --git a/config/always-python.m4 b/config/always-python.m4 index c1c07597e6..c01e631a8f 100644 --- a/config/always-python.m4 +++ b/config/always-python.m4 @@ -49,6 +49,10 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_PYTHON], [ AM_CONDITIONAL([USING_PYTHON_2], [test "x${PYTHON_VERSION%%\.*}" = x2]) AM_CONDITIONAL([USING_PYTHON_3], [test "x${PYTHON_VERSION%%\.*}" = x3]) + AM_COND_IF([USING_PYTHON_2], + [AC_SUBST([PYTHON_SHEBANG], [python2])], + [AC_SUBST([PYTHON_SHEBANG], [python3])]) + dnl # dnl # Request that packages be built for a specific Python version. dnl # diff --git a/config/zfs-build.m4 b/config/zfs-build.m4 index dea3f61372..54b61de090 100644 --- a/config/zfs-build.m4 +++ b/config/zfs-build.m4 @@ -266,7 +266,7 @@ AC_DEFUN([ZFS_AC_RPM], [ RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUG_KMEM_TRACKING_ZFS) 1"' RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(ASAN_ZFS) 1"' - RPM_DEFINE_UTIL=' --define "_initconfdir $(DEFAULT_INITCONF_DIR)"' + RPM_DEFINE_UTIL=' --define "_initconfdir $(initconfdir)"' dnl # Make the next three RPM_DEFINE_UTIL additions conditional, since dnl # their values may not be set when running: @@ -469,13 +469,13 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ AC_MSG_CHECKING([default init directory]) case "$VENDOR" in - freebsd) DEFAULT_INIT_DIR=$sysconfdir/rc.d ;; - *) DEFAULT_INIT_DIR=$sysconfdir/init.d;; + freebsd) initdir=$sysconfdir/rc.d ;; + *) initdir=$sysconfdir/init.d;; esac - AC_MSG_RESULT([$DEFAULT_INIT_DIR]) - AC_SUBST(DEFAULT_INIT_DIR) + AC_MSG_RESULT([$initdir]) + AC_SUBST(initdir) - AC_MSG_CHECKING([default init script type]) + AC_MSG_CHECKING([default init script type and shell]) case "$VENDOR" in toss) DEFAULT_INIT_SCRIPT=redhat ;; redhat) DEFAULT_INIT_SCRIPT=redhat ;; @@ -491,24 +491,44 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ freebsd) DEFAULT_INIT_SCRIPT=freebsd;; *) DEFAULT_INIT_SCRIPT=lsb ;; esac - AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT]) + + # On gentoo, it's possible that OpenRC isn't installed. Check if + # /sbin/openrc-run exists, and if not, fall back to generic defaults. + + DEFAULT_INIT_SHELL="/bin/sh" + AS_IF([test "$DEFAULT_INIT_SCRIPT" = "openrc"], [ + AS_IF([test -x "/sbin/openrc-run"], + [DEFAULT_INIT_SHELL="/sbin/openrc-run"], + [DEFAULT_INIT_SCRIPT=lsb]) + ]) + + AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT:$DEFAULT_INIT_SHELL]) AC_SUBST(DEFAULT_INIT_SCRIPT) + AC_SUBST(DEFAULT_INIT_SHELL) + + AC_MSG_CHECKING([default nfs server init script]) + AS_IF([test "$VENDOR" = "debian"], + [DEFAULT_INIT_NFS_SERVER="nfs-kernel-server"], + [DEFAULT_INIT_NFS_SERVER="nfs"] + ) + AC_MSG_RESULT([$DEFAULT_INIT_NFS_SERVER]) + AC_SUBST(DEFAULT_INIT_NFS_SERVER) AC_MSG_CHECKING([default init config directory]) case "$VENDOR" in - alpine) DEFAULT_INITCONF_DIR=/etc/conf.d ;; - gentoo) DEFAULT_INITCONF_DIR=/etc/conf.d ;; - toss) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; - redhat) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; - fedora) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; - sles) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; - ubuntu) DEFAULT_INITCONF_DIR=/etc/default ;; - debian) DEFAULT_INITCONF_DIR=/etc/default ;; - freebsd) DEFAULT_INITCONF_DIR=$sysconfdir/rc.conf.d;; - *) DEFAULT_INITCONF_DIR=/etc/default ;; + alpine) initconfdir=/etc/conf.d ;; + gentoo) initconfdir=/etc/conf.d ;; + toss) initconfdir=/etc/sysconfig ;; + redhat) initconfdir=/etc/sysconfig ;; + fedora) initconfdir=/etc/sysconfig ;; + sles) initconfdir=/etc/sysconfig ;; + ubuntu) initconfdir=/etc/default ;; + debian) initconfdir=/etc/default ;; + freebsd) initconfdir=$sysconfdir/rc.conf.d;; + *) initconfdir=/etc/default ;; esac - AC_MSG_RESULT([$DEFAULT_INITCONF_DIR]) - AC_SUBST(DEFAULT_INITCONF_DIR) + AC_MSG_RESULT([$initconfdir]) + AC_SUBST(initconfdir) AC_MSG_CHECKING([whether initramfs-tools is available]) if test -d /usr/share/initramfs-tools ; then diff --git a/contrib/dracut/02zfsexpandknowledge/Makefile.am b/contrib/dracut/02zfsexpandknowledge/Makefile.am index 11f2a84af7..d31d389a0e 100644 --- a/contrib/dracut/02zfsexpandknowledge/Makefile.am +++ b/contrib/dracut/02zfsexpandknowledge/Makefile.am @@ -1,18 +1,7 @@ +include $(top_srcdir)/config/Substfiles.am + pkgdracutdir = $(dracutdir)/modules.d/02zfsexpandknowledge pkgdracut_SCRIPTS = \ module-setup.sh -EXTRA_DIST = \ - module-setup.sh.in - -$(pkgdracut_SCRIPTS):%:%.in - -$(SED) -e 's,@bindir\@,$(bindir),g' \ - -e 's,@sbindir\@,$(sbindir),g' \ - -e 's,@datadir\@,$(datadir),g' \ - -e 's,@dracutdir\@,$(dracutdir),g' \ - -e 's,@udevdir\@,$(udevdir),g' \ - -e 's,@udevruledir\@,$(udevruledir),g' \ - -e 's,@sysconfdir\@,$(sysconfdir),g' \ - $< >'$@' - -CLEANFILES = $(pkgdracut_SCRIPTS) +SUBSTFILES += $(pkgdracut_SCRIPTS) diff --git a/contrib/dracut/90zfs/Makefile.am b/contrib/dracut/90zfs/Makefile.am index 645808e440..a4843827ed 100644 --- a/contrib/dracut/90zfs/Makefile.am +++ b/contrib/dracut/90zfs/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/config/Substfiles.am + pkgdracutdir = $(dracutdir)/modules.d/90zfs pkgdracut_SCRIPTS = \ export-zfs.sh \ @@ -14,27 +16,4 @@ pkgdracut_DATA = \ zfs-snapshot-bootfs.service \ zfs-rollback-bootfs.service -EXTRA_DIST = \ - export-zfs.sh.in \ - module-setup.sh.in \ - mount-zfs.sh.in \ - parse-zfs.sh.in \ - zfs-generator.sh.in \ - zfs-load-key.sh.in \ - zfs-needshutdown.sh.in \ - zfs-lib.sh.in \ - zfs-env-bootfs.service.in \ - zfs-snapshot-bootfs.service.in \ - zfs-rollback-bootfs.service.in - -$(pkgdracut_SCRIPTS) $(pkgdracut_DATA) :%:%.in - -$(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,@systemdunitdir\@,$(systemdunitdir),g' \ - -e 's,@mounthelperdir\@,$(mounthelperdir),g' \ - $< >'$@' - -CLEANFILES = $(pkgdracut_SCRIPTS) $(pkgdracut_DATA) +SUBSTFILES += $(pkgdracut_SCRIPTS) $(pkgdracut_DATA) diff --git a/contrib/initramfs/hooks/Makefile.am b/contrib/initramfs/hooks/Makefile.am index 8da1c4835f..f303e995b9 100644 --- a/contrib/initramfs/hooks/Makefile.am +++ b/contrib/initramfs/hooks/Makefile.am @@ -1,20 +1,9 @@ +include $(top_srcdir)/config/Substfiles.am + hooksdir = /usr/share/initramfs-tools/hooks hooks_SCRIPTS = \ zfs \ zfsunlock -EXTRA_DIST = \ - zfs.in \ - zfsunlock.in - -$(hooks_SCRIPTS):%:%.in Makefile - -$(SED) -e 's,@sbindir\@,$(sbindir),g' \ - -e 's,@sysconfdir\@,$(sysconfdir),g' \ - -e 's,@udevdir\@,$(udevdir),g' \ - -e 's,@udevruledir\@,$(udevruledir),g' \ - -e 's,@mounthelperdir\@,$(mounthelperdir),g' \ - -e 's,@DEFAULT_INITCONF_DIR\@,$(DEFAULT_INITCONF_DIR),g' \ - $< >'$@' - -CLEANFILES = $(hooks_SCRIPTS) +SUBSTFILES += $(hooks_SCRIPTS) diff --git a/contrib/initramfs/hooks/zfs.in b/contrib/initramfs/hooks/zfs.in index ff7e49f125..67d27a7649 100755 --- a/contrib/initramfs/hooks/zfs.in +++ b/contrib/initramfs/hooks/zfs.in @@ -12,7 +12,7 @@ COPY_EXEC_LIST="@sbindir@/zdb @sbindir@/zpool @sbindir@/zfs" COPY_EXEC_LIST="$COPY_EXEC_LIST @mounthelperdir@/mount.zfs @udevdir@/vdev_id" COPY_EXEC_LIST="$COPY_EXEC_LIST @udevdir@/zvol_id" COPY_FILE_LIST="/etc/hostid @sysconfdir@/zfs/zpool.cache" -COPY_FILE_LIST="$COPY_FILE_LIST @DEFAULT_INITCONF_DIR@/zfs" +COPY_FILE_LIST="$COPY_FILE_LIST @initconfdir@/zfs" COPY_FILE_LIST="$COPY_FILE_LIST @sysconfdir@/zfs/zfs-functions" COPY_FILE_LIST="$COPY_FILE_LIST @sysconfdir@/zfs/vdev_id.conf" COPY_FILE_LIST="$COPY_FILE_LIST @udevruledir@/60-zvol.rules" diff --git a/etc/default/Makefile.am b/etc/default/Makefile.am index afc3a81f6d..0ec868e134 100644 --- a/etc/default/Makefile.am +++ b/etc/default/Makefile.am @@ -1,12 +1,5 @@ -initconfdir = $(DEFAULT_INITCONF_DIR) +include $(top_srcdir)/config/Substfiles.am + initconf_SCRIPTS = zfs -EXTRA_DIST = \ - zfs.in - -$(initconf_SCRIPTS):%:%.in Makefile - $(SED) \ - -e 's,@sysconfdir\@,$(sysconfdir),g' \ - $< >'$@' - -CLEANFILES = $(initconf_SCRIPTS) +SUBSTFILES += $(initconf_SCRIPTS) diff --git a/etc/init.d/Makefile.am b/etc/init.d/Makefile.am index f974598038..9285a995a1 100644 --- a/etc/init.d/Makefile.am +++ b/etc/init.d/Makefile.am @@ -1,38 +1,7 @@ -initdir = $(DEFAULT_INIT_DIR) +include $(top_srcdir)/config/Substfiles.am + +EXTRA_DIST += README.md + init_SCRIPTS = zfs-import zfs-mount zfs-share zfs-zed -initconfdir = $(DEFAULT_INITCONF_DIR) - -EXTRA_DIST = \ - zfs-share.in \ - zfs-import.in \ - zfs-mount.in \ - zfs-zed.in \ - 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 '$@') - -CLEANFILES = $(init_SCRIPTS) +SUBSTFILES += $(init_SCRIPTS) diff --git a/etc/init.d/zfs-import.in b/etc/init.d/zfs-import.in old mode 100644 new mode 100755 index 47c957baac..714cc6c089 --- 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 old mode 100644 new mode 100755 index fa954e0939..9b400916f4 --- 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 old mode 100644 new mode 100755 index bdbadf6fef..3256d1d067 --- 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 old mode 100644 new mode 100755 index fe3c22594c..6af9ee60c8 --- 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 1c1f8458a8..8a2955767b 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 similarity index 100% rename from etc/modules-load.d/zfs.conf.in rename to etc/modules-load.d/zfs.conf diff --git a/etc/systemd/system-generators/Makefile.am b/etc/systemd/system-generators/Makefile.am index 1a3efce323..fee88dad8c 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 6476fb1bd0..c374a52ac7 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 8e44affaa1..b9123c176b 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) diff --git a/man/man8/Makefile.am b/man/man8/Makefile.am index 0298961b32..366b4eb510 100644 --- a/man/man8/Makefile.am +++ b/man/man8/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/config/Substfiles.am + dist_man_MANS = \ fsck.zfs.8 \ mount.zfs.8 \ @@ -86,16 +88,4 @@ nodist_man_MANS = \ zed.8 \ zfs-mount-generator.8 -EXTRA_DIST = \ - zed.8.in \ - zfs-mount-generator.8.in - -$(nodist_man_MANS): %: %.in - -$(SED) -e 's,@zfsexecdir\@,$(zfsexecdir),g' \ - -e 's,@systemdgeneratordir\@,$(systemdgeneratordir),g' \ - -e 's,@runstatedir\@,$(runstatedir),g' \ - -e 's,@sysconfdir\@,$(sysconfdir),g' \ - $< >'$@' - -CLEANFILES = \ - $(nodist_man_MANS) +SUBSTFILES += $(nodist_man_MANS) diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh index 1f142455a9..2413467843 100755 --- a/scripts/zfs-tests.sh +++ b/scripts/zfs-tests.sh @@ -301,10 +301,6 @@ constrain_path() { elif [ "$UNAME" = "FreeBSD" ] ; then ln -fs /usr/local/bin/ksh93 "$STF_PATH/ksh" fi - - if [ -L "$STF_PATH/arc_summary3" ]; then - ln -fs "$STF_PATH/arc_summary3" "$STF_PATH/arc_summary" - fi } # diff --git a/tests/test-runner/bin/.gitignore b/tests/test-runner/bin/.gitignore new file mode 100644 index 0000000000..ff7e2f8fcc --- /dev/null +++ b/tests/test-runner/bin/.gitignore @@ -0,0 +1,2 @@ +test-runner.py +zts-report.py diff --git a/tests/test-runner/bin/Makefile.am b/tests/test-runner/bin/Makefile.am index 09032ba689..e11e55fffd 100644 --- a/tests/test-runner/bin/Makefile.am +++ b/tests/test-runner/bin/Makefile.am @@ -1,15 +1,8 @@ +include $(top_srcdir)/config/Substfiles.am + pkgdatadir = $(datadir)/@PACKAGE@/test-runner/bin -dist_pkgdata_SCRIPTS = \ +pkgdata_SCRIPTS = \ test-runner.py \ zts-report.py -# -# These scripts are compatible with both Python 2.6 and 3.4. As such the -# python 3 shebang can be replaced at install time when targeting a python -# 2 system. This allows us to maintain a single version of the source. -# -if USING_PYTHON_2 -install-data-hook: - $(SED) ${ac_inplace} -e 's|^#!/usr/bin/env python3|#!/usr/bin/env python2|' \ - $(DESTDIR)$(pkgdatadir)/test-runner.py \ - $(DESTDIR)$(pkgdatadir)/zts-report.py -endif + +SUBSTFILES += $(pkgdata_SCRIPTS) diff --git a/tests/test-runner/bin/test-runner.py b/tests/test-runner/bin/test-runner.py.in similarity index 99% rename from tests/test-runner/bin/test-runner.py rename to tests/test-runner/bin/test-runner.py.in index 7740739dd6..bbabf247c1 100755 --- a/tests/test-runner/bin/test-runner.py +++ b/tests/test-runner/bin/test-runner.py.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env @PYTHON_SHEBANG@ # # This file and its contents are supplied under the terms of the diff --git a/tests/test-runner/bin/zts-report.py b/tests/test-runner/bin/zts-report.py.in similarity index 99% rename from tests/test-runner/bin/zts-report.py rename to tests/test-runner/bin/zts-report.py.in index 78ce291b7b..c68325a156 100755 --- a/tests/test-runner/bin/zts-report.py +++ b/tests/test-runner/bin/zts-report.py.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/usr/bin/env @PYTHON_SHEBANG@ # # This file and its contents are supplied under the terms of the @@ -205,7 +205,6 @@ maybe = { 'cli_root/zpool_import/zpool_import_missing_003_pos': ['SKIP', '6839'], 'cli_root/zpool_trim/setup': ['SKIP', trim_reason], 'cli_root/zpool_upgrade/zpool_upgrade_004_pos': ['FAIL', '6141'], - 'cli_user/misc/arc_summary3_001_pos': ['SKIP', python_reason], 'delegate/setup': ['SKIP', exec_reason], 'history/history_004_pos': ['FAIL', '7026'], 'history/history_005_neg': ['FAIL', '6680'], diff --git a/tests/zfs-tests/include/Makefile.am b/tests/zfs-tests/include/Makefile.am index 5e9a4f3863..16cdf2c814 100644 --- a/tests/zfs-tests/include/Makefile.am +++ b/tests/zfs-tests/include/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/config/Substfiles.am + pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/include dist_pkgdata_DATA = \ blkdev.shlib \ @@ -8,13 +10,5 @@ dist_pkgdata_DATA = \ tunables.cfg \ zpool_script.shlib -EXTRA_DIST = default.cfg.in - nodist_pkgdata_DATA = default.cfg - -$(nodist_pkgdata_DATA): %: %.in - -$(SED) -e 's,@zfsexecdir\@,$(zfsexecdir),g' \ - -e 's,@sysconfdir\@,$(sysconfdir),g' \ - $< >'$@' - -CLEANFILES = default.cfg +SUBSTFILES += $(nodist_pkgdata_DATA) diff --git a/tests/zfs-tests/include/commands.cfg b/tests/zfs-tests/include/commands.cfg index b27b8d5c6f..21fe0df9ec 100644 --- a/tests/zfs-tests/include/commands.cfg +++ b/tests/zfs-tests/include/commands.cfg @@ -178,7 +178,6 @@ export ZFS_FILES='zdb ztest raidz_test arc_summary - arc_summary3 arcstat dbufstat zed diff --git a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am b/tests/zfs-tests/tests/functional/pyzfs/Makefile.am index f7aa56b950..26c5ac595a 100644 --- a/tests/zfs-tests/tests/functional/pyzfs/Makefile.am +++ b/tests/zfs-tests/tests/functional/pyzfs/Makefile.am @@ -1,17 +1,7 @@ +include $(top_srcdir)/config/Substfiles.am + pkgpyzfsdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/pyzfs pkgpyzfs_SCRIPTS = \ pyzfs_unittest.ksh -EXTRA_DIST = \ - pyzfs_unittest.ksh.in - -# -# The pyzfs module is built either for Python 2 or Python 3. In order -# to properly test it the unit tests must be updated to the matching version. -# -$(pkgpyzfs_SCRIPTS):%:%.in - -$(SED) -e 's,@PYTHON\@,$(PYTHON),g' \ - $< >'$@' - -chmod 775 $@ - -CLEANFILES = $(pkgpyzfs_SCRIPTS) +SUBSTFILES += $(pkgpyzfs_SCRIPTS) diff --git a/udev/rules.d/Makefile.am b/udev/rules.d/Makefile.am index 82f13e078c..72f47d6f2a 100644 --- a/udev/rules.d/Makefile.am +++ b/udev/rules.d/Makefile.am @@ -1,19 +1,8 @@ +include $(top_srcdir)/config/Substfiles.am + udevrule_DATA = \ 69-vdev.rules \ 60-zvol.rules \ 90-zfs.rules -EXTRA_DIST = \ - 69-vdev.rules.in \ - 60-zvol.rules.in \ - 90-zfs.rules.in - -$(udevrule_DATA):%:%.in - -$(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' \ - $< > '$@' - -CLEANFILES = $(udevrule_DATA) +SUBSTFILES += $(udevrule_DATA)