coreos/stage1_hooks: Add a hook for pulling a newer version of baselayout

Pull in a new version of baselayout to have a proper setup of lib
directories in stage1. The proper setup means that the `lib` entry is
now a directory instead of a symlink to `lib64`.

Honestly, when rewording this commit, I realized that this hook is not
really needed, as the updated baselayout ebuild just drops code that
became dead after the profile update that the other hook does. But I
decided to keep it as is, because the CI build with this hook has
passed, and this hook will be needed anyway by the weekly updates.
This commit is contained in:
Krzesimir Nowak 2023-03-01 18:30:58 +01:00
parent 2aaa89c91b
commit 98668d0281

View File

@ -0,0 +1,30 @@
#!/bin/bash
set -euo pipefail
stage1_repo="${1}"
new_repo="${2}"
good_version="3.6.8-r9"
stage1_version=''
for f in "${stage1_repo}/sys-apps/baselayout/baselayout-"*'.ebuild'; do
f="${f##*/}"
if [[ "${f}" = *9999* ]]; then continue; fi
f="${f%.ebuild}"
f="${f#baselayout-}"
stage1_version="${f}"
done
if [[ -z "${stage1_version}" ]]; then exit 1; fi
older_version=$(printf '%s\n' "${stage1_version}" "${good_version}" | sort -V | head -n 1)
if [[ "${older_version}" = "${good_version}" ]]; then
# Stage1 version is equal or newer than the good version, nothing
# to do.
exit 0
fi
rm -rf "${stage1_repo}/sys-apps/baselayout"
cp -a "${new_repo}/sys-apps/baselayout" "${stage1_repo}/sys-apps/baselayout"