summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2014-05-29 13:36:24 -0700
committerBrian Behlendorf <[email protected]>2014-05-30 11:23:48 -0700
commit866c162340f3ff3810e2c5fcfd05f95446abd6c2 (patch)
tree5a76335fa08da00275b029cdd96a08fc37993310
parent79aada6105f3aa3698df28cc10fe30a51c5b47aa (diff)
Fix DKMS package upgrade and packager
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 <[email protected]>
-rw-r--r--rpm/generic/zfs-dkms.spec.in17
1 files changed, 12 insertions, 5 deletions
diff --git a/rpm/generic/zfs-dkms.spec.in b/rpm/generic/zfs-dkms.spec.in
index 412feaf63..a3388225c 100644
--- a/rpm/generic/zfs-dkms.spec.in
+++ b/rpm/generic/zfs-dkms.spec.in
@@ -1,3 +1,5 @@
+%{?!packager: %define packager Brian Behlendorf <[email protected]>}
+
%define module @PACKAGE@
%define mkconf scripts/dkms.mkconf
@@ -60,11 +62,16 @@ echo -e "support or upgrade DKMS to a more current version."
exit 1
%preun
-dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
+# 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
-* Wed Aug 21 2013 Brian Behlendorf <[email protected]> - 0.6.2-1
-- Released 0.6.2-1
-* Fri Mar 22 2013 Brian Behlendorf <[email protected]> - 0.6.1-1
-- First official stable release.
+* %(date "+%a %b %d %Y") %packager %{version}-%{release}
+- Automatic build by DKMS