From 8cc5baba7e6b2e998ec6d263c72ba23a1462faec Mon Sep 17 00:00:00 2001 From: Badrikesh Prusty Date: Mon, 26 Aug 2024 16:21:58 +0530 Subject: [PATCH] kas-container: update to version 4.4 Signed-off-by: Badrikesh Prusty --- kas-container | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/kas-container b/kas-container index af938285..51c31e3c 100755 --- a/kas-container +++ b/kas-container @@ -2,7 +2,7 @@ # # kas - setup tool for bitbake based projects # -# Copyright (c) Siemens AG, 2018-2022 +# Copyright (c) Siemens AG, 2018-2024 # # Authors: # Jan Kiszka @@ -27,6 +27,11 @@ set -e +KAS_IMAGE_VERSION_DEFAULT="4.4" +KAS_CONTAINER_IMAGE_PATH_DEFAULT="ghcr.io/siemens/kas" +KAS_CONTAINER_IMAGE_NAME_DEFAULT="kas" +KAS_CONTAINER_SELF_NAME="$(basename "$0")" + usage() { SELF="${KAS_CONTAINER_SELF_NAME}" @@ -144,11 +149,6 @@ run_clean() { fi } -KAS_IMAGE_VERSION_DEFAULT="4.3.1" -KAS_CONTAINER_IMAGE_PATH_DEFAULT="ghcr.io/siemens/kas" -KAS_CONTAINER_IMAGE_NAME_DEFAULT="kas" -KAS_CONTAINER_SELF_NAME="$(basename "$0")" - set_container_image_var() { KAS_IMAGE_VERSION="${KAS_IMAGE_VERSION:-${KAS_IMAGE_VERSION_DEFAULT}}" KAS_CONTAINER_IMAGE_NAME="${KAS_CONTAINER_IMAGE_NAME:-${KAS_CONTAINER_IMAGE_NAME_DEFAULT}}" @@ -330,15 +330,22 @@ while [ $# -gt 0 ] && [ $KAS_EXTRA_BITBAKE_ARGS -eq 0 ]; do case "$1" in --skip|--target|--task) KAS_OPTIONS="${KAS_OPTIONS} $1 $2" - shift 2 + shift 1 + shift 1 || KAS_OPTIONS="--help" ;; -c|--cmd|--command) KAS_BITBAKE_C_OPTION_ARGS="$2" - shift 2 + shift 1 + shift 1 || KAS_OPTIONS="--help" ;; -E|--preserve-env) fatal_error "$1 is not supported with ${KAS_CONTAINER_SELF_NAME}" ;; + --provenance) + KAS_OPTIONS="${KAS_OPTIONS} $1 $2" + shift 1 + shift 1 || KAS_OPTIONS="--help" + ;; --) KAS_EXTRA_BITBAKE_ARGS=$# ;; @@ -401,7 +408,7 @@ if [ "${KAS_CMD}" = "menu" ]; then set -- "$@" -e _KAS_REPO_DIR_HOST="$(readlink -fv "${KAS_REPO_DIR}")" fi - BUILD_SYSTEM=$(tr '\n' '\f' 2>/dev/null < ${KAS_FIRST_FILE} | \ + BUILD_SYSTEM=$(tr '\n' '\f' 2>/dev/null < "${KAS_FIRST_FILE}" | \ sed -e 's/\(.*\fconfig KAS_BUILD_SYSTEM\f\(.*\)\|.*\)/\2/' \ -e 's/\f\([[:alpha:]].*\|$\)//' \ -e 's/.*default \"\(.*\)\".*/\1/') @@ -439,7 +446,7 @@ if [ "$(id -u)" -eq 0 ] && [ "${KAS_ALLOW_ROOT}" != "yes" ] ; then "KAS_ALLOW_ROOT=yes to override." fi -set -- "$@" -v "${KAS_REPO_DIR}":/repo:${KAS_REPO_MOUNT_OPT} \ +set -- "$@" -v "${KAS_REPO_DIR}:/repo:${KAS_REPO_MOUNT_OPT}" \ -v "${KAS_WORK_DIR}":/work:rw -e KAS_WORK_DIR=/work \ -v "${KAS_BUILD_DIR}":/build:rw \ --workdir=/repo \ @@ -505,6 +512,11 @@ if [ -f "${GITCONFIG_FILE}" ]; then -e GITCONFIG_FILE="/var/kas/userdata/.gitconfig" fi +if [ -f "${REGISTRY_AUTH_FILE}" ]; then + set -- "$@" -v "$(readlink -fv "${REGISTRY_AUTH_FILE}")":/var/kas/userdata/.docker/config.json:ro \ + -e REGISTRY_AUTH_FILE="/var/kas/userdata/.docker/config.json" +fi + if [ -t 1 ]; then set -- "$@" -t -i fi @@ -539,7 +551,7 @@ if [ -n "${KAS_REPO_REF_DIR}" ]; then -e KAS_REPO_REF_DIR=/repo-ref fi -for var in TERM KAS_DISTRO KAS_MACHINE KAS_TARGET KAS_TASK \ +for var in TERM KAS_DISTRO KAS_MACHINE KAS_TARGET KAS_TASK KAS_CLONE_DEPTH \ KAS_PREMIRRORS DISTRO_APT_PREMIRRORS BB_NUMBER_THREADS PARALLEL_MAKE \ GIT_CREDENTIAL_USEHTTPPATH; do if [ -n "$(eval echo \$${var})" ]; then @@ -587,4 +599,5 @@ while [ $KAS_EXTRA_BITBAKE_ARGS -gt 0 ]; do KAS_EXTRA_BITBAKE_ARGS=$((KAS_EXTRA_BITBAKE_ARGS - 1)) done +# shellcheck disable=SC2086 trace ${KAS_CONTAINER_COMMAND} run "$@"