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.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' \

View file

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

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_MAKEDEV_IN_SYSMACROS
ZFS_AC_CONFIG_USER_MAKEDEV_IN_MKDEV
ZFS_AC_CONFIG_USER_ZFSEXEC
ZFS_AC_TEST_FRAMEWORK

View file

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

View file

@ -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' \
$< >'$@'

View file

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

View file

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

View file

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

View file

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