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 <behlendorf1@llnl.gov>
Signed-off-by: Antonio Russo <antonio.e.russo@gmail.com>
Closes #7597
This commit is contained in:
Antonio Russo 2018-06-07 12:59:59 -04:00 committed by Brian Behlendorf
parent fba33c3819
commit 39042f9736
10 changed files with 27 additions and 13 deletions

View File

@ -54,14 +54,13 @@ dist_zedconf_DATA = \
zed.d/zed-functions.sh \ zed.d/zed-functions.sh \
zed.d/zed.rc zed.d/zed.rc
zedexecdir = $(libexecdir)/zfs/zed.d zedexecdir = $(zfsexecdir)/zed.d
dist_zedexec_SCRIPTS = \ dist_zedexec_SCRIPTS = \
zed.d/all-debug.sh \ zed.d/all-debug.sh \
zed.d/all-syslog.sh \ zed.d/all-syslog.sh \
zed.d/data-notify.sh \ zed.d/data-notify.sh \
zed.d/generic-notify.sh \ zed.d/generic-notify.sh \
zed.d/history_event-zfs-list-cacher.sh \
zed.d/resilver_finish-notify.sh \ zed.d/resilver_finish-notify.sh \
zed.d/scrub_finish-notify.sh \ zed.d/scrub_finish-notify.sh \
zed.d/statechange-led.sh \ zed.d/statechange-led.sh \
@ -71,7 +70,9 @@ dist_zedexec_SCRIPTS = \
zed.d/pool_import-led.sh \ zed.d/pool_import-led.sh \
zed.d/resilver_finish-start-scrub.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' \ -$(SED) -e 's,@bindir\@,$(bindir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \ -e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sbindir\@,$(sbindir),g' \ -e 's,@sbindir\@,$(sbindir),g' \

View File

@ -21,7 +21,7 @@ zpool_LDADD = \
zpool_LDADD += -lm $(LIBBLKID) zpool_LDADD += -lm $(LIBBLKID)
zpoolconfdir = $(sysconfdir)/zfs/zpool.d zpoolconfdir = $(sysconfdir)/zfs/zpool.d
zpoolexecdir = $(libexecdir)/zfs/zpool.d zpoolexecdir = $(zfsexecdir)/zpool.d
EXTRA_DIST = zpool.d/README EXTRA_DIST = zpool.d/README

9
config/user-libexec.m4 Normal file
View File

@ -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])
])

View File

@ -17,6 +17,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_RUNSTATEDIR ZFS_AC_CONFIG_USER_RUNSTATEDIR
ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS ZFS_AC_CONFIG_USER_MAKEDEV_IN_SYSMACROS
ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV
ZFS_AC_CONFIG_USER_ZFSEXEC
ZFS_AC_TEST_FRAMEWORK ZFS_AC_TEST_FRAMEWORK

View File

@ -183,7 +183,6 @@ AC_CONFIG_FILES([
tests/zfs-tests/cmd/threadsappend/Makefile tests/zfs-tests/cmd/threadsappend/Makefile
tests/zfs-tests/cmd/xattrtest/Makefile tests/zfs-tests/cmd/xattrtest/Makefile
tests/zfs-tests/include/Makefile tests/zfs-tests/include/Makefile
tests/zfs-tests/include/default.cfg
tests/zfs-tests/tests/Makefile tests/zfs-tests/tests/Makefile
tests/zfs-tests/tests/functional/Makefile tests/zfs-tests/tests/functional/Makefile
tests/zfs-tests/tests/functional/acl/Makefile tests/zfs-tests/tests/functional/acl/Makefile

View File

@ -19,7 +19,7 @@ EXTRA_DIST = \
zfs-mount-generator.8.in zfs-mount-generator.8.in
$(nodist_man_MANS): %: %.in $(nodist_man_MANS): %: %.in
-$(SED) -e 's,@libexecdir\@,$(libexecdir),g' \ -$(SED) -e 's,@zfsexecdir\@,$(zfsexecdir),g' \
-e 's,@runstatedir\@,$(runstatedir),g' \ -e 's,@runstatedir\@,$(runstatedir),g' \
-e 's,@sysconfdir\@,$(sysconfdir),g' \ -e 's,@sysconfdir\@,$(sysconfdir),g' \
$< >'$@' $< >'$@'

View File

@ -201,7 +201,7 @@ The default directory for enabled ZEDLETs.
.I @sysconfdir@/zfs/zed.d/zed.rc .I @sysconfdir@/zfs/zed.d/zed.rc
The default rc file for common variables used by ZEDLETs. The default rc file for common variables used by ZEDLETs.
.TP .TP
.I @libexecdir@/zfs/zed.d .I @zfsexecdir@/zed.d
The default directory for installed ZEDLETs. The default directory for installed ZEDLETs.
.TP .TP
.I @runstatedir@/zed.pid .I @runstatedir@/zed.pid

View File

@ -56,7 +56,7 @@ touch
Then, enable the tracking ZEDLET: Then, enable the tracking ZEDLET:
.PP .PP
.RS 4 .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 systemctl enable zed.service

View File

@ -2,13 +2,19 @@ pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/include
dist_pkgdata_DATA = \ dist_pkgdata_DATA = \
blkdev.shlib \ blkdev.shlib \
commands.cfg \ commands.cfg \
default.cfg \
libtest.shlib \ libtest.shlib \
math.shlib \ math.shlib \
properties.shlib \ properties.shlib \
zpool_script.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:: distclean-local::
-$(RM) default.cfg -$(RM) default.cfg

View File

@ -33,10 +33,8 @@
. $STF_SUITE/include/libtest.shlib . $STF_SUITE/include/libtest.shlib
# ZFS Directories # ZFS Directories
export prefix=@prefix@
export exec_prefix=@exec_prefix@
export ZEDLET_ETC_DIR=${ZEDLET_ETC_DIR:-@sysconfdir@/zfs/zed.d} 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} export ZPOOL_SCRIPT_DIR=${ZPOOL_SCRIPT_DIR:-@sysconfdir@/zfs/zpool.d}
# Define run length constants # Define run length constants