mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-29 18:00:18 +00:00
scripts/kernel-functions: Handle Rocky kernel rebuild tarballs
Rocky Linux kernel rebuilds can append an extra release suffix to the
source RPM name. For example, kernel-5.14.0-687.10.1.el9_8.0.1.src.rpm can
still contain a linux-5.14.0-687.10.1.el9_8.tar.* source archive.
The exact linux-${kver}*.tar.* match then fails before the source tree
can be extracted.
Look for the archive name again with a trailing .0.N rebuild suffix
removed and keep renaming the extracted tree to the full requested kernel
release, so later paths remain unchanged.
This commit is contained in:
@@ -860,6 +860,28 @@ function download_valid_rpm {
|
||||
return 1
|
||||
}
|
||||
|
||||
function extract_rhel_kernel_archive {
|
||||
local archive kver="$1" stripped_kver topdir
|
||||
|
||||
stripped_kver="${kver%.0.[0-9]*}"
|
||||
for archive in "linux-${kver}"*.tar.* \
|
||||
"linux-${stripped_kver}"*.tar.* linux-*.tar.*; do
|
||||
[ -e "$archive" ] || continue
|
||||
topdir="$(tar tf "$archive" | sed -n '1{s,/.*,,;p;}')" ||
|
||||
return $?
|
||||
if [ -z "$topdir" ]; then
|
||||
echo "Error: empty Linux source archive $archive." >&2
|
||||
return 1
|
||||
fi
|
||||
tar xaf "$archive" &&
|
||||
mv "$topdir" "../linux-${kver}"
|
||||
return $?
|
||||
done
|
||||
|
||||
echo "Error: no Linux source archive found for kernel $kver." >&2
|
||||
return 1
|
||||
}
|
||||
|
||||
function download_and_extract_distro_rpm {
|
||||
[ -n "$1" ] || return $?
|
||||
set -- ${1//^/ }
|
||||
@@ -898,12 +920,7 @@ function download_and_extract_distro_rpm {
|
||||
CentOS|AlmaLinux|RockyLinux|Rocky)
|
||||
rpm2cpio "${kernel_downloads}/kernel-${kver}.src.rpm" |
|
||||
cpio -i --make-directories --quiet &&
|
||||
tar xaf "linux-${kver}"*.tar.* &&
|
||||
if [ -e "linux-${kver}" ]; then
|
||||
mv "linux-${kver}" ..
|
||||
else
|
||||
mv "linux-${kver}"*[^z] "../linux-${kver}"
|
||||
fi
|
||||
extract_rhel_kernel_archive "$kver"
|
||||
;;
|
||||
UEK)
|
||||
rpm2cpio "${kernel_downloads}/kernel-uek-${kver}.src.rpm" |
|
||||
|
||||
Reference in New Issue
Block a user