proton_valve.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. # usage: proton_valve.sh <proton-experimental|proton-11|proton-10|proton-9|proton-8|proton-7|proton-hotfix>
  3. # Valve's Proton builds from Steam's CDN, the current build of that branch into $PROTON_DIR/<name> (run again to
  4. # update). Files come from DepotDownloader, which writes symlinks as empty files and keeps their targets encrypted,
  5. # so steam_manifest_links.py fixes them up with the depot key (from the python steam package in a venv).
  6. # Only Proton Experimental is served to anonymous logins (steamcmd refuses even that one: "No subscription");
  7. # the others need STEAM_USER=<account>, which asks for the password / Steam Guard code (run it in a terminal).
  8. HERE=$(cd "$(dirname "$0")" && pwd)
  9. P=${PROTON_DIR:-$HOME/.local/share/proton}
  10. DDV=3.4.0
  11. DD=$P/tools/depotdownloader/DepotDownloader
  12. PY=$P/tools/steampy/bin/python
  13. case $1 in
  14. proton-experimental) app=1493710 ;;
  15. proton-11) app=4628710 ;;
  16. proton-10) app=3658110 ;;
  17. proton-9) app=2805730 ;;
  18. proton-8) app=2348590 ;;
  19. proton-7) app=1887720 ;;
  20. proton-hotfix) app=2180100 ;;
  21. *) echo "unknown Valve build $1"; exit 1 ;;
  22. esac
  23. # the main depot is app id + 1, the others are optional contrib dlls
  24. depot=$((app + 1))
  25. if [ ! -x "$DD" ]; then
  26. mkdir -p "$P/tools/depotdownloader" && cd "$P/tools/depotdownloader" || exit 1
  27. curl -fsSLO "https://github.com/SteamRE/DepotDownloader/releases/download/DepotDownloader_$DDV/DepotDownloader-linux-x64.zip" || exit 1
  28. unzip -oq DepotDownloader-linux-x64.zip && chmod +x DepotDownloader && rm DepotDownloader-linux-x64.zip
  29. fi
  30. if [ ! -x "$PY" ]; then
  31. # gevent in the steam package doesn't build on 3.14 yet
  32. python3.13 -m venv "$P/tools/steampy" && "$P/tools/steampy/bin/pip" -q install "steam[client]" || exit 1
  33. fi
  34. login=()
  35. [ -n "$STEAM_USER" ] && login=(-username "$STEAM_USER" -remember-password)
  36. cd "$P/tools/depotdownloader" || exit 1
  37. "$DD" -app $app -depot $depot -dir "$P/$1" -validate "${login[@]}" || exit 1
  38. key=$("$PY" -I - $app $depot "$STEAM_USER" <<'PY'
  39. import sys
  40. from steam.client import SteamClient
  41. app, depot, user = int(sys.argv[1]), int(sys.argv[2]), sys.argv[3]
  42. c = SteamClient()
  43. if (c.cli_login(user) if user else c.anonymous_login()) != 1:
  44. sys.exit('steam login failed')
  45. r = c.get_depot_key(app, depot)
  46. if r.eresult != 1:
  47. sys.exit('no depot key (eresult %d)' % r.eresult)
  48. print(r.depot_encryption_key.hex())
  49. PY
  50. ) || exit 1
  51. "$PY" -I "$HERE/steam_manifest_links.py" "$P/$1" "$key" || exit 1
  52. [ -x "$P/$1/proton" ] || { echo "no proton script in $P/$1"; exit 1; }
  53. bash "$HERE/proton.sh" env "$1" >/dev/null
  54. echo "installed $P/$1 ($(cat "$P/$1/version"))"