From ddbf84ed1343de86ad4f69104277ba3f23048821 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Sun, 9 Jan 2022 22:20:03 +0000 Subject: [PATCH] import redhat-rpm-config-128-1.el8 --- SOURCES/modalias.prov | 28 +++++++++++++++------------- SPECS/redhat-rpm-config.spec | 6 +++++- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/SOURCES/modalias.prov b/SOURCES/modalias.prov index c5eda32..022c4f0 100644 --- a/SOURCES/modalias.prov +++ b/SOURCES/modalias.prov @@ -1,4 +1,4 @@ -#! /bin/sh +#! /bin/bash -efu # heavily based upon find-suggests.ksyms by Andreas Gruenbacher . # with modifications by Michael Brown @@ -14,7 +14,8 @@ IFS=$'\n' # completeness, so that we can determine when drivers are folded into # mainline kernel. # -case "$1" in +is_kernel_package="" +case "${1:-}" in kernel-module-*) ;; # Fedora kernel module package names start with # kernel-module. kernel*) is_kernel_package=1 ;; @@ -25,6 +26,11 @@ if ! [ -z "$is_kernel_package" ]; then exit 0 fi +# Check for presence of the commands used +which /sbin/modinfo >/dev/null || exit 0 +which sed >/dev/null || exit 0 +which sort >/dev/null || exit 0 + print_modaliases() { declare class=$1 variants=$2 pos=$3 if [ -n "$variants" ]; then @@ -35,7 +41,7 @@ print_modaliases() { } combine_modaliases() { - declare tag class variants pos n + declare tag class variants="" pos="" n read class while read tag; do for ((n=0; n<${#class}; n++)); do @@ -58,19 +64,15 @@ combine_modaliases() { print_modaliases "$class" "$variants" "$pos" } -for module in $(grep -E '/lib/modules/.+\.ko$') $*; do +for module in $(grep -E '/lib/modules/.+\.ko(\.gz|\.bz2|\.xz)?$') "$@"; do # | head -n1 because some modules have *two* version tags. *cough*b44*cough* modver=$(/sbin/modinfo -F version "$module"| head -n1) - modver=${modver// /_} - + modver=${modver//[^0-9a-zA-Z._]/_} # only add version tag if it has a version - if [ -n "$modver" ]; then - /sbin/modinfo -F alias "$module" \ - | sed -nre "s,(.+),modalias(\\1) = $modver,p" - else - /sbin/modinfo -F alias "$module" \ - | sed -nre "s,(.+),modalias(\\1),p" - fi + [ -z "$modver" ] || modver=" = $modver" + + /sbin/modinfo -F alias "$module" \ + | sed -nre "s,[^][0-9a-zA-Z._:*?/-],_,g; s,(.+),modalias(\\1)$modver,p" done \ | sort -u \ | combine_modaliases diff --git a/SPECS/redhat-rpm-config.spec b/SPECS/redhat-rpm-config.spec index 8a56f2e..f6f0476 100644 --- a/SPECS/redhat-rpm-config.spec +++ b/SPECS/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 127 +Version: 128 Release: 1%{?dist} # No version specified. License: GPL+ @@ -210,6 +210,10 @@ install -p -m 755 %{SOURCE21} %{buildroot}%{_rpmconfigdir}/kabi.sh %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Wed Jan 05 2022 Eugene Syromiatnikov - 128-1 +- modalias.prov: handle compressed kmods, sanitise alias/version strings + (#1976000) + * Mon Dec 13 2021 Michal Domonkos - 127-1 - Add Requires: glibc-gconv-extras to cover for the split (#2013328)