kas-docker: add aws-dir command parameter

The `--aws-dir` parameter for the kas-docker script allows to specify a
AWScli config directory which will then be mounted to `/etc/skel/.aws`
and copied by kas into the internal home directory using the `AWS_*`
environment variables.

Signed-off-by: Claudius Heine <ch@denx.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Claudius Heine 2020-05-05 12:02:10 +02:00 committed by Jan Kiszka
parent 267a53e78d
commit 96df30a80f

View File

@ -44,6 +44,7 @@ usage()
printf "%b" "--ssh-dir\t\tDirectory containing SSH configurations.\n"
printf "%b" "\t\t\tAvoid \$HOME/.ssh unless you fully trust the " \
"container.\n"
printf "%b" "--aws-dir\t\tDirectory containing AWScli configuration.\n"
printf "%b" "--no-proxy-from-env\tDo not inherit proxy settings from " \
"environment.\n"
exit 1
@ -103,6 +104,11 @@ while [ $# -gt 0 ]; do
SSH_DIR="$2"
shift 2
;;
--aws-dir)
[ $# -gt 2 ] || usage
AWS_DIR="$2"
shift 2
;;
--no-proxy-from-env)
NO_PROXY_FROM_ENV=1
shift 1
@ -198,6 +204,16 @@ if [ -n "${SSH_DIR}" ] ; then
set -- "$@" -v "$(readlink -f "${SSH_DIR}")":/etc/skel/.ssh:ro
fi
if [ -n "${AWS_DIR}" ] ; then
if [ ! -d "${AWS_DIR}" ]; then
echo "Passed AWS_DIR '${AWS_DIR}' is not a directory"
exit 1
fi
set -- "$@" -v "$(readlink -f "${AWS_DIR}")":/etc/skel/.aws:ro \
-e AWS_CONFIG_FILE="${AWS_CONFIG_FILE:-/etc/skel/.aws/config}" \
-e AWS_SHARED_CREDENTIALS_FILE="${AWS_SHARED_CREDENTIALS_FILE:-/etc/skel/.aws/credentials}"
fi
if [ -t 1 ]; then
set -- "$@" -t -i
fi