mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
866c162340
Running 'yum upgrade zfs-dkms' package could appear to work properly and still leave you with no zfs modules installed. This will occur when only the zfs release, and not the version, are incremented. This may be the case for a fast moving zfs-testing repository. During the upgrade process DKMS will realize that zfs-x.y.z is already installed and remove it. DKMS then correctly builds the new modules for zfs-x.y.z. However, as a final step when the old zfs-x.y.z-r is removed the %preun script runs and removes the newly build modules. To handle this case the %preun script has been updated to only run when the installed version exactly matches the full spec file version. This change also updated ChangeLog section based on the DKMS reference spec file. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
78 lines
2.1 KiB
RPMSpec
78 lines
2.1 KiB
RPMSpec
%{?!packager: %define packager Brian Behlendorf <behlendorf1@llnl.gov>}
|
|
|
|
%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: http://zfsonlinux.org/
|
|
Source0: %{module}-%{version}.tar.gz
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|
BuildArch: noarch
|
|
|
|
Requires: dkms >= 2.2.0.3-20
|
|
Requires: spl-dkms = %{version}
|
|
Requires: gcc, make, perl
|
|
Requires: kernel-devel
|
|
Provides: %{module}-kmod = %{version}
|
|
|
|
%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
|
|
# Only remove the modules if they are for this %{version}-%{release}. A
|
|
# package upgrade can replace them if only the %{release} is changed.
|
|
RELEASE="/var/lib/dkms/%{module}/%{version}/build/%{module}.release"
|
|
if [ -f $RELEASE ] && [ `cat $RELEASE`%{?dist} = "%{version}-%{release}" ]; then
|
|
echo -e
|
|
echo -e "Uninstall of %{module} module (version %{version}) beginning:"
|
|
dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
|
|
fi
|
|
exit 0
|
|
|
|
%changelog
|
|
* %(date "+%a %b %d %Y") %packager %{version}-%{release}
|
|
- Automatic build by DKMS
|