From de8a7351cb2710fc70096100b5a5c315d05d894c Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Tue, 3 Nov 2009 21:44:55 -0800 Subject: [PATCH] Remove the openafs module from DKMS if necessary before adding * In the postinst of openafs-modules-dkms, if the openafs module is already added in DKMS, try to remove it first before adding it. This should more correctly handle the case of a user installing this package without the correct kernel headers, having it fail in postinst, and then installing the correct headers and having dpkg attempt to configure the package again. Thanks, Philipp Kaluza. (Closes: #553542) (cherry picked from commit c07b0b751d7e768a50f3594e13c8221a304bb455) --- debian/openafs-modules-dkms.postinst | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/openafs-modules-dkms.postinst b/debian/openafs-modules-dkms.postinst index 24bbe0db9..556dbf710 100644 --- a/debian/openafs-modules-dkms.postinst +++ b/debian/openafs-modules-dkms.postinst @@ -7,6 +7,13 @@ package=openafs-modules-dkms version=`dpkg-query -W -f='${Version}' "$package" \ | sed -e 's/[+-].*//' -e 's/\.dfsg.*//' -e 's/~//g'` +# If someone installed this package without the necessary kernel headers, the +# postinst will fail. If they then fix this problem, the postinst will keep +# failing since the dkms add cannot be run twice. Try to detect this +# situation and remove and re-add the module. +if [ -e "/var/lib/dkms/openafs/$version" ] ; then + dkms remove -m openafs -v "$version" --all || true +fi dkms add -m openafs -v "$version" if [ "$1" = 'configure' ] ; then dkms build -m openafs -v "$version" -- 2.39.5