summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Skarbek <[email protected]>2021-04-07 19:17:39 +0200
committerBrian Behlendorf <[email protected]>2021-04-14 13:19:49 -0700
commit96e15d29fab03e2876654c42702b81d3b0b14303 (patch)
tree542dc0b91305e301f258217ca8ae9560df50f621
parentbb8db9d9277094142f829f0407713807e29a802a (diff)
Add kmodtool fix to detect different System.map location
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Marcin Skarbek <[email protected]> Closes #7807 Closes #11836
-rwxr-xr-xscripts/kmodtool16
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/kmodtool b/scripts/kmodtool
index 240cde310..35d54bad2 100755
--- a/scripts/kmodtool
+++ b/scripts/kmodtool
@@ -182,9 +182,21 @@ BuildRequires: kernel-devel-uname-r = ${kernel_uname_r}
%{?KmodsRequires:Requires: %{KmodsRequires}-uname-r = ${kernel_uname_r}}
%{?KmodsRequires:BuildRequires: %{KmodsRequires}-uname-r = ${kernel_uname_r}}
%post -n kmod-${kmodname}-${kernel_uname_r}
-${prefix}${depmod_path} -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} > /dev/null || :
+if [[ -f "/boot/System.map-${kernel_uname_r}" ]]; then
+ ${prefix}${depmod_path} -aeF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} > /dev/null || :
+elif [[ -f "/lib/modules/${kernel_uname_r}/System.map" ]]; then
+ ${prefix}${depmod_path} -aeF /lib/modules/${kernel_uname_r}/System.map ${kernel_uname_r} > /dev/null || :
+else
+ ${prefix}${depmod_path} -ae ${kernel_uname_r} &> /dev/null || :
+fi
%postun -n kmod-${kmodname}-${kernel_uname_r}
-${prefix}${depmod_path} -aF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} &> /dev/null || :
+if [[ -f "/boot/System.map-${kernel_uname_r}" ]]; then
+ ${prefix}${depmod_path} -aF /boot/System.map-${kernel_uname_r} ${kernel_uname_r} &> /dev/null || :
+elif [[ -f "/lib/modules/${kernel_uname_r}/System.map" ]]; then
+ ${prefix}${depmod_path} -aF /lib/modules/${kernel_uname_r}/System.map ${kernel_uname_r} &> /dev/null || :
+else
+ ${prefix}${depmod_path} -a ${kernel_uname_r} &> /dev/null || :
+fi
EOF
else