weak-modules: add support for zstd compression for initramfs

* weak-modules (decompress_initramfs): Rewrite decompressing
of initramfs into a loop that iterates over different compression
programs, include zstd in the list.
* kmod.spec (Release): Bump to 11.
(%changelog): Add a record.

Resolves: RHEL-74288
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
This commit is contained in:
Eugene Syromiatnikov 2025-01-16 18:18:09 +01:00
parent ec1e060e0a
commit 9c37c7f5d4
2 changed files with 12 additions and 10 deletions

View File

@ -16,7 +16,7 @@
Name: kmod
Version: 31
Release: 10%{?dist}
Release: 11%{?dist}
Summary: Linux kernel module management utilities
# https://docs.fedoraproject.org/en-US/legal/license-field/#_no_effective_license_analysis
@ -196,6 +196,10 @@ install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/depmod.d/dist.conf
%{_libdir}/libkmod.so
%changelog
* Tue Jan 14 2025 Eugene Syromiatnikov <esyr@redhat.com> - 31-11
- Enable zstd compression support for initramfs in weak-modules
- Resolves: RHEL-74288
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 31-10
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018

View File

@ -129,6 +129,7 @@ read_modules_list() {
decompress_initramfs() {
local input=$1
local output=$2
local zcmd
# First, check if this is compressed at all
if cpio -i -t < "$input" > /dev/null 2>/dev/null; then
@ -146,15 +147,12 @@ decompress_initramfs() {
return 0
fi
# Try gzip
if gzip -cd < "$input" > "$output" 2>/dev/null ; then
return 0
fi
# Next try xz
if xz -cd < "$input" > "$output" 2>/dev/null ; then
# Try zstd/xz/gzip for decompressing
for zcmd in zstd xz gzip; do
if "$zcmd" -cd < "$input" > "$output" 2>/dev/null ; then
return 0
fi
done
echo "Unable to decompress $input: Unknown format" >&2
return 1