From 3f91b77e3f14e60fe9df6a0312a99f41baaee35c Mon Sep 17 00:00:00 2001 From: Ricardo Pardini Date: Mon, 30 Jan 2023 22:48:35 +0100 Subject: [PATCH] armbian-next: `docker-shell`: provide SSH and forward ssh auth socket to `docker-shell` --- lib/functions/cli/cli-docker.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/functions/cli/cli-docker.sh b/lib/functions/cli/cli-docker.sh index be3710cd4e..34dd003f3a 100644 --- a/lib/functions/cli/cli-docker.sh +++ b/lib/functions/cli/cli-docker.sh @@ -4,6 +4,16 @@ function cli_docker_pre_run() { return 0 fi + case "${DOCKER_SUBCMD}" in + shell) + # inside-function-function: a dynamic hook, only triggered if this CLI runs. + function add_host_dependencies__ssh_client_for_docker_shell_over_ssh() { + export EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} openssh-client" + } + declare -g DOCKER_PASS_SSH_AGENT="yes" # Pass SSH agent to docker + ;; + esac + # make sure we're not _ALREADY_ running under docker... otherwise eternal loop? if [[ "${ARMBIAN_RUNNING_IN_CONTAINER}" == "yes" ]]; then exit_with_error "asking for docker... inside docker. how did this happen? Tip: you don't need 'docker' to run armbian-next inside Docker; it's automatically detected and used when appropriate." @@ -11,12 +21,6 @@ function cli_docker_pre_run() { } function cli_docker_run() { - case "${DOCKER_SUBCMD}" in - shell) - declare -g DOCKER_PASS_SSH_AGENT="yes" # Pass SSH agent to docker - ;; - esac - LOG_SECTION="docker_cli_prepare" do_with_logging docker_cli_prepare # @TODO: and can be very well said that in CI, we always want FAST_DOCKER=yes, unless we're building the Docker image itself.