sdk_entry.sh: ensure currect binpkg host

This change ensures the binpkg host is updated if the board (OS) version
differs from the SDK version.

This is to ensure /build/[arch] uses the correct binary package cache.

Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
This commit is contained in:
Thilo Fromm 2022-01-05 21:00:14 +01:00
parent ee9cc95bac
commit 8fd5fc8a65
2 changed files with 26 additions and 1 deletions

View File

@ -119,7 +119,7 @@ fi
if [ "$stat" != "Up" ] ; then if [ "$stat" != "Up" ] ; then
yell "Starting stopped container '$name'" yell "Starting stopped container '$name'"
trap "docker stop $name" EXIT trap "docker stop -t 0 $name" EXIT
docker start "$name" docker start "$name"
fi fi

View File

@ -9,6 +9,31 @@ fi
chown -R sdk:sdk /home/sdk chown -R sdk:sdk /home/sdk
# Check if the OS image version we're working on is newer than
# the SDK container version and if it is, update the boards
# chroot portage conf to point to the correct binhost.
(
source /etc/lsb-release # SDK version in DISTRIB_RELEASE
source /mnt/host/source/.repo/manifests/version.txt # OS image version in FLATCAR_VERSION_ID
if [ "${FLATCAR_VERSION_ID}" != "${DISTRIB_RELEASE}" ] ; then
for target in amd64-usr arm64-usr; do
if [ -f "/build/$target/etc/target-version.txt" ] ; then
source "/build/$target/etc/target-version.txt"
if [ "${TARGET_FLATCAR_VERSION_ID}" = "${FLATCAR_VERSION_ID}" ] ; then
continue # already updated
fi
fi
echo
echo "Updating board support in '/build/${target}' to use package cache for version '${FLATCAR_VERSION_ID}'"
echo "---"
sudo su sdk -l -c "/home/sdk/trunk/src/scripts/setup_board --board='$target' --regen_configs_only"
echo "TARGET_FLATCAR_VERSION_ID='${FLATCAR_VERSION_ID}'" > "/build/$target/etc/target-version.txt"
done
fi
)
# This is ugly. # This is ugly.
# We need to sudo su - sdk -c so the SDK user gets a fresh login. # We need to sudo su - sdk -c so the SDK user gets a fresh login.
# 'sdk' is member of multiple groups, and plain docker USER only # 'sdk' is member of multiple groups, and plain docker USER only