Merge pull request #1372 from anatasluo/master

kpatch-build: add support for OpenCloudOS
This commit is contained in:
Joe Lawrence 2024-03-26 09:17:18 -04:00 committed by GitHub
commit b363972b79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 1 deletions

View File

@ -71,6 +71,7 @@ declare -rA SUPPORTED_DEB_DISTROS=(
["ubuntu"]="Ubuntu OS")
declare -rA SUPPORTED_RPM_DISTROS=(
["opencloudos"]="OpenCloudOS"
["anolis"]="Anolis OS"
["centos"]="CentOS"
["fedora"]="Fedora"
@ -994,6 +995,8 @@ else
# openEuler has two directories with the same content after 'rpm -D'
# openEuler 21.09 has linux-* and linux-*-source while openEuler 20.03 has linux-* and linux-*-Source
mv "$RPMTOPDIR"/BUILD/kernel-*/linux-*[sS]ource "$KERNEL_SRCDIR" 2>&1 | logger || die
elif [[ "$DISTRO" = opencloudos ]]; then
mv "$RPMTOPDIR"/BUILD/kernel-*/kernel-* "$KERNEL_SRCDIR" 2>&1 | logger || die
elif [[ "$DISTRO" = photon ]]; then
# Photon has some files that are copied over during the build section of the spec file (instead of prep)
# These change occasionally, so check they exist before copying
@ -1022,7 +1025,7 @@ else
echo "$ARCHVERSION" > "$VERSIONFILE" || die
if [[ "$DISTRO" = openEuler ]]; then
if [[ "$DISTRO" = openEuler ]] || [[ "$DISTRO" = opencloudos ]]; then
[[ -z "$CONFIGFILE" ]] && CONFIGFILE="/boot/config-${ARCHVERSION}"
elif [[ "$DISTRO" = photon ]]; then
[[ -z "$CONFIGFILE" ]] && CONFIGFILE="$KERNEL_SRCDIR/$SRC_CFG"

View File

@ -120,6 +120,19 @@ kpatch_photon_dependencies()
fi
}
kpatch_opencloudos_dependencies()
{
local kernel_version
local arch
kernel_version=$(uname -r)
arch=$(uname -m)
sudo yum install -y make gcc patch bison flex openssl-devel dwarves dnf-utils \
rpm-build dnf-plugins-core python3-devel openssl-devel ncurses-devel elfutils-libelf-devel
sudo yum install -y "kernel-debuginfo-${kernel_version%.*}"\
"kernel-devel-${kernel_version%.*}"
sudo yum-builddep -y "kernel-${kernel_version}*"
}
kpatch_anolis_dependencies()
{
local kernel_version