summaryrefslogtreecommitdiffstats
path: root/debian/kmod.postinst
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:03:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 17:03:56 +0000
commitad07a2b86334c23fe063be97e8dd44e586c324b4 (patch)
treebb0f3e91284adc84f813a6e46867915be34b704f /debian/kmod.postinst
parentAdding upstream version 31+20240202. (diff)
downloadkmod-ad07a2b86334c23fe063be97e8dd44e586c324b4.tar.xz
kmod-ad07a2b86334c23fe063be97e8dd44e586c324b4.zip
Adding debian version 31+20240202-2.debian/31+20240202-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/kmod.postinst')
-rw-r--r--debian/kmod.postinst39
1 files changed, 39 insertions, 0 deletions
diff --git a/debian/kmod.postinst b/debian/kmod.postinst
new file mode 100644
index 0000000..8602a33
--- /dev/null
+++ b/debian/kmod.postinst
@@ -0,0 +1,39 @@
+#!/bin/sh -e
+
+delete_old_etc_modules() {
+ # normalize the files by ignoring empty lines
+ local modules_hash="$(sed -e '/^$/d' /etc/modules | md5sum | cut -d ' ' -f1)"
+
+ case "$modules_hash" in
+ 330dcf902eae56682d44133c168fee89) ;;
+ 6e5894c5d926d1e69968e64e3ffa1cbd) ;;
+ *) return ;;
+ esac
+
+ # delete the unmodified /etc/modules
+ rm -f /etc/modules
+}
+
+create_etc_modules() {
+ [ -e /etc/modules ] && return 0
+ cat <<END > /etc/modules
+# /etc/modules is obsolete and has been replaced by /etc/modules-load.d/.
+# Please see modules-load.d(5) and modprobe.d(5) for details.
+#
+# Updating this file still works, but it is undocumented and unsupported.
+END
+ chmod 644 /etc/modules
+ if which restorecon > /dev/null 2>&1; then
+ restorecon /etc/modules
+ fi
+}
+
+case "$1" in
+ configure)
+ delete_old_etc_modules
+ create_etc_modules
+esac
+
+#DEBHELPER#
+
+exit 0