Skip to content

Commit 2ee4e7d

Browse files
FransUrbobehlendorf
authored andcommitted
Accept udev and dracut paths specified by ./configure
There are two common locations where udev and dracut components are commonly installed. When building packages using the 'make rpm|deb' targets check those common locations and pass them to rpmbuild. For non-standard configurations these values can be provided by the the following configure options: --with-udevdir=DIR install udev helpers [default=check] --with-udevruledir=DIR install udev rules [[UDEVDIR/rules.d]] --with-dracutdir=DIR install dracut helpers [default=check] When rebuilding using the source packages the per-distribution default values specified in the spec file will be used. This is the preferred way to build packages for a distribution but the ability to override the defaults is provided as a convenience. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2310 Closes #1680
1 parent 7f6884f commit 2ee4e7d

File tree

4 files changed

+59
-9
lines changed

4 files changed

+59
-9
lines changed

config/user-dracut.m4

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
AC_DEFUN([ZFS_AC_CONFIG_USER_DRACUT], [
2-
AC_ARG_WITH(dracutdir,
2+
AC_MSG_CHECKING(for dracut directory)
3+
AC_ARG_WITH([dracutdir],
34
AC_HELP_STRING([--with-dracutdir=DIR],
4-
[install dracut helpers [[EPREFIX/lib/dracut]]]),
5-
dracutdir=$withval, dracutdir='${exec_prefix}/lib/dracut')
5+
[install dracut helpers @<:@default=check@:>@]),
6+
[dracutdir=$withval],
7+
[dracutdir=check])
8+
9+
AS_IF([test "x$dracutdir" = xcheck], [
10+
path1=/usr/share/dracut
11+
path2=/usr/lib/dracut
12+
default=$path2
13+
14+
AS_IF([test -d "$path1"], [dracutdir="$path1"], [
15+
AS_IF([test -d "$path2"], [dracutdir="$path2"],
16+
[dracutdir="$default"])
17+
])
18+
])
619
720
AC_SUBST(dracutdir)
21+
AC_MSG_RESULT([$dracutdir])
822
])

config/user-udev.m4

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
AC_DEFUN([ZFS_AC_CONFIG_USER_UDEV], [
2+
AC_MSG_CHECKING(for udev directories)
23
AC_ARG_WITH(udevdir,
34
AC_HELP_STRING([--with-udevdir=DIR],
4-
[install udev helpers [[EPREFIX/lib/udev]]]),
5-
udevdir=$withval, udevdir='${exec_prefix}/lib/udev')
5+
[install udev helpers @<:@default=check@:>@]),
6+
[udevdir=$withval],
7+
[udevdir=check])
8+
9+
AS_IF([test "x$udevdir" = xcheck], [
10+
path1=/lib/udev
11+
path2=/usr/lib/udev
12+
default=$path2
13+
14+
AS_IF([test -d "$path1"], [udevdir="$path1"], [
15+
AS_IF([test -d "$path2"], [udevdir="$path2"],
16+
[udevdir="$default"])
17+
])
18+
])
619
720
AC_ARG_WITH(udevruledir,
821
AC_HELP_STRING([--with-udevruledir=DIR],
922
[install udev rules [[UDEVDIR/rules.d]]]),
10-
udevruledir=$withval, udevruledir='${udevdir}/rules.d')
23+
[udevruledir=$withval],
24+
[udevruledir="${udevdir}/rules.d"])
1125
1226
AC_SUBST(udevdir)
1327
AC_SUBST(udevruledir)
28+
AC_MSG_RESULT([$udevdir;$udevruledir])
1429
])

config/zfs-build.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ AC_DEFUN([ZFS_AC_RPM], [
140140
])
141141
142142
RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1" --define "$(DEBUG_DMU_TX) 1"'
143-
RPM_DEFINE_UTIL=
143+
RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)"'
144144
RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spldir $(SPL)" --define "require_splobj $(SPL_OBJ)" --define "ksrc $(LINUX)" --define "kobj $(LINUX_OBJ)"'
145145
RPM_DEFINE_DKMS=
146146

rpm/generic/zfs.spec.in

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,32 @@
11
%global _sbindir /sbin
22
%global _libdir /%{_lib}
3-
%if 0%{?fedora} >= 17
3+
4+
# Set the default udev directory based on distribution.
5+
%if 0%{!?_udevdir}
6+
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
47
%global _udevdir %{_prefix}/lib/udev
5-
%global _dracutdir %{_prefix}/lib/dracut
68
%else
79
%global _udevdir /lib/udev
10+
%endif
11+
%endif
12+
13+
# Set the default udevrule directory based on distribution.
14+
%if 0%{!?_udevruledir}
15+
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
16+
%global _udevruledir %{_prefix}/lib/udevrule/rules.d
17+
%else
18+
%global _udevruledir /lib/udevrule/rules.d
19+
%endif
20+
%endif
21+
22+
# Set the default dracut directory based on distribution.
23+
%if 0%{!?_dracutdir}
24+
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
25+
%global _dracutdir %{_prefix}/lib/dracut
26+
%else
827
%global _dracutdir %{_prefix}/share/dracut
928
%endif
29+
%endif
1030

1131
%bcond_with debug
1232
%bcond_with blkid
@@ -192,6 +212,7 @@ image which is ZFS aware.
192212
%configure \
193213
--with-config=user \
194214
--with-udevdir=%{_udevdir} \
215+
--with-udevruledir=%{_udevruledir} \
195216
--with-dracutdir=%{_dracutdir} \
196217
--disable-static \
197218
%{debug} \

0 commit comments

Comments
 (0)