21 lines
660 B
Bash
Executable File
21 lines
660 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# We're passed the version of the kernel being removed
|
|
inst_kern=$1
|
|
|
|
if [ -x /usr/sbin/dkms ]; then
|
|
while read line; do
|
|
name=`echo "$line" | awk '{print $1}' | sed 's/,$//' | cut -d'/' -f1`
|
|
vers=`echo "$line" | awk '{print $1}' | sed 's/,$//' | cut -d'/' -f2`
|
|
arch=`echo "$line" | awk '{print $3}' | sed 's/:$//'`
|
|
echo "dkms: removing: $name $vers ($inst_kern) ($arch)" >&2
|
|
dkms remove -m $name -v $vers -k $inst_kern -a $arch
|
|
done < <(dkms status -k $inst_kern 2>/dev/null | grep ": installed")
|
|
fi
|
|
|
|
rmdir --ignore-fail-on-non-empty \
|
|
"/lib/modules/$inst_kern/updates/dkms" \
|
|
"/lib/modules/$inst_kern/updates" 2>/dev/null
|
|
|
|
exit 0
|