summaryrefslogtreecommitdiffstats
path: root/kernel_prerm.d_dkms.in
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:40:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:40:50 +0000
commit10b5bfdee99e8161f353593ee3e85f4775b1dedc (patch)
tree958ac703fcfc692348b1564f02317e9f2ca67fd5 /kernel_prerm.d_dkms.in
parentInitial commit. (diff)
downloaddkms-upstream.tar.xz
dkms-upstream.zip
Adding upstream version 3.0.13.upstream/3.0.13upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'kernel_prerm.d_dkms.in')
-rwxr-xr-xkernel_prerm.d_dkms.in27
1 files changed, 27 insertions, 0 deletions
diff --git a/kernel_prerm.d_dkms.in b/kernel_prerm.d_dkms.in
new file mode 100755
index 0000000..cbf0c94
--- /dev/null
+++ b/kernel_prerm.d_dkms.in
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+# This script is triggered when the kernel (linux-image) package is being
+# removed. 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
+ # Compromise on using 'unbuild' to remove the module when a
+ # kernel is being removed. The 'remove' command is too
+ # destructive. The 'uninstall' command leaves built files
+ # around that have no other trigger to 'unbuild' them.
+ # (Triggering 'unbuild' on kernel header removal would not be
+ # a good idea because that would also cause the module to be
+ # uninstalled for the kernel, even though only the headers are
+ # being removed.)
+ dkms unbuild -m "$name" -v "$vers" -k "$inst_kern" -a "$arch"
+ done
+fi
+
+rmdir --ignore-fail-on-non-empty \
+ "@MODDIR@/$inst_kern/updates/dkms" \
+ "@MODDIR@/$inst_kern/updates" 2>/dev/null
+
+exit 0