1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-29 08:08:37 +00:00

Set cmd paths in udev rules using --prefix

The udev/rules.d scripts must use absolute paths to their support
binaries.  However, where those binaries get installed depends
on what --prefix was set to when the package was configured.
This change makes the udev/rules.d helpers to *.in files which
are processed by configure.  This allows them to be dynamically
updated to include the specified --prefix.

Additionally, this change updates 60-zvol.rules to handle both
the 'add' and 'change' actions.  This ensures that that all
valid zvol devices are correctly linked.
This commit is contained in:
Brian Behlendorf 2011-03-24 11:34:41 -07:00
parent a5729f7b22
commit 1d82906dea
7 changed files with 36 additions and 18 deletions

4
configure vendored
View File

@ -20008,7 +20008,7 @@ fi
$as_echo "$enable_debug" >&6; }
ac_config_files="$ac_config_files Makefile dracut/Makefile dracut/90zfs/Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/init.d/Makefile etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh"
ac_config_files="$ac_config_files Makefile dracut/Makefile dracut/90zfs/Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/udev/rules.d/60-zpool.rules etc/udev/rules.d/60-zvol.rules etc/init.d/Makefile etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh"
cat >confcache <<\_ACEOF
@ -20930,6 +20930,8 @@ do
"etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;;
"etc/udev/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/Makefile" ;;
"etc/udev/rules.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/udev/rules.d/Makefile" ;;
"etc/udev/rules.d/60-zpool.rules") CONFIG_FILES="$CONFIG_FILES etc/udev/rules.d/60-zpool.rules" ;;
"etc/udev/rules.d/60-zvol.rules") CONFIG_FILES="$CONFIG_FILES etc/udev/rules.d/60-zvol.rules" ;;
"etc/init.d/Makefile") CONFIG_FILES="$CONFIG_FILES etc/init.d/Makefile" ;;
"etc/zfs/Makefile") CONFIG_FILES="$CONFIG_FILES etc/zfs/Makefile" ;;
"man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;

View File

@ -60,6 +60,8 @@ AC_CONFIG_FILES([
etc/Makefile
etc/udev/Makefile
etc/udev/rules.d/Makefile
etc/udev/rules.d/60-zpool.rules
etc/udev/rules.d/60-zvol.rules
etc/init.d/Makefile
etc/zfs/Makefile
man/Makefile

2
etc/udev/rules.d/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
60-zpool.rules
60-zvol.rules

View File

@ -2,7 +2,7 @@
# /etc/udev/rules.d/99-zpool.rules
#
ENV{DEVTYPE}=="disk", IMPORT{program}="/usr/bin/zpool_id -d %p"
ENV{DEVTYPE}=="disk", IMPORT{program}="@prefix@/bin/zpool_id -d %p"
KERNEL=="*[!0-9]", ENV{SUBSYSTEM}=="block", ENV{ID_ZPOOL}=="?*", SYMLINK+="$env{ID_ZPOOL_PATH}"
KERNEL=="*[0-9]", ENV{SUBSYSTEM}=="block", ENV{ID_ZPOOL}=="?*", SYMLINK+="$env{ID_ZPOOL_PATH}-part%n"

View File

@ -3,4 +3,4 @@
# persistent disk links: /dev/zvol/dataset_name
# also creates compatibilty symlink of /dev/dataset_name
KERNEL=="zd*" SUBSYSTEM=="block" ACTION=="add" PROGRAM="/usr/bin/zvol_id $tempnode" SYMLINK+="zvol/%c %c"
KERNEL=="zd*" SUBSYSTEM=="block" ACTION=="add|change" PROGRAM="@prefix@/bin/zvol_id $tempnode" SYMLINK+="zvol/%c %c"

View File

@ -4,4 +4,7 @@ pkgsysconf_DATA = \
60-zpool.rules \
60-zvol.rules
EXTRA_DIST = $(pkgsysconf_DATA)
EXTRA_DIST = 60-zpool.rules.in 60-zvol.rules.in
distclean-local::
-$(RM) $(pkgsysconf_DATA)

View File

@ -36,7 +36,8 @@ build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = etc/udev/rules.d
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
DIST_COMMON = $(srcdir)/60-zpool.rules.in $(srcdir)/60-zvol.rules.in \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \
@ -56,6 +57,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
@ -77,7 +79,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/zfs_config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_FILES = 60-zpool.rules 60-zvol.rules
CONFIG_CLEAN_VPATH_FILES =
AM_V_GEN = $(am__v_GEN_$(V))
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
@ -282,7 +284,7 @@ pkgsysconf_DATA = \
60-zpool.rules \
60-zvol.rules
EXTRA_DIST = $(pkgsysconf_DATA)
EXTRA_DIST = 60-zpool.rules.in 60-zvol.rules.in
all: all-am
.SUFFIXES:
@ -316,6 +318,10 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
60-zpool.rules: $(top_builddir)/config.status $(srcdir)/60-zpool.rules.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
60-zvol.rules: $(top_builddir)/config.status $(srcdir)/60-zvol.rules.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
mostlyclean-libtool:
-rm -f *.lo
@ -417,7 +423,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-generic
distclean-am: clean-am distclean-generic distclean-local
dvi: dvi-am
@ -480,18 +486,21 @@ uninstall-am: uninstall-pkgsysconfDATA
.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
distclean distclean-generic distclean-libtool distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-pkgsysconfDATA install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall uninstall-am uninstall-pkgsysconfDATA
distclean distclean-generic distclean-libtool distclean-local \
distdir dvi dvi-am html html-am info info-am install \
install-am install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-pkgsysconfDATA install-ps \
install-ps-am install-strip installcheck installcheck-am \
installdirs maintainer-clean maintainer-clean-generic \
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
ps ps-am uninstall uninstall-am uninstall-pkgsysconfDATA
distclean-local::
-$(RM) $(pkgsysconf_DATA)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: