mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 11:29:36 +03:00
063c83a853
Two problems led to unexpected behaviour of the scriptlets: 1) Newer DKMS versions change the formatting of "dkms status": (old) zfs, 2.1.2, 5.14.10-300.fc35.x86_64, x86_64: installed (new) zfs/2.1.2, 5.14.10-300.fc35.x86_64, x86_64: installed Which broke a conditional determining whether to uninstall. 2) zfs_config.h not packaged properly, but was attempted to be read in the %preun scriptlet: CONFIG_H="/var/lib/dkms/zfs/2.1.2/*/*/zfs_config.h" Which broke the uninstallation of the module, which left behind a dangling symlink, which broke DKMS entirely with this error: Error! Could not locate dkms.conf file. File: /var/lib/dkms/zfs/2.1.1/source/dkms.conf does not exist. This change attempts to simplify life by: * Avoiding parsing anything (less prone to future breakage) * Uses %posttrans instead of %post for module installation, because %post happens before %preun, while %posttrans happens afterwards * Unconditionally reinstall module on upgrade, which is less efficient but the trade-off is that it's more reliable Alternative approaches could involve fixing the existing parsing bugs or improving the logic, but this comes at the cost of complexity and possible future bugs. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Jeremy Visser <jeremyvisser@google.com> Closes #10463 Closes #13182
77 lines
2.0 KiB
RPMSpec
77 lines
2.0 KiB
RPMSpec
%{?!packager: %define packager Brian Behlendorf <behlendorf1@llnl.gov>}
|
|
|
|
%if ! 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
|
|
%define not_rpm 1
|
|
%endif
|
|
|
|
# Exclude input files from mangling
|
|
%global __brp_mangle_shebangs_exclude_from ^/usr/src/.*$
|
|
|
|
%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@
|
|
URL: https://github.com/openzfs/zfs
|
|
Source0: %{module}-%{version}.tar.gz
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|
BuildArch: noarch
|
|
|
|
Requires: dkms >= 2.2.0.3
|
|
Requires(post): dkms >= 2.2.0.3
|
|
Requires(preun): dkms >= 2.2.0.3
|
|
Requires: gcc, make, perl, diffutils
|
|
Requires(post): gcc, make, perl, diffutils
|
|
%if 0%{?rhel}%{?fedora}%{?mageia}%{?suse_version}
|
|
Requires: kernel-devel >= @ZFS_META_KVER_MIN@, kernel-devel <= @ZFS_META_KVER_MAX@.999
|
|
Requires(post): kernel-devel >= @ZFS_META_KVER_MIN@, kernel-devel <= @ZFS_META_KVER_MAX@.999
|
|
Obsoletes: spl-dkms
|
|
%endif
|
|
Provides: %{module}-kmod = %{version}
|
|
AutoReqProv: no
|
|
|
|
%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
|
|
|
|
%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}
|
|
|
|
%preun
|
|
dkms remove -m %{module} -v %{version} --all
|
|
|
|
%posttrans
|
|
/usr/lib/dkms/common.postinst %{module} %{version}
|
|
|