]> git.proxmox.com Git - mirror_spl.git/commitdiff
Fix spl-dkms uninstall/update
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 30 Sep 2015 16:26:21 +0000 (09:26 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 2 Oct 2015 18:17:22 +0000 (11:17 -0700)
Modern versions of dkms cleanup the build directory after installing.
This resulted in 'dkms uninstall' never running because the check
added by commit 4cdcdbf which verifies the existence of the
spl.release build product would never be true.

This patch resolves the issue by updating the conditional to check
in the explicitly installed spl_config.h file for the version.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #478

rpm/generic/spl-dkms.spec.in

index 6d8e058cb01acb3244c0700baf05bed2df683bfd..ac0ddd3693ee37222cbd1c49dfa6334a24961d51 100644 (file)
@@ -62,12 +62,13 @@ 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
+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 (version %{version}) beginning:"
+    echo -e "Uninstall of %{module} module ($SPEC_META_ALIAS) beginning:"
     dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
 fi
 exit 0