# Get the package version, which is the version of openafs-modules-dkms
# without the dfsg part and without the Debian version.
package=openafs-modules-dkms
-version=`dpkg-query -W -f='${Version}' "$package" | sed 's/[.+-].*//'`
+version=`dpkg-query -W -f='${Version}' "$package" \
+ | sed -e 's/[+-].*//' -e 's/\.dfsg.*//' -e 's/~//g'`
dkms add -m openafs -v "$version"
if [ "$1" = 'configure' ] ; then
# without the dfsg part and without the Debian version. I hope this is always
# correct when running prerm and we won't get the new version.
package=openafs-modules-dkms
-version=`dpkg-query -W -f='${Version}' "$package" | sed 's/[.+-].*//'`
+version=`dpkg-query -W -f='${Version}' "$package" \
+ | sed -e 's/[+-].*//' -e 's/\.dfsg.*//' -e 's/~//g'`
dkms remove -m openafs -v "$version" --all