Fix zfs-dkms uninstall/update

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
This commit is contained in:
Brian Behlendorf 2015-09-30 20:36:18 -04:00
parent 919efe93cb
commit 3ef005c674
1 changed files with 6 additions and 5 deletions

View File

@ -62,12 +62,13 @@ echo -e "support or upgrade DKMS to a more current version."
exit 1 exit 1
%preun %preun
# Only remove the modules if they are for this %{version}-%{release}. A CONFIG_H="/var/lib/dkms/%{module}/%{version}/*/*/%{module}_config.h"
# package upgrade can replace them if only the %{release} is changed. SPEC_META_ALIAS="@PACKAGE@-@VERSION@-@RELEASE@"
RELEASE="/var/lib/dkms/%{module}/%{version}/build/%{module}.release" DKMS_META_ALIAS=`cat $CONFIG_H 2>/dev/null |
if [ -f $RELEASE ] && [ `cat $RELEASE`%{?dist} = "%{version}-%{release}" ]; then awk -F'"' '/META_ALIAS/ { print $2; exit 0 }'`
if [ "$SPEC_META_ALIAS" = "$DKMS_META_ALIAS" ]; then
echo -e 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 dkms remove -m %{module} -v %{version} --all --rpm_safe_upgrade
fi fi
exit 0 exit 0