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

Add 'subprojects/container-runtime/' from commit 'cc4e44f0'

git-subtree-dir: subprojects/container-runtime
git-subtree-mainline: e8de4b15
git-subtree-split: cc4e44f0
parents e8de4b15 cc4e44f0
No related branches found
No related tags found
No related merge requests found
Showing
with 3072 additions and 0 deletions
# Copyright 2020-2021 Collabora Ltd.
# SPDX-License-Identifier: MIT
/.cache/
/depot/
/depots/
/local/
/pressure-vessel-*-bin+src.tar.gz
/pressure-vessel-*-bin.tar.gz
/pressure-vessel-bin+src.tar.gz
/pressure-vessel-bin.tar.gz
/sources/scout/steamrt/
/sources/soldier/steamrt/
/test-logs/
__pycache__/
# Copyright © 2019-2020 Collabora Ltd.
#
# SPDX-License-Identifier: MIT
variables:
BUILD_IMAGE: docker.internal.steamos.cloud/steamos/package-builder:bullseye
stages:
- test
- analyze
default:
tags:
- docker
- linux
image: "${BUILD_IMAGE}"
interruptible: true
test:
stage: test
# Assume Gitlab-CI uses bash, not sh (bash is the default)
script: |
set -eu
set -o pipefail
make check 2>&1 | tee qa-bullseye.log
# Save qa.log for analysis
artifacts:
paths:
- depots/*.txt
- depots/*/VERSIONS.txt
- qa-bullseye.log
todo:
stage: analyze
needs:
- test
# Succeed if grep fails (no failing or expected-failure tests),
# fail if grep succeeds
script: |
! grep -B10 '^not ok\b' qa-bullseye.log
# Failure is just a warning
allow_failure: true
# Run tests in stretch (this lets us assert that the test script
# is syntactically valid in Python 3.5). Ignore any pyflakes, shellcheck,
# etc. warnings because these older versions are probably less good at
# avoiding false positives.
test:stretch:
stage: test
image: docker.internal.steamos.cloud/steamos/package-builder:stretch
script: make check TESTS_ONLY=true
# The same, but for brewmaster and Python 3.4
test:brewmaster:
stage: test
image: docker.internal.steamos.cloud/steamos/package-builder:brewmaster
script: make check TESTS_ONLY=true
# The same, but for Ubuntu 18.04
test:bionic:
stage: test
image: ubuntu:18.04
before_script:
- |
set -eux
export DEBIAN_FRONTEND=noninteractive
apt-get -y update
apt-get -y install \
ca-certificates \
git \
make \
perl \
python3 \
python3-debian \
${NULL+}
tempdir="$(mktemp -d)"
git clone --branch steamrt/soldier https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.steamos.cloud/packaging/python-vdf.git "$tempdir/python-vdf"
export PYTHONPATH="$tempdir/python-vdf"
script: make check
artifacts:
paths:
- depots/*.txt
- depots/*/VERSIONS.txt
# The same, but for Arch
test:archlinux:
stage: test
image: archlinux:latest
before_script:
- |
set -eux
echo -e "\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf
pacman -Syu --needed --noconfirm --noprogressbar \
base-devel \
git \
perl \
python \
python-chardet \
python-six \
python-tappy \
sudo \
${NULL+}
tempdir="$(mktemp -d)"
git clone --branch debian/buster https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.steamos.cloud/packaging/python-debian.git "$tempdir/python-debian"
git clone --branch steamrt/soldier https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.steamos.cloud/packaging/python-vdf.git "$tempdir/python-vdf"
export PATH="/usr/bin/core_perl:$PATH"
export PYTHONPATH="$tempdir/python-debian/lib:$tempdir/python-vdf"
script: make check
artifacts:
paths:
- depots/*.txt
- depots/*/VERSIONS.txt
reuse:
stage: test
tags:
- docker
- linux
needs: []
image:
name: fsfe/reuse:latest
entrypoint: [""]
before_script: []
script:
- reuse lint
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: SteamLinuxRuntime
Source: https://gitlab.steamos.cloud/steamrt/steamlinuxruntime/
Files:
README.md
debian/*
docs/*.md
runtimes/*/README.md
runtimes/*/toolmanifest.vdf
steampipe/*.vdf
Copyright:
2019-2021 Valve Corporation
2020-2021 Collabora Ltd.
License: MIT
Files:
tests/third-party/pycotap.py
Copyright:
2015 Remko Tronçon
License: MIT
Copyright and licensing in this project is recorded in REUSE format
<https://reuse.software/>. See individual files or .reuse/dep5 for
details of applicable copyright and licensing, and LICENSES/* for full
license text.
The preferred license for new files is the license identified by SPDX
as "MIT", LICENSES/MIT.txt. That is currently the only license used here.
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# Copyright 2020 Collabora Ltd.
# SPDX-License-Identifier: MIT
all: scout
scout:
./populate-depot.py --ssh --depot=depot scout='{"version": "latest-steam-client-main-branch"}'
soldier:
./populate-depot.py --ssh --depot=depot scout='{"version": "latest-steam-client-main-branch"}' soldier
clean:
rm -fr depot/pressure-vessel depot/com.valvesoftware.SteamRuntime.*
check:
prove -v tests/*.sh
SteamLinuxRuntime depot
=======================
This repository contains entry-point scripts and other integration glue
to pull together the Steam container runtime into a depot, ready for
deployment via Steampipe onto users' systems.
Latest development: <https://gitlab.steamos.cloud/steamrt/steamlinuxruntime>
How this fits into the overall Steam Runtime project
----------------------------------------------------
1. Build .deb packages for the content of the Steam Runtime, from
the source code in e.g.
<https://repo.steampowered.com/steamrt-images-scout/snapshots/latest-container-runtime-depot/sources/>.
This is not part of this git repository.
2. For `scout` and `heavy` only: Put together the .deb packages into the
`LD_LIBRARY_PATH`-based Steam Runtime.
This git repository is not relevant for this step.
3. Put together the .deb packages into a Flatpak-style container runtime.
This is done by
[flatdeb-steam](https://gitlab.steamos.cloud/steamrt/flatdeb-steam).
4. To make the runtime suitable for running Steam games and Proton on
(almost) any GNU/Linux machine, turn it into a Steampipe depot
with the runtime itself, the pressure-vessel container runtime tool,
all of the pressure-vessel tool's dependencies except glibc, and some
scripts and Steam manifests to hold the whole thing together.
That's what this git repository is for.
What goes into the depot
------------------------
In a complete depot build, the components are listed in `VERSIONS.txt`,
which is generated as a side-effect of running `populate-depot.py`.
* `SteamLinuxRuntime`: Entry-point scripts, from this repository.
See `depot/` for most of the source files. A few files are
autogenerated by `populate-depot.py` instead.
* `scout`, `soldier`, etc.: A Steam Runtime build, normally
`*-runtime.tar.gz` and `*-buildid.txt`.
This is produced by
[flatdeb-steam](https://gitlab.steamos.cloud/steamrt/flatdeb-steam)
by assembling .deb packages into a complete runtime environment.
Technically you can have more than one runtime in a depot and use
`pressure-vessel-test-ui` to switch between them, but the official
releases only contain one runtime each.
These are downloaded by `populate-depot.py` during build.
* `presure-vessel`: A bundled, relocatable pressure-vessel binary build.
This is produced by the `pressure-vessel/build-relocatable-install.py`
script in
[steam-runtime-tools](https://gitlab.steamos.cloud/steamrt/steam-runtime-tools),
which collects up the following packages from a
Steam Runtime 1 'scout' SDK build:
* pressure-vessel itself
* Its executable dependencies, especially `bwrap` and `capsule-capture-libs`
* Some diagnostic tools
* Their dependency libraries (all except glibc)
and arranges them in the `pressure-vessel/` directory.
These are special because they run directly on the host system, without
either a container or the complete `LD_LIBRARY_PATH` Steam Runtime.
We take these libraries from `scout`, bundle them in a directory and
use `RPATH` to set the search path. This is done to ensure that their
glibc dependency is as old as possible (so that they will run on any
GNU/Linux machine that is capable of running Steam itself) and
everything else that is required is included.
This is downloaded by `populate-depot.py` during build.
#!/usr/bin/env bash
# Copyright 2020-2021 Collabora Ltd.
# SPDX-License-Identifier: MIT
set -eu
me="$(readlink -f "$0")"
here="${me%/*}"
me="${me##*/}"
# This is a prototype and will probably not survive in its current form.
# Don't rely on it.
is_main=yes
suite=
verbose=
log_to_file=
log_dir=${STEAM_LINUX_RUNTIME_LOG_DIR-"${PRESSURE_VESSEL_VARIABLE_DIR-"${here}/var"}"}
keep_logs=
use_timestamp=
ld_preload=
# Arguments for pressure-vessel-wrap
declare -a container_args=()
if [ -n "${LD_PRELOAD-}" ]; then
container_args+=("--env-if-host=LD_PRELOAD=$LD_PRELOAD")
ld_preload="$LD_PRELOAD"
fi
unset LD_PRELOAD
if [ "${STEAM_LINUX_RUNTIME_VERBOSE-}" = 1 ]; then
verbose=yes
# Propagate it to pressure-vessel too
export PRESSURE_VESSEL_VERBOSE=1
fi
if [ "${STEAM_LINUX_RUNTIME_LOG-}" = 1 ]; then
log_to_file=yes
use_timestamp=yes
fi
if [ "${STEAM_LINUX_RUNTIME_KEEP_LOGS-}" = 1 ]; then
keep_logs=yes
fi
log () {
if [ -n "$use_timestamp" ]; then
timestamp=$(date +'%H:%M:%S.%6N')
printf '%s\n' "${timestamp}: ${me}[$$]: $*" >&2 || :
else
printf '%s\n' "${me}[$$]: $*" >&2 || :
fi
}
info () {
if [ -n "${log_to_file}${verbose}" ]; then
log "$@"
fi
}
verbose () {
if [ -n "$verbose" ]; then
log "$@"
fi
}
usage () {
local code="$1"
shift
if [ "$code" -ne 0 ]; then
exec >&2
fi
echo "Usage:"
echo "$me [OPTIONS] COMMAND [ARGS...]"
echo
echo "Run a command in a container that is shared with other"
echo "invocations of the same Steam game."
echo
echo "Required arguments"
echo "COMMAND [ARGS...] Run this."
echo
echo "Options"
echo "--deploy=DIR Ignored for backwards compatibility."
echo "--keep-logs Do not remove the older logs of this same app id."
echo "--log-to-file Log to a file instead of the default stderr."
echo "--suite=SUITE Run in this runtime [default=choose automatically]."
echo "--use-timestamp Prepend the timestamp to the log entries [default with --log-to-file]."
echo "--verb=%verb% Mode to operate in [default=waitforexitandrun]."
echo "--verbose Be more verbose."
exit "${code}"
}
getopt_temp="help"
getopt_temp="${getopt_temp},deploy:"
getopt_temp="${getopt_temp},log-to-file:"
getopt_temp="${getopt_temp},keep-logs:"
getopt_temp="${getopt_temp},suite:"
getopt_temp="${getopt_temp},use-timestamp:"
getopt_temp="${getopt_temp},verb:"
getopt_temp="${getopt_temp},verbose"
getopt_temp="$(getopt -o '' --long "$getopt_temp" -n "$me" -- "$@")"
eval "set -- $getopt_temp"
unset getopt_temp
while [ "$#" -gt 0 ]; do
case "$1" in
(--help)
usage 0
# not reached
;;
(--deploy)
shift 2
;;
(--log-to-file)
log_to_file=yes
use_timestamp=yes
shift
;;
(--keep-logs)
keep_logs=yes
shift
;;
(--suite)
suite="$2"
shift 2
;;
(--verb)
case "$2" in
(waitforexitandrun)
is_main=yes
;;
(run)
export PRESSURE_VESSEL_BATCH=1
is_main=
;;
(*)
is_main=
;;
esac
shift 2
;;
(--use-timestamp)
use_timestamp=yes
shift
;;
(--verbose)
verbose=yes
# Propagate it to pressure-vessel too
export PRESSURE_VESSEL_VERBOSE=1
shift
;;
(--)
shift
break
;;
(-*)
log "Unknown option: $1"
usage 125 # EX_USAGE from sysexits.h
# not reached
;;
(*)
break
;;
esac
done
if [ -h "${here}/var" ]; then
log "Warning: ${here}/var should not be a symbolic link. Removing it"
rm -f "${here}/var" || true
fi
if [ -n "$log_to_file" ]; then
app=
log_filename=
if [[ -z "${STEAM_COMPAT_APP_ID-}" && -z "${SteamAppId-}" ]]; then
app="non-steam-game"
else
app="app${STEAM_COMPAT_APP_ID-${SteamAppId}}"
fi
log_filename="slr-${app}-t$(date +'%Y%m%dT%H%M%S').log"
mkdir -p "${log_dir}"
# Remove older logs of the same app
if [ -z "${keep_logs}" ]; then
find "${log_dir}" -maxdepth 1 -name "slr-${app}-*.log" '!' -name "${log_filename}" -type f -delete
fi
ln -fns "${log_filename}" "${log_dir}/slr-latest.log" || :
if [ -z "$is_main" ] || [ -n "${PRESSURE_VESSEL_BATCH-}" ]; then
# If we are running setup commands, or if we are gathering a system
# information report, we only redirect stderr to the log, on the
# assumption that stderr is for human-readable diagnostics but
# stdout could be for machine-readable output.
exec 2>> "${log_dir}/${log_filename}"
else
exec >> "${log_dir}/${log_filename}" 2>&1
fi
export PRESSURE_VESSEL_LOG_INFO=1
export PRESSURE_VESSEL_LOG_WITH_TIMESTAMP=1
fi
info "argv: $(printf '%q ' "$@")"
if [ "$#" -eq 0 ] || [ "$1" = -- ]; then
log "Error: A command to run is required"
usage 125
fi
# At this point $LD_LIBRARY_PATH might
# 1. be equal to $STEAM_RUNTIME_LIBRARY_PATH (e.g. a game without
# any special launch options).
# 2. contain all the entries of $STEAM_RUNTIME_LIBRARY_PATH, plus eventually
# any additional paths from the game launch options (e.g. a game launched
# with "LD_LIBRARY_PATH=/my_game_path:${LD_LIBRARY_PATH} %command%")
# 3. contain just new entries from the game launch options (e.g. a game
# launched with "LD_LIBRARY_PATH=/my_game_path %command%")
# 4. being unset or empty (e.g. a game launched with
# "LD_LIBRARY_PATH="" %command%")
#
# We extract all the entries from $LD_LIBRARY_PATH that are not under the
# $STEAM_RUNTIME paths. In this way we should end up with a list of paths
# that are from the system $LD_LIBRARY_PATH, the system "ldconfig" and the
# manually set $LD_LIBRARY_PATH paths from the game launch options.
case "${STEAM_RUNTIME-}" in
(/*)
oldIFS="$IFS"
IFS=:
paths=
for path in ${LD_LIBRARY_PATH-}; do
if [ "${path}" == "${STEAM_RUNTIME}" ]; then
# path is exactly the ${STEAM_RUNTIME}; ignore
continue
elif [ "${path#"${STEAM_RUNTIME}/"}" != "${path}" ]; then
# path is ${STEAM_RUNTIME}/...; ignore
continue
else
# keep it (note that we discard the extra leading ":" later)
paths="${paths}:${path}"
fi
done
IFS="$oldIFS"
export PRESSURE_VESSEL_APP_LD_LIBRARY_PATH="${paths#:}"
;;
(*)
# use LD_LIBRARY_PATH as-is
export PRESSURE_VESSEL_APP_LD_LIBRARY_PATH="${LD_LIBRARY_PATH-}"
;;
esac
old_IFS="$IFS"
IFS=": "
for word in $ld_preload; do
if [ -n "$word" ]; then
container_args+=("--ld-preload=$word")
fi
done
IFS="$old_IFS"
if [ -x "$here/pressure-vessel/bin/steam-runtime-launcher-interface-0" ]; then
set -- \
"$here/pressure-vessel/bin/steam-runtime-launcher-interface-0" \
container-runtime \
"$@"
elif command -v steam-runtime-launcher-interface-0 >/dev/null; then
set -- \
steam-runtime-launcher-interface-0 \
container-runtime \
"$@"
fi
unset LD_LIBRARY_PATH
unset STEAM_RUNTIME
if [ -z "${suite}" ]; then
run=run
else
run="run-in-${suite}"
fi
exec "${here}/${run}" \
${container_args[0]+"${container_args[@]}"} \
-- \
"$@" \
${NULL+}
exit 125
# vim:set sw=4 sts=4 et:
steam-container-runtime (0) UNRELEASED; urgency=medium
* This is not a real Debian package. It's only here as a way to
provide automated tests in autopkgtest format.
-- Simon McVittie <smcv@collabora.com> Wed, 06 Mar 2019 11:51:41 +0000
Source: steam-container-runtime
Section: misc
Priority: extra
Maintainer: SteamOS Maintainers <steamos@valvesoftware.com>
Standards-Version: 4.3.0
Vcs-Git: https://gitlab.steamos.cloud/steamrt/steamlinuxruntime.git
Vcs-Browser: https://gitlab.steamos.cloud/steamrt/steamlinuxruntime
Package: steam-container-runtime
Architecture: all
Description: Not a real package
This package description is only here as a way to run tests using
Debian's autopkgtest tool. Don't build it.
#!/usr/bin/make -f
build:
@echo "This is not really a Debian package. Don't build it."
@false
clean:
@:
binary-arch: build
binary-indep: build
binary: binary-indep binary-arch
build-arch: build
build-indep: build
Tests: depot
Depends:
bubblewrap,
file,
libc6:i386,
libegl1 | libegl1-mesa,
libgl1 | libgl1-mesa-glx,
libgl1-mesa-dri,
libgl1-mesa-dri:i386,
libgl1:i386 | libgl1-mesa-glx:i386,
libgles2 | libgles2-mesa,
libglx0 | libgl1-mesa-glx (<< 18),
libopengl0 | libgl1-mesa-glx (<< 18),
locales,
python3,
xauth,
xvfb,
Restrictions: allow-stderr, isolation-machine
#!/bin/sh
# Copyright © 2019-2020 Collabora Ltd.
# SPDX-License-Identifier: MIT
export PYTHONUNBUFFERED=1
exec xvfb-run -a -e /proc/self/fd/2 \
tests/depot/pressure-vessel.py
Steam client - manifest.vdf v2 compat tools
===========================================
manifest.vdf keys:
------------------
"version" "1":
--------------
"commandline"
"commandline_getcompatpath"
"commandline_waitforexitandrun"
Still supported for backwards compatibility.
"version" "2":
--------------
"commandline"
"require_tool_appid"
"use_sessions"
"commandline" supports the expansion of a "%verb%" keyword.
examples:
---------
Proton 5.13 with soldier SLR:
"manifest"
{
"version" "2"
"commandline" "/proton %verb%"
// Require the soldier SLR tool
"require_tool_appid" "1391110"
// Enable session mode
"use_sessions" "1"
}
soldier SLR (1391110):
"manifest"
{
"version" "2"
"commandline" "/run %verb%"
}
Environment:
------------
Unchanged variables:
--------------------
STEAM_COMPAT_DATA_PATH
STEAM_COMPAT_CONFIG
STEAM_COMPAT_CLIENT_INSTALL_PATH
New variables:
--------------
STEAM_COMPAT_APP_ID
STEAM_COMPAT_SESSION_ID
Only set when session mode is requested. Otherwise execute a single command, no session.
STEAM_COMPAT_APP_LIBRARY_PATH
STEAM_COMPAT_TOOL_PATHS
':'-separated list of compat tool paths and other paths to be mounted in the container
Workflow:
---------
Create a session whenever a new STEAM_COMPAT_SESSION_ID comes through. We do not plan to add an "open session" command.
Close the session after a "waitforexitandrun" verb. We plan to replace this with a "close session" command at some point,
as it will not support running multiple apps in the same session. But it will be adequate for now.
Any run with a compat tool can be forced to use session mode by setting STEAM_COMPAT_FORCE_SESSIONS=1
This diff is collapsed.
Container based Steam Runtime v1 'scout'
========================================
This experimental container-based release of the Steam Runtime
is enabled on a per-title basis by forcing its use in the title's
Properties dialog.
This version of the Steam Runtime uses the traditional
`LD_LIBRARY_PATH`-based Steam Runtime, but launches it in a container
using the "Steam Linux Runtime - soldier" compatibility tool, for
compatibility with games that were not compiled in a correct
Steam Runtime 1 'scout' environment. This produces a result similar to
running the traditional `LD_LIBRARY_PATH`-based Steam Runtime on a
Debian 10 system, so games that work in that environment are likely to
work in this container too.
Known issues
------------
Please see
https://github.com/ValveSoftware/steam-runtime/blob/master/doc/steamlinuxruntime-known-issues.md
Reporting bugs
--------------
Please see
https://github.com/ValveSoftware/steam-runtime/blob/master/doc/reporting-steamlinuxruntime-bugs.md
Development and debugging
-------------------------
See `SteamLinuxRuntime_soldier/README.md` for details of the container
runtime.
This additional layer uses a `LD_LIBRARY_PATH`-based Steam Runtime to
provide the required libraries for the Steam Runtime version 1 ABI.
By default, it will use the version in the Steam installation directory,
`~/.steam/root/ubuntu12_32/steam-runtime` (normally this is the same as
`~/.local/share/Steam/ubuntu12_32/steam-runtime`). You can use a different
version of Steam Runtime 1 'scout' by unpacking a `steam-runtime.tar.xz`
into the `SteamLinuxRuntime/steam-runtime/` directory, so that you have
files like `SteamLinuxRuntime/steam-runtime/run.sh`.
If you have `SteamLinuxRuntime` and `SteamLinuxRuntime_soldier` installed
in the same Steam library, you can use `run-in-scout-on-soldier` to test
commands in the scout-on-soldier environment, for example:
.../steamapps/common/SteamLinuxRuntime/run-in-scout-on-soldier -- xterm
Licensing and copyright
-----------------------
The Steam Runtime contains many third-party software packages under
various open-source licenses.
For full source code, please see the version-numbered subdirectories of
<https://repo.steampowered.com/steamrt-images-scout/snapshots/>
corresponding to the version numbers listed in VERSIONS.txt.
#!/usr/bin/env bash
# Copyright 2021 Collabora Ltd.
# SPDX-License-Identifier: MIT
set -eu
set -o pipefail
echo "*** Steam restart required for this Steam Linux Runtime update" >&2
"${STEAM_ZENITY:-zenity}" \
--error \
--title="Steam restart required" \
--width=400 \
--text="\
This version of the Steam Linux Runtime requires a configuration update.
Please exit from Steam completely, then launch Steam again.\
"
exit 1
# vim:set sw=4 sts=4 et:
#!/usr/bin/env bash
# Copyright 2022 Collabora Ltd.
# SPDX-License-Identifier: MIT
set -eu
set -o pipefail
me="$(readlink -f "$0")"
here="${me%/*}"
me="${me##*/}"
echo "$me: Developer script, not for production use" >&2
if ! [ -x "${here}/../SteamLinuxRuntime_soldier/run" ]; then
echo "$me: This convenience script assumes SteamLinuxRuntime and" \
"SteamLinuxRuntime_soldier are in the same directory" >&2
exit 127
fi
exec "${here}/../SteamLinuxRuntime_soldier/run" -- \
"${here}/scout-on-soldier-entry-point-v2" "$@"
# vim:set sw=4 sts=4 et:
#!/usr/bin/env bash
# Copyright 2021 Collabora Ltd.
# SPDX-License-Identifier: MIT
set -eu
set -o pipefail
# Don't load the Steam Overlay into this helper script. Put it back later.
saved_ld_preload="${LD_PRELOAD-}"
unset LD_PRELOAD
me="$(readlink -f "$0")"
here="${me%/*}"
log () {
printf '%s\n' "${me}[$$]: $*" >&2 || :
}
usage () {
local code="$1"
shift
if [ "$code" -ne 0 ]; then
exec >&2
fi
echo "Usage:"
echo "$me [OPTIONS] [--] COMMAND [ARGS...]"
echo
echo "Run a command in the scout Steam Runtime."
echo
echo "Required arguments:"
echo "COMMAND [ARGS...] Run this."
echo
echo "Options:"
echo "--verb=%verb% Mode to operate in [default=waitforexitandrun]."
exit "${code}"
}
main () {
local getopt_temp="help"
local ours
local runtime
local src
local theirs
local theirs_should_be
local verbose=
if [ "${STEAM_LINUX_RUNTIME_VERBOSE-}" = 1 ]; then
verbose=yes
fi
getopt_temp="$getopt_temp,verb:"
getopt_temp="$getopt_temp,verbose"
getopt_temp="$(getopt -o '' --long "$getopt_temp" -n "$me" -- "$@")"
eval "set -- $getopt_temp"
unset getopt_temp
while [ "$#" -gt 0 ]; do
case "$1" in
(--help)
usage 0
# not reached
;;
(--verb)
case "$2" in
(run|waitforexitandrun)
;;
(*)
log "Ignoring unknown Steam compatibility interface verb: $2"
;;
esac
shift 2
;;
(--verbose)
verbose=yes
shift
;;
(--)
shift
break
;;
(-*)
log "Unknown option: $1"
usage 125
# not reached
;;
(*)
break
;;
esac
done
if [ "$#" -eq 0 ] || [ "$1" = -- ]; then
log "Error: A command to run is required"
usage 125
fi
mkdir -p "${here}/var"
if [ "${STEAM_LINUX_RUNTIME_LOG-}" = 1 ]; then
echo "See SteamLinuxRuntime_soldier/var/ for newer" \
"SteamLinuxRuntime log files." \
> "${here}/var/.slr-latest.log.$$"
mv -f "${here}/var/.slr-latest.log.$$" "${here}/var/slr-latest.log"
fi
[ -z "$verbose" ] || log "Command to run: $(printf '%q ' "$@")"
# Just because zenity was available on the host system doesn't mean
# it's available in this container. soldier historically didn't have it,
# but it was added in 0.20210618.0.
if [ -x /usr/bin/zenity ]; then
export STEAM_ZENITY=/usr/bin/zenity
else
unset STEAM_ZENITY
fi
if [ -d "${here}/steam-runtime" ]; then
src="${here}/steam-runtime"
[ -z "$verbose" ] || log "Using local scout runtime ${src}"
rm -fr "${here}/var/unpack"
elif [ -n "${STEAM_RUNTIME_SCOUT-}" ] && [ -d "${STEAM_RUNTIME_SCOUT-}" ]; then
src="${STEAM_RUNTIME_SCOUT}"
[ -z "$verbose" ] || log "Using specified scout runtime ${src}"
rm -fr "${here}/var/unpack"
else
src="${STEAM_COMPAT_CLIENT_INSTALL_PATH:-"$HOME/.steam/root"}/ubuntu12_32/steam-runtime"
theirs="$(cat "$src/checksum" || echo none)"
theirs_should_be="$(cat "${src}.checksum")"
if [ "$theirs" = "$theirs_should_be" ]; then
[ -z "$verbose" ] || log "Using default scout runtime ${src}"
rm -fr "${here}/var/unpack"
else
log "warning: $src is not the expected version"
log "warning: expected: $theirs_should_be"
log "warning: found: $theirs"
if [ -d "${here}/var/unpack" ]; then
ours="$(cat "${here}/var/unpack/steam-runtime/checksum" || echo none)"
else
ours=none
fi
if [ "$theirs_should_be" != "$ours" ]; then
# Recover by unpacking a copy locally.
log "Recovering by unpacking $src.tar.xz* into ${here}/var/unpack..."
mkdir -p "${here}/var/unpack"
cat "$src.tar.xz".* | tar -C "${here}/var/unpack" -Jxf-
echo "$theirs_should_be" > "${here}/var/unpack/steam-runtime/checksum"
fi
src="${here}/var/unpack/steam-runtime"
[ -z "$verbose" ] || log "Falling back to using ${src}"
fi
fi
# Note that this only works because run.sh does not take the
# $(realpath) of its $0, and because we are no longer using setup.sh,
# which uses the equivalent of $(find ${top} -type l -name '*.so*')
# to list the libraries in the runtime (which wouldn't recurse into
# the subdirectories of var/steam-runtime in our case).
runtime="${here}/var/steam-runtime"
mkdir -p "$runtime"
if [ -e "$runtime/version.txt" ]; then
ours="$(cat "$runtime/version.txt" || echo none)"
else
ours=none
fi
theirs="$(cat "$src/version.txt")"
if [ "$ours" != "$theirs" ]; then
[ -z "$verbose" ] || log "scout runtime switched from '$ours' to '$theirs'"
printf '%s\n' "$theirs" > "$runtime/version.txt"
else
[ -z "$verbose" ] || log "scout runtime version '$ours'"
fi
ln -fns "$src/amd64" "$runtime/"
ln -fns "$src/i386" "$runtime/"
ln -fns "$src/lib" "$runtime/"
ln -fns "$src/run.sh" "$runtime/"
ln -fns "$src/scripts" "$runtime/"
ln -fns "$src/setup.sh" "$runtime/"
ln -fns "$src/usr" "$runtime/"
mkdir -p "$runtime/pinned_libs_32"
mkdir -p "$runtime/pinned_libs_64"
# We know exactly what's in the soldier and scout runtimes, and we
# know soldier is strictly newer in all cases, so the only libraries
# we need to pin are those that we have hard-coded to be pinned;
# so we don't need to run setup.sh, and can do something more
# abbreviated.
# libcurl in the Steam Runtime is internally identified
# as libcurl.so.4, but with a symlink at libcurl.so.3
# as a result of some unfortunate ABI weirdness back in
# 2007. It also has Debian-specific symbol versioning as a
# result of the versioned symbols introduced as a
# Debian-specific change in 2005-2006, which were preserved
# across the rename from libcurl.so.3 to libcurl.so.4, not
# matching the versioned symbols that upstream subsequently
# added to libcurl.so.4; as a result, a system libcurl.so.4
# probably isn't going to be a drop-in replacement for our
# libcurl.
#
# Debian/Ubuntu subsequently (in 2018) switched to a SONAME
# and versioning that match upstream, but the Steam Runtime
# is based on a version that is older than that, so anything
# built against the Steam Runtime will expect the old SONAME
# and versioned symbols; make sure we use the Steam Runtime
# version.
ln -fns "$src/usr/lib/x86_64-linux-gnu/libcurl.so.4" \
"$runtime/pinned_libs_64/libcurl.so.4"
ln -fns "$src/usr/lib/i386-linux-gnu/libcurl.so.4" \
"$runtime/pinned_libs_32/libcurl.so.4"
# The version of libcurl.so.4 in the Steam Runtime is actually
# binary-compatible with the older libcurl.so.3 in Debian/Ubuntu,
# so pin it under both names.
ln -fns "$src/usr/lib/x86_64-linux-gnu/libcurl.so.4" \
"$runtime/pinned_libs_64/libcurl.so.3"
ln -fns "$src/usr/lib/i386-linux-gnu/libcurl.so.4" \
"$runtime/pinned_libs_32/libcurl.so.3"
# Deliberately not pinning libcurl-gnutls.so.[34]: soldier has a
# newer version of those, which is believed to be compatible with the
# ones in scout.
# Deliberately not pinning 32-bit libgtk-x11-2.0.so.0,
# libdbusmenu-gtk.so.4, libdbusmenu-glib.so.4, libdbus-1.so.3:
# in the normal scout runtime those are pinned for the benefit of the
# Steam client itself, but let's try keeping 32-bit games consistent
# with 64-bit games.
if command -v steam-runtime-launcher-interface-0 >/dev/null; then
set -- \
steam-runtime-launcher-interface-0 \
scout-in-container:scout-on-soldier \
"$@"
fi
if [ -n "$saved_ld_preload" ]; then
case "$1" in
(*=*)
# Replace inadvisable executable name with something env(1)
# will not misinterpret
set -- sh -euc 'exec -- "$@"' sh "$@"
;;
esac
set -- env LD_PRELOAD="$saved_ld_preload" "$@"
fi
[ -z "$verbose" ] || log "Running: $runtime/run.sh $(printf '%q ' "$@")"
exec "$runtime/run.sh" "$@"
# This should never be reached
exit 1
}
main "$@"
# vim:set sw=4 sts=4 et:
"manifest"
{
"version" "2"
"commandline" "/scout-on-soldier-entry-point-v2 --"
"compatmanager_layer_name" "scout-in-container"
"require_tool_appid" "1391110"
}
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