Skip to content

Commit

Permalink
Only build the dracut package if /usr/lib/dracut exists.
Browse files Browse the repository at this point in the history
  • Loading branch information
FransUrbo committed Jul 28, 2015
1 parent 02ee59f commit 0111acb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
12 changes: 11 additions & 1 deletion config/zfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ AC_DEFUN([ZFS_AC_RPM], [
])
RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1" --define "$(DEBUG_DMU_TX) 1"'
RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS)'
RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS) $(DEFINE_DRACUT)'
RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spldir $(SPL)" --define "require_splobj $(SPL_OBJ)" --define "ksrc $(LINUX)" --define "kobj $(LINUX_OBJ)"'
RPM_DEFINE_DKMS=
Expand Down Expand Up @@ -334,6 +334,16 @@ AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [
AC_MSG_RESULT([no])
fi
AC_SUBST(DEFINE_INITRAMFS)
AC_MSG_CHECKING([whether dracut is available])
if test -d /usr/lib/dracut ; then
DEFINE_DRACUT='--define "_dracut 1"'
AC_MSG_RESULT([yes])
else
DEFINE_DRACUT=''
AC_MSG_RESULT([no])
fi
AC_SUBST(DEFINE_DRACUT)
])

dnl #
Expand Down
18 changes: 15 additions & 3 deletions rpm/generic/zfs.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@
%endif
%endif

%if 0%{?_dracut}
# Set the default dracut directory based on distribution.
%if %{undefined _dracutdir}
%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 || 0%{?centos} >= 7
%global _dracutdir %{_prefix}/lib/dracut
%global _dracutopt --with-dracutdir=%{_prefix}/lib/dracut
%else
%global _dracutdir %{_prefix}/share/dracut
%global _dracutopt --with-dracutdir=%{_prefix}/share/dracut
%endif
%else
%global _dracutopt --with-dracutdir=%{_dracutdir}
%endif
%else
%global _dracutopt ''
%endif

# Set the default _initconfdir when undefined.
Expand Down Expand Up @@ -184,6 +190,7 @@ Requires: bc
This package contains test infrastructure and support scripts for
validating the file system.

%if 0%{?_dracut}
%package dracut
Summary: Dracut module
Group: System Environment/Kernel
Expand All @@ -194,6 +201,7 @@ Requires: dracut
%description dracut
This package contains a dracut module used to construct an initramfs
image which is ZFS aware.
%endif

%if 0%{?_initramfs}
%package initramfs
Expand Down Expand Up @@ -232,8 +240,8 @@ image which is ZFS aware.
--with-config=user \
--with-udevdir=%{_udevdir} \
--with-udevruledir=%{_udevruledir} \
--with-dracutdir=%{_dracutdir} \
--disable-static \
%{_dracutopt} \
%{debug} \
%{blkid} \
%{systemd}
Expand Down Expand Up @@ -318,9 +326,13 @@ exit 0
%files test
%{_datadir}/%{name}

%if 0%{?_dracut}
%files dracut
%doc contrib/dracut/README.dracut.markdown
%{_dracutdir}/modules.d/*
%else
%exclude %{_dracutdir}
%endif

%if 0%{?_initramfs}
%files initramfs
Expand Down

0 comments on commit 0111acb

Please sign in to comment.