%bcond_without servers # Set the package name prefix %if %{with servers} %define module @PACKAGE@ %else %define module @PACKAGE@-client %endif %if %{_vendor}=="redhat" || %{_vendor}=="fedora" %global requires_kmod_name kmod-%{module} %define mkconf_options %else #for Suse / Ubuntu %global requires_kmod_name %{module}-kmp %define mkconf_options "-k updates" %endif %define buildid 1 %define mkconf lustre/scripts/dkms.mkconf Name: %{module}-dkms Version: @VERSION@ Release: %{buildid}%{?dist} Summary: Kernel module(s) (dkms) Group: System Environment/Kernel License: GPLv2+ URL: http://lustre.opensfs.org/ Source0: @PACKAGE@-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # DKMS >= 2.2.0.3-28.git.7c3e7c5 to fully support inter-modules deps # (ie, "BUILD_DEPENDS[#]="), and have latest DKMS fixes integrated # for bugs that prevented our module to build/install. Requires: dkms >= 2.2.0.3-28.git.7c3e7c5 %if %{with servers} # Only zfs Lustre DKMS Server is supported Requires: spl-dkms >= 0.6.1 Requires: zfs-dkms >= 0.6.1 Requires: %{module}-osd-zfs-mount # If client package is installed when installing server, remove it since # the server package also includes the client. This can be removed if/when # the packages are split into independent client/server/common packages. Obsoletes: @PACKAGE@-client < %{version} %endif Requires: gcc, make, perl Requires: kernel-devel Provides: %{requires_kmod_name} = %{version} Provides: %{module}-modules = %{version} %if %{with servers} # Only zfs Lustre DKMS Server is supported Provides: %{module}-osd-zfs = %{version} Provides: %{module}-osd %endif %description This package contains the dkms Lustre kernel modules. %prep %setup -q -n @PACKAGE@-%{version} %build %{mkconf} -n %{module} -v %{version} -f dkms.conf %{mkconf_options} %install if [ "$RPM_BUILD_ROOT" != "/" ]; then rm -rf $RPM_BUILD_ROOT fi mkdir -p $RPM_BUILD_ROOT/usr/src/ cp -rfp ${RPM_BUILD_DIR}/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/ %if %{without servers} # To have the directory reflect the DKMS RPM name! mv $RPM_BUILD_ROOT/usr/src/@PACKAGE@-%{version} $RPM_BUILD_ROOT/usr/src/%{module}-%{version} %endif %clean if [ "$RPM_BUILD_ROOT" != "/" ]; then rm -rf $RPM_BUILD_ROOT fi %files %defattr(-,root,root) /usr/src/%{module}-%{version} %post for POSTINST in /usr/lib/dkms/common.postinst; do if [ -f $POSTINST ]; then $POSTINST %{module} %{version} exit $? fi echo "WARNING: $POSTINST does not exist." done echo -e "ERROR: DKMS version is too old and %{module} was not" echo -e "built with legacy DKMS support." echo -e "You must either rebuild %{module} with legacy postinst" echo -e "support or upgrade DKMS to a more current version." exit 1 %preun dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade exit 0 %changelog * Sat Jan 23 2016 Bruno Faccini - detect and handle cases where [spl,zfs]-dkms packages are not built - also handle on-target configure issues * Wed Oct 7 2015 Bruno Faccini - adapted for Lustre Client DKMS creation - allow for on-target reconfig to prevent static deps requires * Mon Apr 8 2013 Brian Behlendorf - 2.3.63-1 - First DKMS packages.