diff --git a/bin/compose b/bin/compose index 5bd8124..019ce76 100755 --- a/bin/compose +++ b/bin/compose @@ -352,16 +352,22 @@ mk_docker_run_options() { ## ## 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" ] && { CHARM_STORE=$(readlink -f "$CHARM_STORE") || exit 1 } + docker_run_opts+=( "-v" "$CHARM_STORE:/srv/charm-store:ro" "-e" "CHARM_STORE=/srv/charm-store" "-e" "HOST_CHARM_STORE=$CHARM_STORE" ) - relink_subdirs /srv/charm-store/* + relink_subdirs "$CHARM_STORE"/* ## DEFAULT_COMPOSE_FILE if [ "${DEFAULT_COMPOSE_FILE+x}" ]; then @@ -414,8 +420,8 @@ mk_docker_run_options() { ## SSH config 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]}")