summaryrefslogtreecommitdiffstats
path: root/kernel_prerm.d_dkms
blob: aeb8e3a9daeb409af1bce6ef54858ab8573e947a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

# We're passed the version of the kernel being removed
inst_kern=$1

if command -v dkms > /dev/null; then
	dkms status -k "$inst_kern" 2>/dev/null | while IFS=",:/ " read -r name vers _ arch status; do
		[ "$status" = "installed" ] || continue
		echo "dkms: removing: $name $vers ($inst_kern) ($arch)" >&2
		dkms remove -m "$name" -v "$vers" -k "$inst_kern" -a "$arch"
	done
fi

rmdir --ignore-fail-on-non-empty \
	"/lib/modules/$inst_kern/updates/dkms" \
	"/lib/modules/$inst_kern/updates" 2>/dev/null

exit 0