From 46eabc7be3d9262cee15d70a44cce96de77bb71d Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Thu, 20 May 2021 15:57:22 +0200 Subject: [PATCH] kas-container: Add support for checkout and for-all-repos Allow invoking those two new sub-commands also via the container interface. Closes #51 Signed-off-by: Jan Kiszka --- container-entrypoint | 2 +- kas-container | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/container-entrypoint b/container-entrypoint index e756e95..24f4ebd 100755 --- a/container-entrypoint +++ b/container-entrypoint @@ -40,7 +40,7 @@ fi if [ -n "$1" ]; then case "$1" in - build|shell|-*) + build|checkout|for-all-repos|shell|-*) exec $GOSU kas "$@" ;; *) diff --git a/kas-container b/kas-container index a59ad12..61a1427 100755 --- a/kas-container +++ b/kas-container @@ -29,7 +29,8 @@ set -e usage() { - printf "%b" "Usage: $0 [OPTIONS] { build | shell } [KASOPTIONS] KASFILE\n" + printf "%b" "Usage: $0 [OPTIONS] { build | checkout | shell } [KASOPTIONS] KASFILE\n" + printf "%b" " $0 [OPTIONS] for-all-repos KASFILE COMMAND\n" printf "%b" " $0 [OPTIONS] clean\n" printf "%b" "\nPositional arguments:\n" printf "%b" "build\t\t\tCheck out repositories and build target.\n" @@ -219,7 +220,7 @@ while [ $# -gt 0 ]; do shift 1 break ;; - build) + build|checkout|for-all-repos) KAS_REPO_MOUNT_OPT_DEFAULT="ro" KAS_CMD=$1 shift 1 @@ -277,6 +278,10 @@ while [ $# -gt 0 ] && [ $KAS_EXTRA_BITBAKE_ARGS -eq 0 ]; do fi done shift 1 + if [ "$KAS_CMD" = "for-all-repos" ]; then + KAS_REPO_CMD="$1" + shift 1 + fi ;; esac done @@ -410,6 +415,9 @@ fi # SC2086: Double quote to prevent globbing and word splitting. # shellcheck disable=2086 set -- "$@" ${KAS_FILES} +if [ "$KAS_CMD" = "for-all-repos" ]; then + set -- "$@" "${KAS_REPO_CMD}" +fi # rotate any extra bitbake args from the front to the end of the argument list while [ $KAS_EXTRA_BITBAKE_ARGS -gt 0 ]; do