Skip to content

Commit d034649

Browse files
authored
Fix installation for experimental appId 1890870 (#49)
* Fix installation for experimental appId 1890870 - Added a known workround (thanks ceo_of_bacon) that ensures the experimental app is installed sucessfully * Fix python black linting errors in launch.py * Refactor platform switch logic in launch.py - Introduced a sentinel file ensuring the platform switch only runs once to avoid unnecessary redownloads on restarts. * Actually create the sentinel file (smh)
1 parent d8c818b commit d034649

File tree

1 file changed

+71
-14
lines changed

1 file changed

+71
-14
lines changed

launch.py

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import random
44
import re
55
import subprocess
6+
from pathlib import Path
67

78
CONFIG_GENERATED = "/reforger/Configs/docker_generated.json"
89

@@ -24,22 +25,78 @@ def bool_str(text):
2425
return text.lower() == "true"
2526

2627

28+
SENTINEL_WINDOWS_FIX = "/reforger/.windows_fix_done"
29+
30+
# Clear Windows fix sentinel if switching away from experimental appId
31+
if Path(SENTINEL_WINDOWS_FIX).exists() and os.environ["STEAM_APPID"] != "1890870":
32+
Path(SENTINEL_WINDOWS_FIX).unlink()
33+
2734
if os.environ["SKIP_INSTALL"] in ["", "false"]:
28-
steamcmd = ["/steamcmd/steamcmd.sh"]
29-
steamcmd.extend(["+force_install_dir", "/reforger"])
30-
if env_defined("STEAM_USER"):
31-
steamcmd.extend(
32-
["+login", os.environ["STEAM_USER"], os.environ["STEAM_PASSWORD"]]
33-
)
35+
# Special handling for experimental appId 1890870
36+
if os.environ["STEAM_APPID"] == "1890870":
37+
# We only need the Windows pass once to work around this bug. On subsequent
38+
# launches just perform the normal Linux update so we don't waste bandwidth.
39+
run_windows_pass = not Path(SENTINEL_WINDOWS_FIX).exists()
40+
41+
subprocess.call(["/steamcmd/steamcmd.sh", "+login", "anonymous", "+quit"])
42+
43+
if run_windows_pass:
44+
steamcmd_win = ["/steamcmd/steamcmd.sh"]
45+
steamcmd_win.extend(["+force_install_dir", "/reforger"])
46+
if env_defined("STEAM_USER"):
47+
steamcmd_win.extend(
48+
["+login", os.environ["STEAM_USER"], os.environ["STEAM_PASSWORD"]]
49+
)
50+
else:
51+
steamcmd_win.extend(["+login", "anonymous"])
52+
steamcmd_win.extend(["+@sSteamCmdForcePlatformType", "windows"])
53+
steamcmd_win.extend(["+app_update", os.environ["STEAM_APPID"]])
54+
if env_defined("STEAM_BRANCH"):
55+
steamcmd_win.extend(["-beta", os.environ["STEAM_BRANCH"]])
56+
if env_defined("STEAM_BRANCH_PASSWORD"):
57+
steamcmd_win.extend(
58+
["-betapassword", os.environ["STEAM_BRANCH_PASSWORD"]]
59+
)
60+
steamcmd_win.extend(["validate", "+quit"])
61+
subprocess.call(steamcmd_win)
62+
Path(SENTINEL_WINDOWS_FIX).touch()
63+
64+
# Install with Linux platform
65+
steamcmd_linux = ["/steamcmd/steamcmd.sh"]
66+
steamcmd_linux.extend(["+force_install_dir", "/reforger"])
67+
if env_defined("STEAM_USER"):
68+
steamcmd_linux.extend(
69+
["+login", os.environ["STEAM_USER"], os.environ["STEAM_PASSWORD"]]
70+
)
71+
else:
72+
steamcmd_linux.extend(["+login", "anonymous"])
73+
steamcmd_linux.extend(["+@sSteamCmdForcePlatformType", "linux"])
74+
steamcmd_linux.extend(["+app_update", os.environ["STEAM_APPID"]])
75+
if env_defined("STEAM_BRANCH"):
76+
steamcmd_linux.extend(["-beta", os.environ["STEAM_BRANCH"]])
77+
if env_defined("STEAM_BRANCH_PASSWORD"):
78+
steamcmd_linux.extend(
79+
["-betapassword", os.environ["STEAM_BRANCH_PASSWORD"]]
80+
)
81+
steamcmd_linux.extend(["validate", "+quit"])
82+
subprocess.call(steamcmd_linux)
3483
else:
35-
steamcmd.extend(["+login", "anonymous"])
36-
steamcmd.extend(["+app_update", os.environ["STEAM_APPID"]])
37-
if env_defined("STEAM_BRANCH"):
38-
steamcmd.extend(["-beta", os.environ["STEAM_BRANCH"]])
39-
if env_defined("STEAM_BRANCH_PASSWORD"):
40-
steamcmd.extend(["-betapassword", os.environ["STEAM_BRANCH_PASSWORD"]])
41-
steamcmd.extend(["validate", "+quit"])
42-
subprocess.call(steamcmd)
84+
# Standard installation for other appIds
85+
steamcmd = ["/steamcmd/steamcmd.sh"]
86+
steamcmd.extend(["+force_install_dir", "/reforger"])
87+
if env_defined("STEAM_USER"):
88+
steamcmd.extend(
89+
["+login", os.environ["STEAM_USER"], os.environ["STEAM_PASSWORD"]]
90+
)
91+
else:
92+
steamcmd.extend(["+login", "anonymous"])
93+
steamcmd.extend(["+app_update", os.environ["STEAM_APPID"]])
94+
if env_defined("STEAM_BRANCH"):
95+
steamcmd.extend(["-beta", os.environ["STEAM_BRANCH"]])
96+
if env_defined("STEAM_BRANCH_PASSWORD"):
97+
steamcmd.extend(["-betapassword", os.environ["STEAM_BRANCH_PASSWORD"]])
98+
steamcmd.extend(["validate", "+quit"])
99+
subprocess.call(steamcmd)
43100

44101
if os.environ["ARMA_CONFIG"] != "docker_generated":
45102
config_path = f"/reforger/Configs/{os.environ['ARMA_CONFIG']}"

0 commit comments

Comments
 (0)