Skip to content
Snippets Groups Projects
Commit daa96aef authored by Simon McVittie's avatar Simon McVittie
Browse files

_v2-entry-point: Refactor to avoid using bash arrays


bash is not completely portable, so we have to stick to POSIX /bin/sh,
which only has one array, "$@".

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 0f7ba2cb
No related branches found
No related tags found
1 merge request!530Avoid #!/usr/bin/env bash scripts
...@@ -17,14 +17,8 @@ log_to_file= ...@@ -17,14 +17,8 @@ log_to_file=
log_dir=${STEAM_LINUX_RUNTIME_LOG_DIR-"${PRESSURE_VESSEL_VARIABLE_DIR-"${here}/var"}"} log_dir=${STEAM_LINUX_RUNTIME_LOG_DIR-"${PRESSURE_VESSEL_VARIABLE_DIR-"${here}/var"}"}
keep_logs= keep_logs=
use_timestamp= use_timestamp=
# Arguments for pressure-vessel-wrap
declare -a container_args=()
if [ -n "${LD_PRELOAD-}" ]; then
container_args+=("--env-if-host=LD_PRELOAD=$LD_PRELOAD")
container_args+=("--ld-preloads="$LD_PRELOAD")
fi
ld_preload="${LD_PRELOAD-}"
unset LD_PRELOAD unset LD_PRELOAD
...@@ -288,11 +282,20 @@ else ...@@ -288,11 +282,20 @@ else
run="run-in-${suite}" run="run-in-${suite}"
fi fi
exec "${here}/${run}" \ # Before this point, "$@" contains the wrapped program and its arguments.
${container_args[0]+"${container_args[@]}"} \ # After this point, it contains arguments for ./run (or equivalently for
-- \ # pv-wrap).
"$@" \ set -- -- "$@"
${NULL+}
# We prepend options to "$@" because that's the only array available
# in generic POSIX /bin/sh, and bash is not always practical to use.
if [ -n "${ld_preload}" ]; then
set -- "--env-if-host=LD_PRELOAD=$ld_preload" "$@"
set -- "--ld-preloads=$ld_preload" "$@"
fi
exec "${here}/${run}" "$@"
exit 125 exit 125
# vim:set sw=4 sts=4 et: # vim:set sw=4 sts=4 et:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment