diff --git a/Makefile.am b/Makefile.am index c6ed2009f2..17e4c9ccbe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -3,7 +3,7 @@ include $(top_srcdir)/config/deb.am include $(top_srcdir)/config/tgz.am if CONFIG_USER -USER_DIR = dracut etc man scripts lib cmd +USER_DIR = dracut udev etc man scripts lib cmd endif if CONFIG_KERNEL KERNEL_DIR = module diff --git a/cmd/sas_switch_id/Makefile.am b/cmd/sas_switch_id/Makefile.am index 092766369d..b666bea0a9 100644 --- a/cmd/sas_switch_id/Makefile.am +++ b/cmd/sas_switch_id/Makefile.am @@ -1 +1 @@ -dist_bin_SCRIPTS = sas_switch_id +dist_udev_SCRIPTS = sas_switch_id diff --git a/cmd/zpool_id/Makefile.am b/cmd/zpool_id/Makefile.am index 023e1ab59a..5f492cfd78 100644 --- a/cmd/zpool_id/Makefile.am +++ b/cmd/zpool_id/Makefile.am @@ -1 +1 @@ -dist_bin_SCRIPTS = zpool_id +dist_udev_SCRIPTS = zpool_id diff --git a/cmd/zvol_id/Makefile.am b/cmd/zvol_id/Makefile.am index dcdea58b96..88ece6b198 100644 --- a/cmd/zvol_id/Makefile.am +++ b/cmd/zvol_id/Makefile.am @@ -4,7 +4,7 @@ DEFAULT_INCLUDES += \ -I$(top_srcdir)/include \ -I$(top_srcdir)/lib/libspl/include -bin_PROGRAMS = zvol_id +udev_PROGRAMS = zvol_id zvol_id_SOURCES = \ $(top_srcdir)/cmd/zvol_id/zvol_id_main.c diff --git a/config/user-udev.m4 b/config/user-udev.m4 new file mode 100644 index 0000000000..47da604780 --- /dev/null +++ b/config/user-udev.m4 @@ -0,0 +1,14 @@ +AC_DEFUN([ZFS_AC_CONFIG_USER_UDEV], [ + AC_ARG_WITH(udevdir, + AC_HELP_STRING([--with-udevdir=DIR], + [install udev helpers [[EPREFIX/lib/udev]]]), + udevdir=$withval, udevdir='${exec_prefix}/lib/udev') + + AC_ARG_WITH(udevruledir, + AC_HELP_STRING([--with-udevruledir=DIR], + [install udev rules [[UDEVDIR/rules.d]]]), + udevruledir=$withval, udevruledir='${udevdir}/rules.d') + + AC_SUBST(udevdir) + AC_SUBST(udevruledir) +]) diff --git a/config/user.m4 b/config/user.m4 index a79deefe85..4fcef3d5b6 100644 --- a/config/user.m4 +++ b/config/user.m4 @@ -2,6 +2,7 @@ dnl # dnl # Default ZFS user configuration dnl # AC_DEFUN([ZFS_AC_CONFIG_USER], [ + ZFS_AC_CONFIG_USER_UDEV ZFS_AC_CONFIG_USER_ARCH ZFS_AC_CONFIG_USER_IOCTL ZFS_AC_CONFIG_USER_ZLIB diff --git a/configure.ac b/configure.ac index 8afd0fcade..8b0f1d5e05 100644 --- a/configure.ac +++ b/configure.ac @@ -57,9 +57,9 @@ AC_CONFIG_FILES([ Makefile dracut/Makefile dracut/90zfs/Makefile + udev/Makefile + udev/rules.d/Makefile etc/Makefile - etc/udev/Makefile - etc/udev/rules.d/Makefile etc/init.d/Makefile etc/init.d/zfs.arch etc/init.d/zfs.gentoo diff --git a/dracut/90zfs/module-setup.sh b/dracut/90zfs/module-setup.sh index 6dd3d5c175..822f89988e 100755 --- a/dracut/90zfs/module-setup.sh +++ b/dracut/90zfs/module-setup.sh @@ -29,8 +29,8 @@ installkernel() { install() { inst_rules "$moddir/90-zfs.rules" - inst_rules /etc/udev/rules.d/60-zpool.rules - inst_rules /etc/udev/rules.d/60-zvol.rules + inst_rules /lib/udev/rules.d/60-zpool.rules + inst_rules /lib/udev/rules.d/60-zvol.rules inst /etc/zfs/zdev.conf inst /etc/zfs/zpool.cache inst /etc/hostid diff --git a/etc/Makefile.am b/etc/Makefile.am index 1a8c6562a4..65882b55ef 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -1 +1 @@ -SUBDIRS = init.d udev zfs +SUBDIRS = init.d zfs diff --git a/etc/udev/rules.d/Makefile.am b/etc/udev/rules.d/Makefile.am deleted file mode 100644 index 9929c45bd2..0000000000 --- a/etc/udev/rules.d/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -pkgsysconfdir = $(sysconfdir)/udev/rules.d - -pkgsysconf_DATA = \ - 60-zpool.rules \ - 60-zvol.rules - -EXTRA_DIST = \ - 60-zpool.rules.in \ - 60-zvol.rules.in - -$(pkgsysconf_DATA): - -$(SED) -e 's,@bindir\@,$(bindir),g' '$@.in' >'$@' - -distclean-local:: - -$(RM) $(pkgsysconf_DATA) diff --git a/etc/udev/Makefile.am b/udev/Makefile.am similarity index 100% rename from etc/udev/Makefile.am rename to udev/Makefile.am diff --git a/etc/udev/Makefile.in b/udev/Makefile.in similarity index 100% rename from etc/udev/Makefile.in rename to udev/Makefile.in diff --git a/etc/udev/rules.d/.gitignore b/udev/rules.d/.gitignore similarity index 100% rename from etc/udev/rules.d/.gitignore rename to udev/rules.d/.gitignore diff --git a/etc/udev/rules.d/60-zpool.rules.in b/udev/rules.d/60-zpool.rules.in similarity index 76% rename from etc/udev/rules.d/60-zpool.rules.in rename to udev/rules.d/60-zpool.rules.in index e3a1f70518..32fceed116 100644 --- a/etc/udev/rules.d/60-zpool.rules.in +++ b/udev/rules.d/60-zpool.rules.in @@ -1,8 +1,8 @@ # -# /etc/udev/rules.d/60-zpool.rules +# /lib/udev/rules.d/60-zpool.rules # -ENV{DEVTYPE}=="disk", IMPORT{program}="@bindir@/zpool_id -d %p" +ENV{DEVTYPE}=="disk", IMPORT{program}="@udevdir@/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{DEVTYPE}=="partition", ENV{ID_ZPOOL}=="?*", SYMLINK+="$env{ID_ZPOOL_PATH}-part%n" diff --git a/etc/udev/rules.d/60-zvol.rules.in b/udev/rules.d/60-zvol.rules.in similarity index 80% rename from etc/udev/rules.d/60-zvol.rules.in rename to udev/rules.d/60-zvol.rules.in index e71e5be280..199f77e0ce 100644 --- a/etc/udev/rules.d/60-zvol.rules.in +++ b/udev/rules.d/60-zvol.rules.in @@ -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="@bindir@/zvol_id $tempnode" SYMLINK+="zvol/%c %c" +KERNEL=="zd*" SUBSYSTEM=="block" ACTION=="add|change" PROGRAM="@udevdir@/zvol_id $tempnode" SYMLINK+="zvol/%c %c" diff --git a/udev/rules.d/Makefile.am b/udev/rules.d/Makefile.am new file mode 100644 index 0000000000..41740517eb --- /dev/null +++ b/udev/rules.d/Makefile.am @@ -0,0 +1,14 @@ +udevrule_DATA = \ + 60-zpool.rules \ + 60-zvol.rules + +EXTRA_DIST = \ + 60-zpool.rules.in \ + 60-zvol.rules.in + +$(udevrule_DATA): + -$(SED) -e 's,@udevdir\@,$(udevdir),g' '$@.in' >'$@' + +distclean-local:: + -$(RM) $(udevrule_DATA) + diff --git a/etc/udev/rules.d/Makefile.in b/udev/rules.d/Makefile.in similarity index 100% rename from etc/udev/rules.d/Makefile.in rename to udev/rules.d/Makefile.in diff --git a/zfs.spec.in b/zfs.spec.in index cba98af1d7..56e8c47645 100644 --- a/zfs.spec.in +++ b/zfs.spec.in @@ -3,9 +3,9 @@ %define release @ZFS_META_RELEASE@ %define debug_package %{nil} %define _prefix / -%define _bindir /lib/udev %define _libexecdir /usr/libexec %define _datadir /usr/share +%define _udevdir /lib/udev Summary: ZFS Library and Utils Group: Utilities/System @@ -61,7 +61,7 @@ which are ZFS aware. %prep %setup %build -%configure --with-config=user --without-blkid +%configure --with-config=user --without-blkid --with-udevdir=%{_udevdir} make %install @@ -80,8 +80,9 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/* %{_mandir}/man8/* %{_sysconfdir}/init.d/* -%{_sysconfdir}/udev/rules.d/* %{_sysconfdir}/zfs/* +%{_udevdir}/* +%{_udevdir}/rules.d/* %files devel %defattr(-,root,root)