From 1ad0ce9964cfd5914e387b1e92bae1f99ebbd7e0 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Tue, 7 Mar 2023 17:34:12 +0100 Subject: [PATCH] coreos/stage1_hooks: Add a hook for updating a profile in stage1 This is to make sure that the directory layout wrt. lib directories in stage1 is correctly set up from the beginning, because it gets propagated all the way to the final SDK image. It's easier to do it that way, rather than following the steps described in the deprecation notice of the 17.0 profile. --- .../0001-update-profile-coreos-overlay.sh | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100755 sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0001-update-profile-coreos-overlay.sh diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0001-update-profile-coreos-overlay.sh b/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0001-update-profile-coreos-overlay.sh new file mode 100755 index 0000000000..e9a01036ae --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos/stage1_hooks/0001-update-profile-coreos-overlay.sh @@ -0,0 +1,25 @@ +#!/bin/bash +set -x +set -euo pipefail + +stage1_repo="${1}" +new_repo="${2}" +parent_file='profiles/coreos/amd64/parent' +old_parent_line='portage-stable:default/linux/amd64/17.0/no-multilib/hardened' +stage1_parent="${stage1_repo}/${parent_file}" +new_parent="${new_repo}/${parent_file}" + +if [[ ! -e "${new_parent}" ]]; then + echo "no file '${parent_file}' in new repo, nothing to do" + exit 0 +fi + +if [[ ! -e "${stage1_parent}" ]]; then + echo "no file '${parent_file}' in stage1 repo, nothing to do" + exit 0 +fi + +if grep --quiet --fixed-strings --line-regexp --regexp="${old_parent_line}" -- "${stage1_parent}"; then + rm -f "${stage1_parent}" + cp -a "${new_parent}" "${stage1_parent}" +fi