From e6a4349355142c054e771009d284d21adca819e9 Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Thu, 6 Jan 2022 20:17:19 +0100 Subject: [PATCH 1/2] sdk_lib/Dockerfile.sdk-import: use root user by default sdk_entry.sh is expected to be called by the root user, so we set USER root:root. Also we add a "root" entry to passwd and group since it does not exist in the SDK tarball. Signed-off-by: Thilo Fromm --- sdk_lib/Dockerfile.sdk-import | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sdk_lib/Dockerfile.sdk-import b/sdk_lib/Dockerfile.sdk-import index 59b517366e..6e78369a12 100644 --- a/sdk_lib/Dockerfile.sdk-import +++ b/sdk_lib/Dockerfile.sdk-import @@ -6,6 +6,10 @@ RUN touch /etc/debian_chroot RUN chmod 644 /etc/passwd RUN chmod 644 /etc/group +# User "root" is not in /etc/passwd / group in the SDK tarball +RUN echo 'root:x:0:0:root:/root:/bin/bash' >>/etc/passwd +RUN echo 'root:x:0:' >>/etc/group + RUN if ! grep -q portage /etc/group ; then \ echo "portage::250:portage" >>/etc/group; \ fi @@ -46,6 +50,7 @@ RUN echo "if [ -f /mnt/host/source/.sdkenv ]; then source /mnt/host/source/.sdke COPY --chown=sdk:sdk sdk_lib/sdk_entry.sh /home/sdk RUN chmod 755 /home/sdk/sdk_entry.sh +USER root:root # This should be a NOP; if you see packages being rebuilt # it's likely that submodules and SDK tarball are out of sync RUN /home/sdk/sdk_entry.sh ./update_chroot --toolchain_boards="amd64-usr arm64-usr" From 4273b51cd6b1db489214a076ac342ea08b08087e Mon Sep 17 00:00:00 2001 From: Thilo Fromm Date: Thu, 6 Jan 2022 20:18:48 +0100 Subject: [PATCH 2/2] sdk_lib/sdk_entry.sh: only call setup_board if /build/... exists Signed-off-by: Thilo Fromm --- sdk_lib/sdk_entry.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk_lib/sdk_entry.sh b/sdk_lib/sdk_entry.sh index 69b5c68c0b..b0fae73e6a 100755 --- a/sdk_lib/sdk_entry.sh +++ b/sdk_lib/sdk_entry.sh @@ -18,6 +18,9 @@ chown -R sdk:sdk /home/sdk if [ "${FLATCAR_VERSION_ID}" != "${DISTRIB_RELEASE}" ] ; then for target in amd64-usr arm64-usr; do + if [ ! -d "/build/$target" ] ; then + continue + fi 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