Skip to content
Snippets Groups Projects
Commit bb5b57a3 authored by Simon McVittie's avatar Simon McVittie Committed by Ludovico de Nittis
Browse files

_v2-entry-point: Remove support for not relaunching the container


This effectively hard-codes PRESSURE_VESSEL_RELAUNCH_CONTAINER to 1:
if we are in "session mode" with a STEAM_COMPAT_SESSION_ID set, then
we will still share a container started by _start-container-in-background
between one or more setup commands, but then we will terminate that
container and start again for the actual game.

We need to do this if we want the actual game to be able to take its
user-specified launch options into account, which is why it has been the
default since January.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent a246f537
No related branches found
No related tags found
No related merge requests found
...@@ -222,24 +222,11 @@ verbose "STEAM_COMPAT_SESSION_ID=${STEAM_COMPAT_SESSION_ID-}" ...@@ -222,24 +222,11 @@ verbose "STEAM_COMPAT_SESSION_ID=${STEAM_COMPAT_SESSION_ID-}"
# Used to create sockets. # Used to create sockets.
verbose "XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR-}" verbose "XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR-}"
relaunch=
if [ -z "${STEAM_COMPAT_SESSION_ID-}" ]; then if [ -z "${STEAM_COMPAT_SESSION_ID-}" ]; then
info "Non-session mode, behaving like the main program" info "Non-session mode, behaving like the main program"
is_main=yes is_main=yes
elif [ -n "$is_main" ]; then elif [ -n "$is_main" ]; then
info "Main program in session mode" info "Main program in session mode"
# Use the relaunch mode by default
case "${PRESSURE_VESSEL_RELAUNCH_CONTAINER-1}" in
(1)
relaunch=yes
;;
(0)
;;
(*)
echo "\$PRESSURE_VESSEL_RELAUNCH_CONTAINER should be either 0 or 1" >&2
;;
esac
else else
verbose "Setup program in session mode" verbose "Setup program in session mode"
fi fi
...@@ -360,21 +347,15 @@ terminate_container () { ...@@ -360,21 +347,15 @@ terminate_container () {
--terminate --terminate
} }
if [ -n "$relaunch" ]; then if [ -n "$is_main" ]; then
info "Terminating and re-launching container for main game" info "Terminating and re-launching container for main game"
terminate_container || : terminate_container || :
exec_container "$@" exec_container "$@"
# not reached # not reached
fi fi
if [ -n "$is_main" ]; then
trap terminate_container EXIT
fi
# Launch the pressure-vessel-launcher(1). This is used to run the # Launch the pressure-vessel-launcher(1). This is used to run the
# setup commands (--verb=run), if any. If not requested via # setup commands (--verb=run), if any.
# PRESSURE_VESSEL_RELAUNCH_CONTAINER=1, it is also used to run the
# actual game.
# #
# We have to launch pressure-vessel-launcher(1) *without* setting # We have to launch pressure-vessel-launcher(1) *without* setting
# SteamAppId, SteamAppUser, etc., otherwise Steam will think the game # SteamAppId, SteamAppUser, etc., otherwise Steam will think the game
...@@ -405,41 +386,10 @@ env \ ...@@ -405,41 +386,10 @@ env \
--terminate-timeout=2 \ --terminate-timeout=2 \
${NULL+} ${NULL+}
launch_args=( \
)
if [ -n "$is_main" ]; then
if [ "${SteamAppId-}" != "${STEAM_COMPAT_APP_ID-}" ]; then
log "Mismatch: SteamAppId=${SteamAppId-}, STEAM_COMPAT_APP_ID=${STEAM_COMPAT_APP_ID-}"
exit 125
fi
launch_args=( \
${launch_args[0]+"${launch_args[@]}"} \
--pass-env-matching '*' \
--terminate \
)
# For the main game we wait for all processes to terminate before
# shutting down the container.
set -- \
"$pressure_vessel/bin/pressure-vessel-adverb" \
${PRESSURE_VESSEL_SHELL+--shell="$PRESSURE_VESSEL_SHELL"} \
${PRESSURE_VESSEL_TERMINAL+--terminal="$PRESSURE_VESSEL_TERMINAL"} \
--subreaper \
-- \
"$@"
else
launch_args=( \
${launch_args[0]+"${launch_args[@]}"} \
--unset-env LD_PRELOAD \
)
fi
exec "$pressure_vessel/bin/pressure-vessel-launch" \ exec "$pressure_vessel/bin/pressure-vessel-launch" \
--directory="$(pwd)" \ --directory="$(pwd)" \
--socket="$rendezvous/socket" \ --socket="$rendezvous/socket" \
${launch_args[0]+"${launch_args[@]}"} \ --unset-env LD_PRELOAD \
-- \ -- \
"$@" "$@"
exit 125 exit 125
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment