From 094585790a07b94a92fe39053f2be252e532e096 Mon Sep 17 00:00:00 2001 From: Eugene Syromiatnikov Date: Tue, 9 May 2023 09:11:45 +0200 Subject: [PATCH] weak-modules: add symvers.xz support Check for symvers.xz support in addition to symvers.gz, due to unnanounced unilateral change[1][2] in the kernel packaging. [1] https://gitlab.com/cki-project/kernel-ark/-/commit/26446656572b8d5934f5d714b1fea76f3ed559c0 [2] https://src.fedoraproject.org/rpms/kernel/c/2db77a072a997c00ee63ddf38b79766699094f1c?branch=rawhide * weak-modules (make_kernel_file_names): Interpret all arguments after the second as a list of suffixes, iterate over them (find_kernel_file): Switch print and suffix arguments, interpret all argument after print as suffixes, pass them to make_kernel_file_names. (find_symvers_file): Update the order of arguments in the find_kernel_file call, add .xz suffix in addition to .gz. (find_systemmap_file): Update the order of arguments in the find_kernel_file call. Resolves: RHEL-8903 Signed-off-by: Eugene Syromiatnikov --- weak-modules | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/weak-modules b/weak-modules index 2b16275..2aeb9d4 100644 --- a/weak-modules +++ b/weak-modules @@ -520,26 +520,31 @@ finish_sandbox() { # Auxiliary functions to find symvers file make_kernel_file_names() { local krel="$1" - local file="$2" - local suffix="$3" + shift + local file="$1" + shift - echo "${BASEDIR}/boot/${file}-${krel}${suffix}" - echo "${BASEDIR}/lib/modules/${krel}/${file}${suffix}" + for suffix in "$@"; do + echo "${BASEDIR}/boot/${file}-${krel}${suffix}" + echo "${BASEDIR}/lib/modules/${krel}/${file}${suffix}" + done } find_kernel_file() { local krel="$1" - local file="$2" - local suffix="$3" - local print="$4" + shift + local file="$1" + shift + local print="$1" + shift local i if [[ "$print" != "" ]]; then - make_kernel_file_names "$krel" "$file" "$suffix" + make_kernel_file_names "$krel" "$file" "$@" return 0 fi - for i in $(make_kernel_file_names "$krel" "$file" "$suffix"); do + for i in $(make_kernel_file_names "$krel" "$file" "$@"); do if [[ -r "$i" ]]; then echo "$i" return 0 @@ -563,7 +568,7 @@ find_symvers_file() { local krel="$1" local print="$2" - find_kernel_file "$krel" symvers .gz "$print" + find_kernel_file "$krel" symvers "$print" .xz .gz } # find_systemmap_file: @@ -573,7 +578,7 @@ find_systemmap_file() { local print="$2" local no_suffix="" - find_kernel_file "$krel" System.map "$no_suffix" "$print" + find_kernel_file "$krel" System.map "$print" "$no_suffix" } #### Main logic