void-packages/srcpkgs/dkms/files/kernel.d/dkms.prerm

20 lines
549 B
Bash

#!/bin/sh
# We're passed the version of the kernel being removed
PKGNAME="$1"
VERSION="$2"
if [ -x /usr/bin/dkms ]; then
/usr/bin/dkms status -k "$VERSION" 2>/dev/null | while IFS=" ,:/" read -r name vers _ arch status; do
[ "$status" = installed ] || continue
echo "dkms: removing: $name $vers ($PKGNAME-$VERSION) ($arch)" >&2
/usr/bin/dkms remove -q -m "$name" -v "$vers" -k "$VERSION" -a "$arch"
done
fi
rmdir 2>/dev/null \
"/lib/modules/$VERSION/updates/dkms" \
"/lib/modules/$VERSION/updates"
exit 0