mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 18:11:00 +03:00
3ef005c674
Modern versions of dkms cleanup the build directory after installing.
This resulted in 'dkms uninstall' never running because the check
added by commit 866c162
which verifies the existance of the
zfs.release build product would never be true.
This patch resolves the issue by updating the conditional to check
in the explicitly installed zfs_config.h file for the version.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3862
79 lines
2.1 KiB
RPMSpec
79 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
|
|
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 |
|
|
awk -F'"' '/META_ALIAS/ { print $2; exit 0 }'`
|
|
if [ "$SPEC_META_ALIAS" = "$DKMS_META_ALIAS" ]; then
|
|
echo -e
|
|
echo -e "Uninstall of %{module} module ($SPEC_META_ALIAS) 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
|