|
@ -16,6 +16,30 @@ |
|
|
## |
|
|
## |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_sed_compat_load() { |
|
|
|
|
|
if get_path sed >/dev/null; then |
|
|
|
|
|
if sed --version >/dev/null 2>&1; then ## GNU |
|
|
|
|
|
sed_compat() { sed -r "$@"; } |
|
|
|
|
|
sed_compat_i() { sed -r -i "$@"; } |
|
|
|
|
|
else ## BSD |
|
|
|
|
|
sed_compat() { sed -E "$@"; } |
|
|
|
|
|
sed_compat_i() { sed -E -i "" "$@"; } |
|
|
|
|
|
fi |
|
|
|
|
|
else |
|
|
|
|
|
## Look for ``gsed`` |
|
|
|
|
|
if (get_path gsed && gsed --version) >/dev/null 2>&1; then |
|
|
|
|
|
sed_compat() { gsed -r "$@"; } |
|
|
|
|
|
sed_compat_i() { gsed -r -i "$@"; } |
|
|
|
|
|
else |
|
|
|
|
|
die "$exname: required GNU or BSD sed not found" |
|
|
|
|
|
fi |
|
|
|
|
|
fi |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
## BSD / GNU sed compatibility layer |
|
|
|
|
|
sed_compat() { _sed_compat_load; sed_compat "$@"; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
hash_get() { |
|
|
hash_get() { |
|
|
if get_path sha256sum >/dev/null; then |
|
|
if get_path sha256sum >/dev/null; then |
|
|
hash_get() { local x; x=$(sha256sum) || return 1; echo "${x:0:32}"; } |
|
|
hash_get() { local x; x=$(sha256sum) || return 1; echo "${x:0:32}"; } |
|
@ -483,14 +507,14 @@ get_compose_opts_list() { |
|
|
grep -E -m 1 "^\S*\$" -B 10000 | |
|
|
grep -E -m 1 "^\S*\$" -B 10000 | |
|
|
head -n -1 | |
|
|
head -n -1 | |
|
|
grep -E "^\s+-" | |
|
|
grep -E "^\s+-" | |
|
|
sed -r 's/\s+((((-[a-zA-Z]|--[a-zA-Z0-9-]+)( [A-Z=]+|=[^ ]+)?)(, )?)+)\s+.*$/\1/g' | |
|
|
|
|
|
|
|
|
sed_compat 's/\s+((((-[a-zA-Z]|--[a-zA-Z0-9-]+)( [A-Z=]+|=[^ ]+)?)(, )?)+)\s+.*$/\1/g' | |
|
|
tee "$cache_file" || return 1 |
|
|
tee "$cache_file" || return 1 |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
multi_opts_filter() { |
|
|
multi_opts_filter() { |
|
|
grep -E "$_MULTIOPTION_REGEX_LINE_FILTER" | |
|
|
grep -E "$_MULTIOPTION_REGEX_LINE_FILTER" | |
|
|
sed -r "s/^($_MULTIOPTION_REGEX)(\s|=).*$/\1/g" | |
|
|
|
|
|
|
|
|
sed_compat "s/^($_MULTIOPTION_REGEX)(\s|=).*$/\1/g" | |
|
|
tr ',' "\n" | nspc |
|
|
tr ',' "\n" | nspc |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -980,7 +1004,7 @@ run() { |
|
|
if [ -n "$DEBUG" ] || [ -n "$DRY_RUN" ]; then |
|
|
if [ -n "$DEBUG" ] || [ -n "$DRY_RUN" ]; then |
|
|
debug "${WHITE}Launching:${NORMAL}" |
|
|
debug "${WHITE}Launching:${NORMAL}" |
|
|
echo "docker run --rm \\" |
|
|
echo "docker run --rm \\" |
|
|
pretty_print "${docker_run_opts[@]}" | sed -r 's/^/ /g;s/([^\])$/\1\\\n/g' |
|
|
|
|
|
|
|
|
pretty_print "${docker_run_opts[@]}" | sed_compat 's/^/ /g;s/([^\])$/\1\\\n/g' |
|
|
if [ -z "$ENTER" ]; then |
|
|
if [ -z "$ENTER" ]; then |
|
|
echo " ${COMPOSE_DOCKER_IMAGE} \\" |
|
|
echo " ${COMPOSE_DOCKER_IMAGE} \\" |
|
|
echo " " "$@" |
|
|
echo " " "$@" |
|
@ -988,7 +1012,7 @@ run() { |
|
|
echo " --entrypoint bash \\" |
|
|
echo " --entrypoint bash \\" |
|
|
echo " ${COMPOSE_DOCKER_IMAGE}" |
|
|
echo " ${COMPOSE_DOCKER_IMAGE}" |
|
|
fi |
|
|
fi |
|
|
fi | { if [ -n "$DEBUG" ]; then sed -r 's/^/ /g'; else cat; fi } >&2 |
|
|
|
|
|
|
|
|
fi | { if [ -n "$DEBUG" ]; then sed_compat 's/^/ /g'; else cat; fi } >&2 |
|
|
if [ -z "$DRY_RUN" ]; then |
|
|
if [ -z "$DRY_RUN" ]; then |
|
|
debug "${WHITE}Execution:${NORMAL}" |
|
|
debug "${WHITE}Execution:${NORMAL}" |
|
|
if [ -z "$ENTER" ]; then |
|
|
if [ -z "$ENTER" ]; then |
|
|