Fix autoconf variable substitution in udev rules.
authorDarik Horn <dajhorn@vanadac.com>
Fri, 17 Jun 2011 15:02:36 +0000 (10:02 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 17 Jun 2011 17:11:29 +0000 (10:11 -0700)
Change the variable substitution in the udev rule templates
according to the method described in the Autoconf manual;
Chapter 4.7.2: Installation Directory Variables.

The udev rules are improperly generated if the bindir parameter
overrides the prefix parameter during configure. For example:

  # ./configure --prefix=/usr/local --bindir=/opt/zfs/bin

The udev helper is installed as /opt/zfs/bin/zpool_id, but the
corresponding udev rule has a different path:

  # /usr/local/etc/udev/rules.d/60-zpool.rules
  ENV{DEVTYPE}=="disk", IMPORT{program}="/usr/local/bin/zpool_id -d %p"

The @bindir@ variable expands to "${exec_prefix}/bin", so it cannot
be used instead of @prefix@ directly.

This also applies to the zvol_id helper.

Closes #283.

configure.ac
etc/udev/rules.d/60-zpool.rules.in
etc/udev/rules.d/60-zvol.rules.in
etc/udev/rules.d/Makefile.am

index b578341..a188fa7 100644 (file)
@@ -60,8 +60,6 @@ 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
index fc1a1d1..6e5a727 100644 (file)
@@ -2,7 +2,7 @@
 # /etc/udev/rules.d/60-zpool.rules
 #
 
-ENV{DEVTYPE}=="disk", IMPORT{program}="@prefix@/bin/zpool_id -d %p"
+ENV{DEVTYPE}=="disk", IMPORT{program}="@bindir@/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"
index 06f5f93..e71e5be 100644 (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|change" PROGRAM="@prefix@/bin/zvol_id $tempnode" SYMLINK+="zvol/%c %c"
+KERNEL=="zd*" SUBSYSTEM=="block" ACTION=="add|change" PROGRAM="@bindir@/zvol_id $tempnode" SYMLINK+="zvol/%c %c"
index 1a7a1e3..9929c45 100644 (file)
@@ -4,7 +4,12 @@ pkgsysconf_DATA = \
        60-zpool.rules \
        60-zvol.rules
 
-EXTRA_DIST = 60-zpool.rules.in 60-zvol.rules.in
+EXTRA_DIST = \
+       60-zpool.rules.in \
+       60-zvol.rules.in
+
+$(pkgsysconf_DATA):
+       -$(SED) -e 's,@bindir\@,$(bindir),g' '$@.in' >'$@'
 
 distclean-local::
        -$(RM) $(pkgsysconf_DATA)