+%postun debug-devel
+rmdir %{_prefix}/src/@PACKAGE@-%{version}-@ZFS_META_RELEASE@ 2>/dev/null
+exit 0
+
+%endif
+%if %{?with_kernel_dkms}
+
+%files dkms
+%defattr(-,root,root)
+%{_prefix}/src/@PACKAGE@-%{version}
+
+%post dkms
+for POSTINST in %{_prefix}/lib/dkms/common.postinst; do
+ if [ -f $POSTINST ]; then
+ $POSTINST @PACKAGE@ %{version}
+ exit $?
+ fi
+ echo "WARNING: $POSTINST does not exist."
+done
+echo -e "ERROR: DKMS version is too old and @PACKAGE@ was not"
+echo -e "built with legacy DKMS support."
+echo -e "You must either rebuild @PACKAGE@ with legacy postinst"
+echo -e "support or upgrade DKMS to a more current version."
+exit 1
+
+%preun dkms
+echo -e
+echo -e "Uninstall of @PACKAGE@ module (version %{version}) beginning:"
+dkms remove -m @PACKAGE@ -v %{version} --all --rpm_safe_upgrade
+exit 0
+