From 1bc3b66535afd977583e2633fb74bf2d9e2de699 Mon Sep 17 00:00:00 2001 From: Jan Musial Date: Fri, 6 Aug 2021 15:44:58 +0200 Subject: [PATCH] On SLES run depmod for every kernel version for which the modules installed Signed-off-by: Jan Musial --- tools/pckgen.d/rpm/CAS_NAME.spec | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/pckgen.d/rpm/CAS_NAME.spec b/tools/pckgen.d/rpm/CAS_NAME.spec index a3b8fc7..e29aaca 100644 --- a/tools/pckgen.d/rpm/CAS_NAME.spec +++ b/tools/pckgen.d/rpm/CAS_NAME.spec @@ -86,15 +86,21 @@ fi %post modules_%{kver_filename} depmod . /etc/os-release +# Determine the exact location of installed modules to add them to weak-modules +for file in $(rpm -ql $(rpm -qa | grep -modules)); do +if [[ "$file" =~ cas_.*\.ko$ ]]; then + # realpath to resolve any possible symlinks (needed for weak-modules) + modules+=( $(realpath "$file") ) +fi +done + if [[ ! "$ID_LIKE" =~ suse|sles ]]; then - # Determine the exact location of installed modules to add them to weak-modules - for file in $(rpm -ql $(rpm -qa | grep -modules)); do - if [[ "$file" =~ cas_.*\.ko$ ]]; then - # realpath to resolve any possible symlinks (needed for weak-modules) - modules+=( $(realpath "$file") ) - fi - done printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --add-modules +else + for version in $(echo "${modules[@]}" | tr " " "\n" | cut -d"/" -f4 | sort | uniq); do + # run depmod for all kernel versions for which the modules installed + depmod $version + done fi %preun modules_%{kver_filename}