From 460da31b8ba0c16ab0c8c694270c4893000e0f18 Mon Sep 17 00:00:00 2001 From: Tamas Csikel Date: Sun, 25 Oct 2026 17:35:02 +0100 Subject: [PATCH] Steam as a Fennec OS store app Split from the Fennec OS repository (apps/steam, tools/pkg/steam). The id is now support.bluefox.steam. The release workflow follows Valve's steam-launcher: a new Valve version becomes release v. The controller udev rules and the 32-bit libraries stay in the OS image. Co-Authored-By: Claude Opus 5.5 --- .gitattributes | 4 ++ .gitea/workflows/release.yml | 75 +++++++++++++++++++++++++++++ .gitignore | 2 + README.md | 20 ++++++++ app.toml | 16 ++++--- bin/smartfox-steam | 0 fetch-steam.sh | 77 ++++++++++++++++++++++++++++++ icon.svg | 10 ++++ package.sh | 91 ++++++------------------------------ 9 files changed, 211 insertions(+), 84 deletions(-) create mode 100644 .gitattributes create mode 100644 .gitea/workflows/release.yml create mode 100644 .gitignore create mode 100644 README.md mode change 100644 => 100755 bin/smartfox-steam create mode 100755 fetch-steam.sh create mode 100644 icon.svg mode change 100644 => 100755 package.sh diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..add667a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +* text=auto eol=lf +*.ttf binary +*.png binary +*.gpg binary diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..882b6dd --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,75 @@ +# Follows Valve's official steam-launcher: when Valve has a version that has +# no release here yet, builds the store package and publishes release +# v (tag on the current main). Every Monday, on every push to main, +# and by hand. +# +# Runner hygiene (shared host, little disk): runs in the runner image that is +# already on the host (no image pull), uses no `uses:` actions (no action +# cache), and deletes everything it made at the end. +name: release +on: + push: + branches: [main] + workflow_dispatch: + schedule: + - cron: "17 4 * * 1" +jobs: + release: + runs-on: build + container: + image: docker.gitea.com/runner-images:ubuntu-latest + env: + W: /tmp/fennec-steam + CARGO_HOME: /tmp/fennec-steam/cargo + RUSTUP_HOME: /tmp/fennec-steam/rustup + CARGO_TARGET_DIR: /tmp/fennec-steam/target + SDK_GIT: https://gitea.bluefox.support/fennec/sdk + SDK_TAG: v0.1.0 + steps: + - name: Checkout + run: | + mkdir -p "$W" + git clone --depth 1 --branch main \ + "${GITHUB_SERVER_URL%%://*}://oauth2:${{ secrets.GITHUB_TOKEN }}@${GITHUB_SERVER_URL#*://}/${GITHUB_REPOSITORY}.git" "$W/src" + export DEBIAN_FRONTEND=noninteractive + apt-get update -qq + apt-get install -y -qq --no-install-recommends gpgv dpkg >/dev/null + rm -rf /var/lib/apt/lists/* + - name: New Valve version? + id: check + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + v=$(bash "$W/src/fetch-steam.sh" --version) + code=$(curl -s -o /dev/null -w '%{http_code}' -H "Authorization: token $TOKEN" \ + "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/tags/v$v") + echo "Valve: $v, release v$v: HTTP $code" + echo "version=$v" >> "$GITHUB_OUTPUT" + [ "$code" = 200 ] && echo "new=0" >> "$GITHUB_OUTPUT" || echo "new=1" >> "$GITHUB_OUTPUT" + - name: Build + if: steps.check.outputs.new == '1' + run: | + curl -sSf https://sh.rustup.rs | sh -s -- -y -q --profile minimal --no-modify-path + export PATH="$CARGO_HOME/bin:$PATH" + cargo install -q --locked --git "$SDK_GIT" --tag "$SDK_TAG" sf-pack + "$W/src/package.sh" + ls "$W"/src/dist | grep -q -- "-${{ steps.check.outputs.version }}.tar.zst$" || { echo "built another version" >&2; exit 1; } + - name: Release + if: steps.check.outputs.new == '1' + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + V: ${{ steps.check.outputs.version }} + run: | + api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases" + id=$(curl -fsS -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \ + -d "{\"tag_name\":\"v$V\",\"target_commitish\":\"main\",\"name\":\"v$V\",\"body\":\"Valve steam-launcher $V\"}" "$api" \ + | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2) + for f in "$W"/src/dist/*; do + curl -fsS -H "Authorization: token $TOKEN" -F "attachment=@$f" "$api/$id/assets?name=$(basename "$f")" >/dev/null + done + echo "released v$V" + - name: Clean up + if: always() + run: | + rm -rf "$W" + df -h / | tail -1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3cfe00f --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/pkg +/dist diff --git a/README.md b/README.md new file mode 100644 index 0000000..08269ce --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# Steam for Fennec OS + +A hivatalos Steam kliens Fennec OS store appként, kontrollerrel kezelhető Big Picture felülettel. + +- **Forrás:** Valve hivatalos `steam-launcher` csomagja a `repo.steampowered.com`-ról ([fetch-steam.sh](fetch-steam.sh)). +- **Ellenőrzés:** az `InRelease` Valve kulcsával aláírt ([valve-archive-keyring.gpg](valve-archive-keyring.gpg); ugyanaz a kulcs, ami a csomagban van, ujjlenyomat: `BA18 16EF 8E75 005F CF5E 27A1 F24A EA9F B054 98B7`). A `Packages` és a `.deb` SHA256-ja is egyezik. +- **Futás:** [bin/smartfox-steam](bin/smartfox-steam). A `gamescope` (Valve kompozitora, mint a Steam Decken) X szervert ad a Steam kliensnek és a játékoknak, és egy Wayland-ablakként mutatja őket. A Steam a kontrolleres felületével indul (`-gamepadui`). A játékok legfeljebb 1080p-ben renderelnek, a gamescope skálázza fel őket a TV felbontására. +- **Sandbox:** a Steam a saját konténerében (pressure-vessel) futtatja a játékokat, ez a TV sandboxába ágyazva fut. Engedélyei: `network`, `gpu`, `audio`, `gamepad`, `dbus-session`. Adatai és a játékok: `~/.local/share/smartfox/apps/support.bluefox.steam`. +- **Két szint frissül:** a Steam kliens maga is frissíti magát az adatmappájában (ezt a Valve kezeli). Ez az app a launchert (bootstrap) hozza. + +**A Fennec OS adja** (az image-ben), mert rendszerszintű: a `gamescope`, a 32 bites könyvtárak (`steam-libs-i386`, Valve apt-repójából) és a kontrollerek udev-szabályai (a Valve `steam-launcher` csomagjából). + +**Még nincs kipróbálva valódi TV-n:** gamescope beágyazott (nested) módban, Intel N100 Vulkannal, kontrollerrel. + +## Kiadás +A verzió mindig a Valve-é (pl. `1.0.0.87`). A [release workflow](.gitea/workflows/release.yml) hetente, minden `main`-pushkor és kézzel is lefut. Ha a Valve-nek van olyan verziója, amihez itt még nincs release, megépíti a csomagot, és kiadja `v` néven. + +Ha a wrapper (`bin/`) változik, a következő Valve-verzióval jut ki. Ennek oka, hogy a verzió négy tagja mind a Valve-é. + +Helyben, Linuxon: `./package.sh` (`curl`, `gpgv`, `dpkg-deb` és `sf-pack` kell hozzá). Az eredmény a `dist/` mappába kerül. diff --git a/app.toml b/app.toml index 099a221..537fd46 100644 --- a/app.toml +++ b/app.toml @@ -1,21 +1,25 @@ -id = "steam" +# Fennec OS store app manifest (docs/store-app-guide.md in the Fennec SDK). +id = "support.bluefox.steam" name = "Steam" -# Set by tools/pkg/steam/package.sh to the official steam-launcher version: -# the package (sf-app-steam) is rebuilt whenever Valve releases a new one. +# Set by fetch-steam.sh to the official steam-launcher version: a release is +# made whenever Valve publishes a new one. version = "0.0.0" kind = "exec" category = "Játékok" description = "A hivatalos Steam kliens, kontrollerrel kezelhető Big Picture felülettel. Az első indításkor letölti magát, ez néhány percig tart." +author = "Bluefox" +# The wrapper and the packaging; Steam itself is Valve's (steam/COPYRIGHT). +license = "MIT" +homepage = "https://gitea.bluefox.support/fennec/steam" # gamescope (Valve's own compositor, as on the Steam Deck) hosts the X11 # Steam client and the games, and scales them to the TV. exec = ["bin/smartfox-steam"] -icon = "steam" +icon = "icon.svg" accent = "#66C0F4" palette = ["#66c0f4", "#1b4f7a", "#060b12"] -order = 25 [sandbox] # Steam runs its games in its own container (pressure-vessel), nested in # this sandbox. Its data, games included, are in the app's data folder -# (~/.local/share/smartfox/apps/steam). +# (~/.local/share/smartfox/apps/support.bluefox.steam). permissions = ["network", "gpu", "audio", "gamepad", "dbus-session"] diff --git a/bin/smartfox-steam b/bin/smartfox-steam old mode 100644 new mode 100755 diff --git a/fetch-steam.sh b/fetch-steam.sh new file mode 100755 index 0000000..ee612f2 --- /dev/null +++ b/fetch-steam.sh @@ -0,0 +1,77 @@ +#!/usr/bin/env bash +# Valve's official Steam launcher: downloads the newest steam-launcher .deb +# from repo.steampowered.com, checks it against Valve's signed repository +# index, and puts the launcher into an app folder. +# +# fetch-steam.sh --version prints the newest official version (1.0.0.87) +# fetch-steam.sh fills (with app.toml in it) and sets +# the version in its app.toml +# +# Used by package.sh, which the release workflow runs. +# +# Trust: valve-archive-keyring.gpg is the keyring from the steam-launcher +# package itself (Valve Corporation, BA18 16EF 8E75 005F CF5E 27A1 F24A EA9F +# B054 98B7, and the 2025 repository key). InRelease must be signed by it, the +# Packages index must match its SHA256, the .deb must match the index. +set -euo pipefail + +HERE="$(cd "$(dirname "$0")" && pwd)" +REPO="${STEAM_REPO:-https://repo.steampowered.com/steam}" +KEYRING="$HERE/valve-archive-keyring.gpg" +TMP=$(mktemp -d) +trap 'rm -rf "$TMP"' EXIT + +curl -fsSL -o "$TMP/InRelease" "$REPO/dists/stable/InRelease" +if ! gpgv --keyring "$KEYRING" --output "$TMP/Release" "$TMP/InRelease" 2>"$TMP/gpgv.log"; then + cat "$TMP/gpgv.log" >&2 + echo "steam: InRelease is not signed by Valve's key" >&2 + exit 1 +fi +want=$(awk '/^SHA256:/ {f = 1; next} /^[^ ]/ {f = 0} f && $3 == "steam/binary-amd64/Packages" {print $1}' "$TMP/Release") +[ -n "$want" ] || { echo "steam: no Packages checksum in Release" >&2; exit 1; } +curl -fsSL -o "$TMP/Packages" "$REPO/dists/stable/steam/binary-amd64/Packages" +echo "$want $TMP/Packages" | sha256sum -c --quiet - || { echo "steam: Packages checksum mismatch" >&2; exit 1; } + +# The newest steam-launcher in the index: "versionfilenamesha256". +best=$(awk -v RS= -v FS='\n' ' + $0 ~ /(^|\n)Package: steam-launcher(\n|$)/ { + v = f = s = "" + for (i = 1; i <= NF; i++) { + if ($i ~ /^Version: /) v = substr($i, 10) + if ($i ~ /^Filename: /) f = substr($i, 11) + if ($i ~ /^SHA256: /) s = substr($i, 9) + } + sub(/^[0-9]+:/, "", v) + print v "\t" f "\t" s + }' "$TMP/Packages" | sort -t "$(printf '\t')" -k1,1V | tail -1) +IFS=$'\t' read -r version file sha <<<"$best" +case "$version" in + "" | *[!0-9.]*) echo "steam: unexpected version '$version'" >&2; exit 1 ;; +esac +case "$file" in + pool/*.deb) ;; + *) echo "steam: unexpected file '$file'" >&2; exit 1 ;; +esac + +if [ "${1:-}" = --version ]; then + echo "$version" + exit 0 +fi +DIR="${1:?usage: fetch-steam.sh --version | }" +[ -f "$DIR/app.toml" ] || { echo "steam: $DIR/app.toml is missing" >&2; exit 1; } + +curl -fsSL -o "$TMP/steam.deb" "$REPO/$file" +echo "$sha $TMP/steam.deb" | sha256sum -c --quiet - || { echo "steam: .deb checksum mismatch" >&2; exit 1; } +mkdir "$TMP/x" +dpkg-deb -x "$TMP/steam.deb" "$TMP/x" + +# The launcher script finds its bootstrap next to itself, and must be called +# "steam" (it uses its own name as the package name). +L="$TMP/x/usr/lib/steam" +install -Dm755 "$L/bin_steam.sh" "$DIR/steam/steam" +install -Dm644 "$L/bootstraplinux_ubuntu12_32.tar.xz" "$DIR/steam/bootstraplinux_ubuntu12_32.tar.xz" +# The controller udev rules in the .deb are installed by Fennec OS itself +# (the image), not by this app. +install -Dm644 "$TMP/x/usr/share/doc/steam-launcher/copyright" "$DIR/steam/COPYRIGHT" +sed -i "s/^version = .*/version = \"$version\"/" "$DIR/app.toml" +echo "$version" diff --git a/icon.svg b/icon.svg new file mode 100644 index 0000000..aebe180 --- /dev/null +++ b/icon.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/package.sh b/package.sh old mode 100644 new mode 100755 index 5adcace..5e6a9b5 --- a/package.sh +++ b/package.sh @@ -1,81 +1,16 @@ #!/usr/bin/env bash -# The Steam app from Valve's official package: downloads the newest -# steam-launcher .deb from repo.steampowered.com, checks it against Valve's -# signed repository index, and puts the launcher into an app folder. -# -# package.sh --version prints the newest official version (1.0.0.87) -# package.sh fills (a copy of apps/steam) and sets the -# version in its app.toml -# -# Used by tools/pkg/packages.sh (the sf-app-steam package, so Steam updates -# like every other app) and image/build.sh (the preinstalled factory copy). -# -# Trust: valve-archive-keyring.gpg is the keyring from the steam-launcher -# package itself (Valve Corporation, BA18 16EF 8E75 005F CF5E 27A1 F24A EA9F -# B054 98B7, and the 2025 repository key). InRelease must be signed by it, the -# Packages index must match its SHA256, the .deb must match the index. +# Builds the two store release assets into dist/: app.toml and +# support.bluefox.steam-.tar.zst, with Valve's newest launcher +# (fetch-steam.sh). Needs curl, gpgv, dpkg-deb and sf-pack (Fennec SDK): +# cargo install --locked --git https://gitea.bluefox.support/fennec/sdk --tag v0.1.0 sf-pack set -euo pipefail +cd "$(dirname "$0")" -HERE="$(cd "$(dirname "$0")" && pwd)" -REPO="${STEAM_REPO:-https://repo.steampowered.com/steam}" -KEYRING="$HERE/valve-archive-keyring.gpg" -TMP=$(mktemp -d) -trap 'rm -rf "$TMP"' EXIT - -curl -fsSL -o "$TMP/InRelease" "$REPO/dists/stable/InRelease" -if ! gpgv --keyring "$KEYRING" --output "$TMP/Release" "$TMP/InRelease" 2>"$TMP/gpgv.log"; then - cat "$TMP/gpgv.log" >&2 - echo "steam: InRelease is not signed by Valve's key" >&2 - exit 1 -fi -want=$(awk '/^SHA256:/ {f = 1; next} /^[^ ]/ {f = 0} f && $3 == "steam/binary-amd64/Packages" {print $1}' "$TMP/Release") -[ -n "$want" ] || { echo "steam: no Packages checksum in Release" >&2; exit 1; } -curl -fsSL -o "$TMP/Packages" "$REPO/dists/stable/steam/binary-amd64/Packages" -echo "$want $TMP/Packages" | sha256sum -c --quiet - || { echo "steam: Packages checksum mismatch" >&2; exit 1; } - -# The newest steam-launcher in the index: "versionfilenamesha256". -best=$(awk -v RS= -v FS='\n' ' - $0 ~ /(^|\n)Package: steam-launcher(\n|$)/ { - v = f = s = "" - for (i = 1; i <= NF; i++) { - if ($i ~ /^Version: /) v = substr($i, 10) - if ($i ~ /^Filename: /) f = substr($i, 11) - if ($i ~ /^SHA256: /) s = substr($i, 9) - } - sub(/^[0-9]+:/, "", v) - print v "\t" f "\t" s - }' "$TMP/Packages" | sort -t "$(printf '\t')" -k1,1V | tail -1) -IFS=$'\t' read -r version file sha <<<"$best" -case "$version" in - "" | *[!0-9.]*) echo "steam: unexpected version '$version'" >&2; exit 1 ;; -esac -case "$file" in - pool/*.deb) ;; - *) echo "steam: unexpected file '$file'" >&2; exit 1 ;; -esac - -if [ "${1:-}" = --version ]; then - echo "$version" - exit 0 -fi -DIR="${1:?usage: package.sh --version | }" -[ -f "$DIR/app.toml" ] || { echo "steam: $DIR/app.toml is missing" >&2; exit 1; } - -curl -fsSL -o "$TMP/steam.deb" "$REPO/$file" -echo "$sha $TMP/steam.deb" | sha256sum -c --quiet - || { echo "steam: .deb checksum mismatch" >&2; exit 1; } -mkdir "$TMP/x" -dpkg-deb -x "$TMP/steam.deb" "$TMP/x" - -# The launcher script finds its bootstrap next to itself, and must be called -# "steam" (it uses its own name as the package name). -L="$TMP/x/usr/lib/steam" -install -Dm755 "$L/bin_steam.sh" "$DIR/steam/steam" -install -Dm644 "$L/bootstraplinux_ubuntu12_32.tar.xz" "$DIR/steam/bootstraplinux_ubuntu12_32.tar.xz" -# Controller access (uinput, Steam Controller, DualSense...): the image -# installs these rules (image/build.sh). -for r in "$TMP"/x/lib/udev/rules.d/*.rules; do - install -Dm644 "$r" "$DIR/udev/$(basename "$r")" -done -install -Dm644 "$TMP/x/usr/share/doc/steam-launcher/copyright" "$DIR/steam/COPYRIGHT" -sed -i "s/^version = .*/version = \"$version\"/" "$DIR/app.toml" -echo "$version" +rm -rf pkg dist +mkdir -p pkg +cp -r app.toml icon.svg bin pkg/ +# Git on Windows loses the x bit. +chmod -R a+x pkg/bin +bash fetch-steam.sh pkg +sf-pack build pkg dist +sf-pack verify dist