Browse Source

fix: non-root user could not launch compose

We want to propagate user's current ssh config

Signed-off-by: Valentin Lab <valentin.lab@kalysto.org>
test1
Valentin Lab 5 years ago
parent
commit
90b9545835
  1. 14
      bin/compose

14
bin/compose

@ -352,16 +352,22 @@ mk_docker_run_options() {
## ##
## CHARM_STORE ## CHARM_STORE
CHARM_STORE=${CHARM_STORE:-/srv/charm-store}
if [ "$UID" == 0 ]; then
CHARM_STORE=${CHARM_STORE:-/srv/charm-store}
else
CHARM_STORE=${CHARM_STORE:-$HOME/.charm-store}
fi
[ -e "$CHARM_STORE" ] || mkdir -p "$CHARM_STORE" || exit 1
[ -L "$CHARM_STORE" ] && { [ -L "$CHARM_STORE" ] && {
CHARM_STORE=$(readlink -f "$CHARM_STORE") || exit 1 CHARM_STORE=$(readlink -f "$CHARM_STORE") || exit 1
} }
docker_run_opts+=( docker_run_opts+=(
"-v" "$CHARM_STORE:/srv/charm-store:ro" "-v" "$CHARM_STORE:/srv/charm-store:ro"
"-e" "CHARM_STORE=/srv/charm-store" "-e" "CHARM_STORE=/srv/charm-store"
"-e" "HOST_CHARM_STORE=$CHARM_STORE" "-e" "HOST_CHARM_STORE=$CHARM_STORE"
) )
relink_subdirs /srv/charm-store/*
relink_subdirs "$CHARM_STORE"/*
## DEFAULT_COMPOSE_FILE ## DEFAULT_COMPOSE_FILE
if [ "${DEFAULT_COMPOSE_FILE+x}" ]; then if [ "${DEFAULT_COMPOSE_FILE+x}" ]; then
@ -414,8 +420,8 @@ mk_docker_run_options() {
## SSH config ## SSH config
docker_run_opts+=( docker_run_opts+=(
"-v" "/root/.ssh:/root/.ssh:ro"
"-v" "/etc/ssh:/etc/ssh"
"-v" "$HOME/.ssh:/root/.ssh:ro"
"-v" "/etc/ssh:/etc/ssh:ro"
) )
COMPOSE_LAUNCHER_BIN=$(readlink -f "${BASH_SOURCE[0]}") COMPOSE_LAUNCHER_BIN=$(readlink -f "${BASH_SOURCE[0]}")

Loading…
Cancel
Save