From 600e74f0af86a2897c397fea537fb20424dc51fe Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Mon, 23 Feb 2026 12:06:31 +0100 Subject: [PATCH] scripts: dev_cli.sh: Allow passing commands to shell subcommand Accept arguments after -- in 'dev_cli.sh shell' and forward them to 'bash -c' inside the container. When no arguments are given, an interactive shell is started as before. This enables running one-off commands in the CI container without an interactive session, for example: ./scripts/dev_cli.sh shell -- rustup toolchain install nightly \&\& cargo +nightly fmt --all -- --check Signed-off-by: Anatol Belski --- scripts/dev_cli.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/dev_cli.sh b/scripts/dev_cli.sh index e537c499c..0e190a007 100755 --- a/scripts/dev_cli.sh +++ b/scripts/dev_cli.sh @@ -706,10 +706,21 @@ cmd_shell() { ensure_build_dir ensure_latest_ctr process_volumes_args - say_warn "Starting a privileged shell prompt as root ..." - say_warn "WARNING: Your $CLH_ROOT_DIR folder will be bind-mounted in the container under $CTR_CLH_ROOT_DIR" + + # Remaining args after -- are passed as a command to bash -c. + # With no args, an interactive shell is started. + tty_args="-ti" + shell_args=() + if [ $# -gt 0 ]; then + tty_args="" + shell_args+=("-c" "$*") + else + say_warn "Starting a privileged shell prompt as root ..." + say_warn "WARNING: Your $CLH_ROOT_DIR folder will be bind-mounted in the container under $CTR_CLH_ROOT_DIR" + fi + $DOCKER_RUNTIME run \ - -ti \ + $tty_args \ --workdir "$CTR_CLH_ROOT_DIR" \ --rm \ --privileged \ @@ -723,7 +734,8 @@ cmd_shell() { --volume "$CLH_INTEGRATION_WORKLOADS:$CTR_CLH_INTEGRATION_WORKLOADS" \ --env USER="root" \ --entrypoint bash \ - "$CTR_IMAGE" + "$CTR_IMAGE" \ + "${shell_args[@]}" fix_dir_perms $? }