mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-22 23:11:07 +02:00
sys-kernel/coreos-sources: Add script to revbump and update patches
This commit is contained in:
parent
e9a8442351
commit
c40a789795
@ -19,8 +19,6 @@ PATCH_DIR="${FILESDIR}/${KV_MAJOR}.${KV_MINOR}"
|
||||
# applied _after_ a potential patch-${KV}.patch file, present when building a
|
||||
# patchlevel revision. We mustn't apply our patches first, it fails when the
|
||||
# local patches overlap with the upstream patch.
|
||||
|
||||
# in $PATCH_DIR: ls -1 | sed -e 's/^/\t${PATCH_DIR}\//g' -e 's/$/ \\/g'
|
||||
UNIPATCH_LIST="
|
||||
${PATCH_DIR}/z0001-Add-secure_modules-call.patch \
|
||||
${PATCH_DIR}/z0002-PCI-Lock-down-BAR-access-when-module-security-is-ena.patch \
|
||||
|
53
sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/revbump.sh
vendored
Executable file
53
sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/revbump.sh
vendored
Executable file
@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
# Update patches from directory containing `git format-patch` output and
|
||||
# rename ebuild for new PVR.
|
||||
|
||||
set -e
|
||||
|
||||
new_pvr="$1"
|
||||
srcdir="$2"
|
||||
|
||||
if [[ -z "${new_pvr}" || -z "${srcdir}" ]]; then
|
||||
echo "Usage: $0 <new-PVR> <dir-with-git-format-patch-output>"
|
||||
echo "Example: $0 4.9.9-r2 ~/coreos/linux"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
old_ebuild=$(echo coreos-sources-*.ebuild)
|
||||
new_ebuild="coreos-sources-${new_pvr}.ebuild"
|
||||
|
||||
if [[ "${old_ebuild}" = 'coreos-sources-*.ebuild' ]]; then
|
||||
echo "Must be run from the coreos-sources directory."
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f "${old_ebuild}" ]]; then
|
||||
echo "Multiple ebuilds in coreos-sources directory. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
if [[ "${old_ebuild}" = "${new_ebuild}" ]]; then
|
||||
echo "New PVR must be different from old one."
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -f $(echo "${srcdir}"/0001*.patch) ]]; then
|
||||
echo "${srcdir} contains no patch files."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
old_kernrelease=$(echo "${old_ebuild}" | cut -f3 -d- | cut -f1-2 -d.)
|
||||
new_kernrelease=$(echo "${new_pvr}" | cut -f1 -d- | cut -f1-2 -d.)
|
||||
|
||||
awk '{print} /UNIPATCH_LIST/ {exit 0}' "${old_ebuild}" > "${new_ebuild}"
|
||||
|
||||
rm -rf "files/${old_kernrelease}" "files/${new_kernrelease}"
|
||||
mkdir "files/${new_kernrelease}"
|
||||
pushd "files/${new_kernrelease}" >/dev/null
|
||||
mv "${srcdir}"/[0-9]*.patch .
|
||||
for f in [0-9]*.patch; do
|
||||
mv "$f" "z$f"
|
||||
done
|
||||
ls z[0-9]*.patch | sed -e 's/^/\t${PATCH_DIR}\//g' -e 's/$/ \\/g' >> \
|
||||
"../../${new_ebuild}"
|
||||
popd >/dev/null
|
||||
|
||||
echo '"' >> "${new_ebuild}"
|
||||
rm "${old_ebuild}"
|
Loading…
x
Reference in New Issue
Block a user