2014-05-30 00:36:24 +04:00
|
|
|
%{?!packager: %define packager Brian Behlendorf <behlendorf1@llnl.gov>}
|
|
|
|
|
2017-10-15 23:00:44 +03:00
|
|
|
%if ! 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
|
|
|
|
%define not_rpm 1
|
|
|
|
%endif
|
|
|
|
|
2020-07-19 20:19:08 +03:00
|
|
|
# Exclude input files from mangling
|
|
|
|
%global __brp_mangle_shebangs_exclude_from ^/usr/src/.*$
|
2018-11-12 05:06:36 +03:00
|
|
|
|
2013-02-18 00:10:17 +04:00
|
|
|
%define module @PACKAGE@
|
|
|
|
%define mkconf scripts/dkms.mkconf
|
|
|
|
|
|
|
|
Name: %{module}-dkms
|
|
|
|
|
|
|
|
Version: @VERSION@
|
|
|
|
Release: @RELEASE@%{?dist}
|
|
|
|
Summary: Kernel module(s) (dkms)
|
|
|
|
|
|
|
|
Group: System Environment/Kernel
|
|
|
|
License: @ZFS_META_LICENSE@
|
2020-10-09 06:10:13 +03:00
|
|
|
URL: https://github.com/openzfs/zfs
|
2013-02-18 00:10:17 +04:00
|
|
|
Source0: %{module}-%{version}.tar.gz
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|
|
|
BuildArch: noarch
|
|
|
|
|
2017-10-15 23:00:44 +03:00
|
|
|
Requires: dkms >= 2.2.0.3
|
2019-02-20 21:04:05 +03:00
|
|
|
Requires: gcc, make, perl, diffutils
|
2017-10-15 23:00:44 +03:00
|
|
|
%if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
|
2021-05-28 09:06:45 +03:00
|
|
|
Requires: kernel-devel >= @ZFS_META_KVER_MIN@, kernel-devel <= @ZFS_META_KVER_MAX@.999
|
2018-02-16 04:53:18 +03:00
|
|
|
Obsoletes: spl-dkms
|
2017-10-15 23:00:44 +03:00
|
|
|
%endif
|
2013-02-18 00:10:17 +04:00
|
|
|
Provides: %{module}-kmod = %{version}
|
2017-11-07 21:59:27 +03:00
|
|
|
AutoReqProv: no
|
2013-02-18 00:10:17 +04:00
|
|
|
|
2021-06-11 18:38:23 +03:00
|
|
|
%if 0%{?rhel}%{?fedora}%{?suse_version}
|
|
|
|
# We don't directly use it, but if this isn't installed, rpmbuild as root can
|
|
|
|
# crash+corrupt rpmdb
|
|
|
|
# See issue #12071
|
|
|
|
BuildRequires: ncompress
|
|
|
|
%endif
|
|
|
|
|
2013-02-18 00:10:17 +04:00
|
|
|
%description
|
|
|
|
This package contains the dkms ZFS kernel modules.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n %{module}-%{version}
|
|
|
|
|
|
|
|
%build
|
|
|
|
%{mkconf} -n %{module} -v %{version} -f dkms.conf
|
|
|
|
|
|
|
|
%install
|
|
|
|
if [ "$RPM_BUILD_ROOT" != "/" ]; then
|
|
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
fi
|
|
|
|
mkdir -p $RPM_BUILD_ROOT/usr/src/
|
|
|
|
cp -rf ${RPM_BUILD_DIR}/%{module}-%{version} $RPM_BUILD_ROOT/usr/src/
|
|
|
|
|
|
|
|
%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
|
Fix missing dkms modules after upgrades
If you were upgrading from say, fc28->fc29, on ZFS version X, the RPMs
macros would get called like this:
%post X.fc29
- This is the step where fc29 gets built by dkms.
As part of the build, dkms automatically removes the previous
modules before building the new ones. It then builds the new
modules.
%preun X.fc28
- Right before this step, X.fc29 is be built and installed, but
since it has the same X, it's files get inadvertently removed
by fc28's uninstall.
%postun X.fc28
This patch updates %preun X.fc28 to see if we're upgrading or
uninstalling. If we're uninstalling, then remove our files. If we're
upgrading then do nothing, since will know dkms will have already
removed our files in %post X.fc29.
Note that since this fixes the %preun step, it's effect isn't going
to be noticed immediately. It will only be seen when packages
with this fix are upgraded to a newer version.
Reviewed-by: Ralf Ertzinger <ralf@skytale.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #6902
Closes #8216
2019-01-08 20:26:45 +03:00
|
|
|
# Are we doing an upgrade?
|
2019-09-04 01:20:39 +03:00
|
|
|
if [ "$1" = "1" -o "$1" = "upgrade" ] ; then
|
Fix missing dkms modules after upgrades
If you were upgrading from say, fc28->fc29, on ZFS version X, the RPMs
macros would get called like this:
%post X.fc29
- This is the step where fc29 gets built by dkms.
As part of the build, dkms automatically removes the previous
modules before building the new ones. It then builds the new
modules.
%preun X.fc28
- Right before this step, X.fc29 is be built and installed, but
since it has the same X, it's files get inadvertently removed
by fc28's uninstall.
%postun X.fc28
This patch updates %preun X.fc28 to see if we're upgrading or
uninstalling. If we're uninstalling, then remove our files. If we're
upgrading then do nothing, since will know dkms will have already
removed our files in %post X.fc29.
Note that since this fixes the %preun step, it's effect isn't going
to be noticed immediately. It will only be seen when packages
with this fix are upgraded to a newer version.
Reviewed-by: Ralf Ertzinger <ralf@skytale.net>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #6902
Closes #8216
2019-01-08 20:26:45 +03:00
|
|
|
# Yes we are. Are we upgrading to a new ZFS version?
|
|
|
|
NEWEST_VER=$(dkms status zfs | sed 's/,//g' | sort -r -V | awk '/installed/{print $2; exit}')
|
|
|
|
if [ "$NEWEST_VER" != "%{version}" ] ; then
|
|
|
|
# Yes, it's a new ZFS version. We'll uninstall the old module
|
|
|
|
# later on in this script.
|
|
|
|
true
|
|
|
|
else
|
|
|
|
# No, it's probably an upgrade of the same ZFS version
|
|
|
|
# to a new distro (zfs-dkms-0.7.12.fc28->zfs-dkms-0.7.12.fc29).
|
|
|
|
# Don't remove our modules, since the rebuild for the new
|
|
|
|
# distro will automatically delete the old modules.
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# If we're here then we're doing an uninstall (not upgrade).
|
2015-10-01 03:36:18 +03:00
|
|
|
CONFIG_H="/var/lib/dkms/%{module}/%{version}/*/*/%{module}_config.h"
|
|
|
|
SPEC_META_ALIAS="@PACKAGE@-@VERSION@-@RELEASE@"
|
|
|
|
DKMS_META_ALIAS=`cat $CONFIG_H 2>/dev/null |
|
2020-05-15 06:51:33 +03:00
|
|
|
awk -F'"' '/META_ALIAS\s+"/ { print $2; exit 0 }'`
|
2015-10-01 03:36:18 +03:00
|
|
|
if [ "$SPEC_META_ALIAS" = "$DKMS_META_ALIAS" ]; then
|
2014-05-30 00:36:24 +04:00
|
|
|
echo -e
|
2015-10-01 03:36:18 +03:00
|
|
|
echo -e "Uninstall of %{module} module ($SPEC_META_ALIAS) beginning:"
|
2017-10-15 23:00:44 +03:00
|
|
|
dkms remove -m %{module} -v %{version} --all %{!?not_rpm:--rpm_safe_upgrade}
|
2014-05-30 00:36:24 +04:00
|
|
|
fi
|
2013-02-18 00:10:17 +04:00
|
|
|
exit 0
|