From 39042f97365c0e677e5e77ded90372526422afdf Mon Sep 17 00:00:00 2001 From: Antonio Russo Date: Thu, 7 Jun 2018 12:59:59 -0400 Subject: [PATCH] Tunable directory for zfs runtime scripts zpool and zed place scripts in subdirectories of libexecdir. Some distributions locate architecture independent scripts in other locations (e.g. Debian). To avoid these paths getting out of sync, centralize the definitions. Build zfs-test's default.cfg by Makefile. Use the new directory logic building tests/zfs-tests/include/default.cfg.in. Reviewed-by: Brian Behlendorf Signed-off-by: Antonio Russo Closes #7597 --- cmd/zed/Makefile.am | 7 ++++--- cmd/zpool/Makefile.am | 2 +- config/user-libexec.m4 | 9 +++++++++ config/user.m4 | 1 + configure.ac | 1 - man/man8/Makefile.am | 2 +- man/man8/zed.8.in | 2 +- man/man8/zfs-mount-generator.8.in | 2 +- tests/zfs-tests/include/Makefile.am | 10 ++++++++-- tests/zfs-tests/include/default.cfg.in | 4 +--- 10 files changed, 27 insertions(+), 13 deletions(-) create mode 100644 config/user-libexec.m4 diff --git a/cmd/zed/Makefile.am b/cmd/zed/Makefile.am index e9e38d8e56..9c11315f2a 100644 --- a/cmd/zed/Makefile.am +++ b/cmd/zed/Makefile.am @@ -54,14 +54,13 @@ dist_zedconf_DATA = \ zed.d/zed-functions.sh \ zed.d/zed.rc -zedexecdir = $(libexecdir)/zfs/zed.d +zedexecdir = $(zfsexecdir)/zed.d dist_zedexec_SCRIPTS = \ zed.d/all-debug.sh \ zed.d/all-syslog.sh \ zed.d/data-notify.sh \ zed.d/generic-notify.sh \ - zed.d/history_event-zfs-list-cacher.sh \ zed.d/resilver_finish-notify.sh \ zed.d/scrub_finish-notify.sh \ zed.d/statechange-led.sh \ @@ -71,7 +70,9 @@ dist_zedexec_SCRIPTS = \ zed.d/pool_import-led.sh \ zed.d/resilver_finish-start-scrub.sh -zed.d/history_event-zfs-list-cacher.sh: %: %.in +nodist_zedexec_SCRIPTS = zed.d/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' \ diff --git a/cmd/zpool/Makefile.am b/cmd/zpool/Makefile.am index 8e98fddd67..c03da941db 100644 --- a/cmd/zpool/Makefile.am +++ b/cmd/zpool/Makefile.am @@ -21,7 +21,7 @@ zpool_LDADD = \ zpool_LDADD += -lm $(LIBBLKID) zpoolconfdir = $(sysconfdir)/zfs/zpool.d -zpoolexecdir = $(libexecdir)/zfs/zpool.d +zpoolexecdir = $(zfsexecdir)/zpool.d EXTRA_DIST = zpool.d/README diff --git a/config/user-libexec.m4 b/config/user-libexec.m4 new file mode 100644 index 0000000000..31bcea3fcf --- /dev/null +++ b/config/user-libexec.m4 @@ -0,0 +1,9 @@ +AC_DEFUN([ZFS_AC_CONFIG_USER_ZFSEXEC], [ + AC_ARG_WITH(zfsexecdir, + AC_HELP_STRING([--with-zfsexecdir=DIR], + [install scripts [[@<:@libexecdir@:>@/zfs]]]), + [zfsexecdir=$withval], + [zfsexecdir="${libexecdir}/zfs"]) + + AC_SUBST([zfsexecdir]) +]) diff --git a/config/user.m4 b/config/user.m4 index f2f366e3c9..8c4655719b 100644 --- a/config/user.m4 +++ b/config/user.m4 @@ -17,6 +17,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [ ZFS_AC_CONFIG_USER_RUNSTATEDIR ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV + ZFS_AC_CONFIG_USER_ZFSEXEC ZFS_AC_TEST_FRAMEWORK diff --git a/configure.ac b/configure.ac index b6fca99b45..486a97571a 100644 --- a/configure.ac +++ b/configure.ac @@ -183,7 +183,6 @@ AC_CONFIG_FILES([ tests/zfs-tests/cmd/threadsappend/Makefile tests/zfs-tests/cmd/xattrtest/Makefile tests/zfs-tests/include/Makefile - tests/zfs-tests/include/default.cfg tests/zfs-tests/tests/Makefile tests/zfs-tests/tests/functional/Makefile tests/zfs-tests/tests/functional/acl/Makefile diff --git a/man/man8/Makefile.am b/man/man8/Makefile.am index 153cd518fa..5401ff06f2 100644 --- a/man/man8/Makefile.am +++ b/man/man8/Makefile.am @@ -19,7 +19,7 @@ EXTRA_DIST = \ zfs-mount-generator.8.in $(nodist_man_MANS): %: %.in - -$(SED) -e 's,@libexecdir\@,$(libexecdir),g' \ + -$(SED) -e 's,@zfsexecdir\@,$(zfsexecdir),g' \ -e 's,@runstatedir\@,$(runstatedir),g' \ -e 's,@sysconfdir\@,$(sysconfdir),g' \ $< >'$@' diff --git a/man/man8/zed.8.in b/man/man8/zed.8.in index 645e91795a..097a8f4a7e 100644 --- a/man/man8/zed.8.in +++ b/man/man8/zed.8.in @@ -201,7 +201,7 @@ The default directory for enabled ZEDLETs. .I @sysconfdir@/zfs/zed.d/zed.rc The default rc file for common variables used by ZEDLETs. .TP -.I @libexecdir@/zfs/zed.d +.I @zfsexecdir@/zed.d The default directory for installed ZEDLETs. .TP .I @runstatedir@/zed.pid diff --git a/man/man8/zfs-mount-generator.8.in b/man/man8/zfs-mount-generator.8.in index 319ac8e571..79720601d6 100644 --- a/man/man8/zfs-mount-generator.8.in +++ b/man/man8/zfs-mount-generator.8.in @@ -56,7 +56,7 @@ touch Then, enable the tracking ZEDLET: .PP .RS 4 -ln -s "@libexecdir@/zfs/zed.d/history_event-zfs-list-cacher.sh" "@sysconfdir@/zfs/zed.d/" +ln -s "@zfsexecdir@/zed.d/history_event-zfs-list-cacher.sh" "@sysconfdir@/zfs/zed.d" systemctl enable zed.service diff --git a/tests/zfs-tests/include/Makefile.am b/tests/zfs-tests/include/Makefile.am index 52e1c0a9f5..41e105287b 100644 --- a/tests/zfs-tests/include/Makefile.am +++ b/tests/zfs-tests/include/Makefile.am @@ -2,13 +2,19 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/include dist_pkgdata_DATA = \ blkdev.shlib \ commands.cfg \ - default.cfg \ libtest.shlib \ math.shlib \ properties.shlib \ zpool_script.shlib -EXTRA_DIST=default.cfg.in +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' \ + $< >'$@' distclean-local:: -$(RM) default.cfg diff --git a/tests/zfs-tests/include/default.cfg.in b/tests/zfs-tests/include/default.cfg.in index 90d1d8bd69..e1e2a7e91f 100644 --- a/tests/zfs-tests/include/default.cfg.in +++ b/tests/zfs-tests/include/default.cfg.in @@ -33,10 +33,8 @@ . $STF_SUITE/include/libtest.shlib # ZFS Directories -export prefix=@prefix@ -export exec_prefix=@exec_prefix@ export ZEDLET_ETC_DIR=${ZEDLET_ETC_DIR:-@sysconfdir@/zfs/zed.d} -export ZEDLET_LIBEXEC_DIR=${ZEDLET_LIBEXEC_DIR:-@libexecdir@/zfs/zed.d} +export ZEDLET_LIBEXEC_DIR=${ZEDLET_LIBEXEC_DIR:-@zfsexecdir@/zed.d} export ZPOOL_SCRIPT_DIR=${ZPOOL_SCRIPT_DIR:-@sysconfdir@/zfs/zpool.d} # Define run length constants