From 1d82906dea5eb698a854d992e445e794fb5a0880 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Thu, 24 Mar 2011 11:34:41 -0700 Subject: 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. --- etc/udev/rules.d/.gitignore | 2 ++ etc/udev/rules.d/60-zpool.rules | 8 -------- etc/udev/rules.d/60-zpool.rules.in | 8 ++++++++ etc/udev/rules.d/60-zvol.rules | 6 ------ etc/udev/rules.d/60-zvol.rules.in | 6 ++++++ etc/udev/rules.d/Makefile.am | 5 ++++- etc/udev/rules.d/Makefile.in | 39 +++++++++++++++++++++++--------------- 7 files changed, 44 insertions(+), 30 deletions(-) create mode 100644 etc/udev/rules.d/.gitignore delete mode 100644 etc/udev/rules.d/60-zpool.rules create mode 100644 etc/udev/rules.d/60-zpool.rules.in delete mode 100644 etc/udev/rules.d/60-zvol.rules create mode 100644 etc/udev/rules.d/60-zvol.rules.in (limited to 'etc/udev') diff --git a/etc/udev/rules.d/.gitignore b/etc/udev/rules.d/.gitignore new file mode 100644 index 000000000..e56d65ef8 --- /dev/null +++ b/etc/udev/rules.d/.gitignore @@ -0,0 +1,2 @@ +60-zpool.rules +60-zvol.rules diff --git a/etc/udev/rules.d/60-zpool.rules b/etc/udev/rules.d/60-zpool.rules deleted file mode 100644 index 0f4a356dd..000000000 --- a/etc/udev/rules.d/60-zpool.rules +++ /dev/null @@ -1,8 +0,0 @@ -# -# /etc/udev/rules.d/99-zpool.rules -# - -ENV{DEVTYPE}=="disk", IMPORT{program}="/usr/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" diff --git a/etc/udev/rules.d/60-zpool.rules.in b/etc/udev/rules.d/60-zpool.rules.in new file mode 100644 index 000000000..f06be6a21 --- /dev/null +++ b/etc/udev/rules.d/60-zpool.rules.in @@ -0,0 +1,8 @@ +# +# /etc/udev/rules.d/99-zpool.rules +# + +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" diff --git a/etc/udev/rules.d/60-zvol.rules b/etc/udev/rules.d/60-zvol.rules deleted file mode 100644 index 803d4260d..000000000 --- a/etc/udev/rules.d/60-zvol.rules +++ /dev/null @@ -1,6 +0,0 @@ -# Peristent links for zvol -# -# 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" diff --git a/etc/udev/rules.d/60-zvol.rules.in b/etc/udev/rules.d/60-zvol.rules.in new file mode 100644 index 000000000..860e74b21 --- /dev/null +++ b/etc/udev/rules.d/60-zvol.rules.in @@ -0,0 +1,6 @@ +# Peristent links for zvol +# +# persistent disk links: /dev/zvol/dataset_name +# also creates compatibilty symlink of /dev/dataset_name + +KERNEL=="zd*" SUBSYSTEM=="block" ACTION=="add|change" PROGRAM="@prefix@/bin/zvol_id $tempnode" SYMLINK+="zvol/%c %c" diff --git a/etc/udev/rules.d/Makefile.am b/etc/udev/rules.d/Makefile.am index 04536007a..1a7a1e392 100644 --- a/etc/udev/rules.d/Makefile.am +++ b/etc/udev/rules.d/Makefile.am @@ -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) diff --git a/etc/udev/rules.d/Makefile.in b/etc/udev/rules.d/Makefile.in index 5cc5b350a..9937d06a3 100644 --- a/etc/udev/rules.d/Makefile.in +++ b/etc/udev/rules.d/Makefile.in @@ -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,17 +486,20 @@ 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. -- cgit v1.2.3