summaryrefslogtreecommitdiffstats
path: root/debian/dkms.postinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:40:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 07:40:51 +0000
commit017870ebf041f17c3a8fa10e97d010701431d14b (patch)
tree370430da4af7aa2682815861078f5bd1c9821b90 /debian/dkms.postinst
parentAdding upstream version 3.0.13. (diff)
downloaddkms-debian/3.0.13-1.tar.xz
dkms-debian/3.0.13-1.zip
Adding debian version 3.0.13-1.debian/3.0.13-1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/dkms.postinst')
-rw-r--r--debian/dkms.postinst57
1 files changed, 57 insertions, 0 deletions
diff --git a/debian/dkms.postinst b/debian/dkms.postinst
new file mode 100644
index 0000000..8582961
--- /dev/null
+++ b/debian/dkms.postinst
@@ -0,0 +1,57 @@
+#!/bin/sh
+set -e
+
+#DEBHELPER#
+
+if dpkg --compare-versions "$2" lt-nl "3.0.3-3~" ; then
+ for d in /etc/dkms/template-dkms-mkdeb/debian /etc/dkms/template-dkms-mkdeb /etc/dkms/template-dkms-mkbmdeb/debian /etc/dkms/template-dkms-mkbmdeb
+ do
+ test ! -d $d || rmdir --ignore-fail-on-non-empty $d
+ done
+fi
+
+if dpkg --compare-versions "$2" lt-nl "3.0.10-8~" ; then
+ for f in /boot/*.old-dkms
+ do
+ test ! -f "$f" || rm -fv "$f"
+ done
+fi
+
+if dpkg --compare-versions "$2" lt-nl "3.0.12" ; then
+ for d in /lib/modules/*
+ do
+ # clean up leftover depmod files if modules.dep is empty
+ # i.e. dkms called depmod after removing the last kernel module
+ if [ -f "$d/modules.dep" ] && [ ! -s "$d/modules.dep" ]; then
+ rm -fv \
+ "$d/modules.alias" \
+ "$d/modules.dep" \
+ "$d/modules.devname" \
+ "$d/modules.softdep" \
+ "$d/modules.symbols" \
+ "$d"/modules.*.bin
+ rmdir --ignore-fail-on-non-empty "$d"
+ test -d "$d" || echo "removed directory $d"
+ fi
+ done
+fi
+
+if dpkg --compare-versions "$2" lt-nl "3.0.12-2~" ; then
+ # missing $arch in the path, #1036033
+ rm -rfv /var/lib/dkms/*/*/[1-6].*/module/
+ rm -rfv /var/lib/dkms/*/*/[1-6].*/log/
+
+ # /usr/src/$module-$version was already removed,
+ # but /var/lib/dkms/$module/$version/source still points there
+ for source in /var/lib/dkms/*/*/source
+ do
+ test -h "$source" || continue
+ test -f "$source/dkms.conf" || rm -fv "$source"
+ done
+
+ for mdir in /var/lib/dkms/*/
+ do
+ test -d "$mdir" || continue
+ find "$mdir" -depth -type d -exec sh -c 'd="{}"; rmdir --ignore-fail-on-non-empty "$d" ; test -d "$d" || echo "removed directory $d"' \;
+ done
+fi