@ -446,9 +446,22 @@ mk_docker_run_options() {
p0 "-e" "COMPOSE_LAUNCHER_OPTS=$dest"
p0 "-e" "COMPOSE_LAUNCHER_OPTS=$dest"
p0 "-e" "COMPOSE_LAUNCHER_BIN=$COMPOSE_LAUNCHER_BIN"
p0 "-e" "COMPOSE_LAUNCHER_BIN=$COMPOSE_LAUNCHER_BIN"
} >> "$filename"
} >> "$filename"
mkdir -p "$SESSION_DIR" || return 1
mkdir -p "$SESSION_DIR" || return 1
mv -f "$filename" "$SESSION_DIR/$UID-$sha" || return 1
mv -f "$filename" "$SESSION_DIR/$UID-$sha" || return 1
echo "$SESSION_DIR/$UID-$sha"
echo "$SESSION_DIR/$UID-$sha"
if [ -n "$DEBUG" ]; then
echo "${WHITE}Environment:${NORMAL}"
echo " COMPOSE_DOCKER_IMAGE: $COMPOSE_DOCKER_IMAGE"
echo " CHARM_STORE: $CHARM_STORE"
echo " DATASTORE: $DATASTORE"
echo " CONFIGSTORE: $CONFIGSTORE"
echo " COMPOSE_VAR: $COMPOSE_VAR"
echo " COMPOSE_CACHE: $COMPOSE_CACHE"
echo " SESSION_DIR: $SESSION_DIR"
echo " TZ_PATH: $TZ_PATH"
fi >&2
}
}
@ -491,6 +504,20 @@ get_tz() {
}
}
pretty_print() {
while [ "$#" != 0 ]; do
case "$1" in
"-v"|"-e"|"-w")
e "$1" "$2" "\\"$'\n'
shift;;
*)
e "$1 ";;
esac
shift
done
}
run() {
run() {
local os docker_run_opts
local os docker_run_opts
@ -514,7 +541,18 @@ run() {
[ -t 0 ] && docker_run_opts+=("-i")
[ -t 0 ] && docker_run_opts+=("-i")
[ -t 1 ] && docker_run_opts+=("-t")
[ -t 1 ] && docker_run_opts+=("-t")
exec docker run --rm "${docker_run_opts[@]}" "${COMPOSE_DOCKER_IMAGE}" "$@"
if [ -n "$DEBUG" ] || [ -n "$DRY_RUN" ]; then
debug "${WHITE}Launching:${NORMAL}"
echo "docker run --rm \\"
pretty_print "${docker_run_opts[@]}" | sed -r 's/^/ /g;s/([^\])$/\1\\\n/g'
echo " ${COMPOSE_DOCKER_IMAGE} \\"
echo " " "$@"
fi | { if [ -n "$DEBUG" ]; then sed -r 's/^/ /g'; else cat; fi } >&2
if [ -z "$DRY_RUN" ]; then
debug "${WHITE}Execution:${NORMAL}"
exec docker run --rm "${docker_run_opts[@]}" "${COMPOSE_DOCKER_IMAGE}" "$@"
fi
}
}