mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-02 10:12:33 +00:00
The apply_patches.sh script applies all patches in the patches directory, as well as subdirectories. This means if there is a sub-dir called "experimental" under a major kernel version directory, experimental patches would be applied to the default kernel supported by Kata. We did not come accross this issue earlier as typically the experimental kernel version was different from the default kernel. With both the default kernel and the arm-experimental kernel having the same major kernel version (5.15.x) at this time, trying to update the kernel patch version revealed that arm-experimental patches were being applied to the default kernel. Restricting the patches to be applied to the top level directory will solve the issue. The apply_patches script should ignore any sub-directories meant for experimental patches. Fixes #4520 Signed-off-by: Archana Shinde <archana.m.shinde@intel.com>
51 lines
1.3 KiB
Bash
Executable File
51 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright (c) 2020 Red Hat, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# This script apply patches.
|
|
#
|
|
set -e
|
|
|
|
script_dir="$(realpath $(dirname $0))"
|
|
patches_dir="$1"
|
|
|
|
if [ -z "$patches_dir" ]; then
|
|
cat <<-EOF
|
|
Apply patches to the sources at the current directory.
|
|
|
|
Patches are expected to be named in the standard git-format-patch(1) format where
|
|
the first part of the filename represents the patch ordering (lowest numbers
|
|
apply first):
|
|
'NUMBER-DASHED_DESCRIPTION.patch'
|
|
|
|
For example,
|
|
|
|
0001-fix-the-bad-thing.patch
|
|
0002-improve-the-fix-the-bad-thing-fix.patch
|
|
0003-correct-compiler-warnings.patch
|
|
|
|
Usage:
|
|
$0 PATCHES_DIR
|
|
Where:
|
|
PATCHES_DIR is the directory containing the patches
|
|
EOF
|
|
exit 1
|
|
fi
|
|
|
|
echo "INFO: Apply patches from $patches_dir"
|
|
if [ -d "$patches_dir" ]; then
|
|
patches=($(find "$patches_dir" -maxdepth 1 -name '*.patch'|sort -t- -k1,1n))
|
|
echo "INFO: Found ${#patches[@]} patches"
|
|
for patch in ${patches[@]}; do
|
|
echo "INFO: Apply $patch"
|
|
patch -p1 < "$patch" || \
|
|
{ echo >&2 "ERROR: Not applied. Exiting..."; exit 1; }
|
|
done
|
|
else
|
|
echo "INFO: Patches directory does not exist: ${patches_dir}"
|
|
echo "INFO: Create a ${patches_dir}/no_patches.txt file if the current version has no patches"
|
|
exit 1;
|
|
fi
|