mirror of
https://github.com/flatcar/scripts.git
synced 2026-02-12 03:01:46 +01:00
* oem-azure: add hyperv daemons This change adds hyperv daemons hv_fcopy, hv_kvp, and hv_vss to the Azure and HyperV OEM sysexts. hv_kvp specifically is needed to submit OS version information to the Azure hypervisor. The daemons, tough userspace programs, are built from the kernel sources as they are included in the Linux kernel. As the ebuild is (somewhat) kernel specific, it should be updated when the kernel is updated. Respective additions have been made to the kernel update GitHub actions automation. Signed-off-by: Thilo Fromm <thilofromm@microsoft.com> Co-authored-by: Mathieu Tortuyaux <mtortuyaux@microsoft.com>
89 lines
2.9 KiB
Bash
Executable File
89 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
source "${GHA_SCRIPTS_DIR}/.github/workflows/common.sh"
|
|
|
|
prepare_git_repo
|
|
|
|
if ! check_remote_branch "linux-${VERSION_NEW}-${TARGET_BRANCH}"; then
|
|
echo "remote branch already exists, nothing to do"
|
|
exit 0
|
|
fi
|
|
|
|
# Dive into ebuild repo section of SDK
|
|
pushd "${SDK_OUTER_OVERLAY}"
|
|
|
|
# trim the 3rd part in the input semver, e.g. from 5.4.1 to 5.4
|
|
VERSION_SHORT=${VERSION_NEW%.*}
|
|
VERSION_OLD=$(sed -n "s/^DIST patch-\(${VERSION_SHORT}\.[0-9]*\).*/\1/p" sys-kernel/coreos-sources/Manifest)
|
|
if [[ -z "${VERSION_OLD}" ]]; then
|
|
VERSION_OLD=$(sed -n "s/^DIST linux-\(${VERSION_SHORT}*\).*/\1/p" sys-kernel/coreos-sources/Manifest)
|
|
fi
|
|
if [[ "${VERSION_NEW}" = "${VERSION_OLD}" ]]; then
|
|
echo "already the latest Kernel, nothing to do"
|
|
exit 0
|
|
fi
|
|
|
|
for pkg in sources modules kernel; do
|
|
pushd "sys-kernel/coreos-${pkg}"
|
|
git mv "coreos-${pkg}"-*.ebuild "coreos-${pkg}-${VERSION_NEW}.ebuild"
|
|
sed -i -e '/^COREOS_SOURCE_REVISION=/s/=.*/=""/' "coreos-${pkg}-${VERSION_NEW}.ebuild"
|
|
popd
|
|
done
|
|
|
|
# Update hyperv daemons ebuild soft-link to reflect new kernel version
|
|
find -D exec app-emulation/hv-daemons/ -type l -exec rm '{}' \;
|
|
ln -s app-emulation/hv-daemons/hv-daemons-9999.ebuild \
|
|
app-emulation/hv-daemons/hv-daemons-${VERSION_NEW}.ebuild
|
|
|
|
# Leave ebuild repo section of SDK
|
|
popd
|
|
|
|
function get_lwn_link() {
|
|
local LINUX_VERSION="${1}"; shift
|
|
local url
|
|
|
|
if ! curl -sfA 'Chrome' -L 'http://www.google.com/search?hl=en&q=site%3Alwn.net+linux+'"${LINUX_VERSION}" -o search.html >&2; then
|
|
echo 'curl failed' >&2
|
|
touch search.html
|
|
fi
|
|
# can't use grep -m 1 -o … to replace head -n 1, because all the links
|
|
# seem to happen in one line, so grep prints all the links in the line
|
|
url=$({ grep -o 'https://lwn.net/Articles/[0-9]\+' search.html || true ; } | head -n 1)
|
|
if [[ ! "${url}" ]]; then
|
|
echo 'no valid links found in the search result' >&2
|
|
url="https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tag/?h=v${LINUX_VERSION}"
|
|
fi
|
|
rm search.html
|
|
echo "${url}"
|
|
}
|
|
|
|
PATCH_VERSION_OLD=${VERSION_OLD##*.}
|
|
PATCH_VERSION_NEW=${VERSION_NEW##*.}
|
|
|
|
PATCH_NUM=$((PATCH_VERSION_NEW - 1))
|
|
|
|
OLD_VERSIONS_AND_URLS=()
|
|
|
|
while [[ ${PATCH_NUM} -gt ${PATCH_VERSION_OLD} ]]; do
|
|
TMP_VERSION="${VERSION_SHORT}.${PATCH_NUM}"
|
|
TMP_URL=$(get_lwn_link "${TMP_VERSION}")
|
|
OLD_VERSIONS_AND_URLS+=( "${TMP_VERSION}" "${TMP_URL}" )
|
|
: $((PATCH_NUM--))
|
|
done
|
|
|
|
URL=$(get_lwn_link "${VERSION_NEW}")
|
|
|
|
generate_update_changelog 'Linux' "${VERSION_NEW}" "${URL}" 'linux' "${OLD_VERSIONS_AND_URLS[@]}"
|
|
|
|
commit_changes sys-kernel/coreos-sources "${VERSION_OLD}" "${VERSION_NEW}" \
|
|
sys-kernel/coreos-modules \
|
|
sys-kernel/coreos-kernel \
|
|
app-emulation/hv-daemons
|
|
|
|
cleanup_repo
|
|
|
|
echo "VERSION_OLD=${VERSION_OLD}" >>"${GITHUB_OUTPUT}"
|
|
echo 'UPDATE_NEEDED=1' >>"${GITHUB_OUTPUT}"
|