Merge pull request #618 from rafalste/fix_weak_modules_path_resolving

Fix resolving modules path for weak-modules
This commit is contained in:
Robert Baldyga 2021-01-07 14:26:14 +01:00 committed by GitHub
commit 9f23f47c9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,15 +84,32 @@ fi
depmod
. /etc/os-release
if [[ ! "$ID_LIKE" =~ suse|sles ]]; then
modules=( $(realpath $(modinfo -F filename cas_cache cas_disk)) )
# Determine the exact location of installed modules to add them to weak-modules
for file in $(rpm -ql $(rpm -qa | grep <CAS_NAME>-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
fi
%preun modules_%{kver_filename}
if [ $1 -eq 0 ]; then
. /etc/os-release
if [[ ! "$ID_LIKE" =~ suse|sles ]]; then
# Search for all CAS modules to remove them from weak-modules
find /lib/modules/*/extra/ -name "cas_*.ko" >/var/run/rpm-open-cas-linux-modules
fi
fi
%postun modules_%{kver_filename}
if [ $1 -eq 0 ]; then
. /etc/os-release
if [[ ! "$ID_LIKE" =~ suse|sles ]]; then
modules=( $(realpath $(modinfo -F filename cas_cache cas_disk 2>/dev/null)) )
# realpath to resolve any possible symlinks (needed for weak-modules)
modules=( $(realpath $(cat /var/run/rpm-open-cas-linux-modules)) )
rm -f /var/run/rpm-open-cas-linux-modules
printf "%s\n" "${modules[@]}" | weak-modules --no-initramfs --remove-modules
fi
depmod
@ -134,6 +151,8 @@ fi
%changelog
* Tue Jan 5 2021 Rafal Stefanowski <rafal.stefanowski@intel.com> - 20.12-1
- Fix resolving modules path for weak-modules
* Fri Sep 11 2020 Rafal Stefanowski <rafal.stefanowski@intel.com> - 20.09-1
- SLES related modifications
- Add some missing info about a package