void-packages/srcpkgs/dkms/files/kernel.d/dkms.prerm
2011-07-10 10:58:45 +02:00

21 lines
630 B
Bash

#!/bin/bash
# We're passed the version of the kernel being installed
PKGNAME="$1"
VERSION="$2"
if [ -x /usr/sbin/dkms ]; then
while read line; do
name=`echo "$line" | awk '{print $1}' | sed 's/,$//'`
vers=`echo "$line" | awk '{print $2}' | sed 's/,$//'`
arch=`echo "$line" | awk '{print $4}' | sed 's/:$//'`
echo "dkms: removing: $name $vers (${PKGNAME}-${VERSION}) ($arch)" >&2
dkms remove -q -m $name -v $vers -k ${VERSION} -a $arch
done < <(dkms status -k ${VERSION} 2>/dev/null | grep ": installed")
fi
rmdir \
"/lib/modules/${VERSION}/updates/dkms" \
"/lib/modules/${VERSION}/updates" 2>/dev/null
exit 0