From b6f3519a0bd0427c3ee82673427ad474213e2fb8 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Wed, 26 May 2021 19:15:51 +0100
Subject: [PATCH] system-info: Make STEAM_RUNTIME take precedence over
 os-release

If we're running the scout runtime inside a soldier container, then
we want to be reporting facts about the scout runtime.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 steam-runtime-tools/system-info.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/steam-runtime-tools/system-info.c b/steam-runtime-tools/system-info.c
index 3074de023..67b2b2b19 100644
--- a/steam-runtime-tools/system-info.c
+++ b/steam-runtime-tools/system-info.c
@@ -2562,7 +2562,17 @@ ensure_runtime_cached (SrtSystemInfo *self)
   if (self->runtime.issues == SRT_RUNTIME_ISSUES_NONE &&
       self->runtime.path == NULL)
     {
-      if (g_strcmp0 (self->os_release.id, "steamrt") == 0)
+      const char *runtime = g_environ_getenv (self->env, "STEAM_RUNTIME");
+
+      if (runtime != NULL && runtime[0] == '/' && runtime[1] != '\0')
+        {
+          self->runtime.issues = _srt_runtime_check (srt_steam_get_bin32_path (self->steam_data),
+                                                     self->runtime.expected_version,
+                                                     self->env,
+                                                     &self->runtime.version,
+                                                     &self->runtime.path);
+        }
+      else if (g_strcmp0 (self->os_release.id, "steamrt") == 0)
         {
           self->runtime.path = g_strdup ("/");
           self->runtime.version = g_strdup (self->os_release.build_id);
-- 
GitLab