Add Store support and unsigned app releases

This commit is contained in:
Tamas Csikel
2026-10-25 14:11:49 +01:00
parent 4975784491
commit d7e9fe4568
157 changed files with 22985 additions and 944 deletions

View File

@@ -1,12 +1,14 @@
#!/usr/bin/env bash
# Builds, signs and uploads SmartFox packages (protocol: docs/updates.md).
# Builds, signs and uploads Fennec OS packages (protocol: docs/updates.md).
#
# tools/pkg/packages.sh [--upload] [shell] [app:<id>...] [apps]
#
# With no package names it does the shell and every app. A package whose
# version is already in the registry is skipped (bump the version to publish):
# shell version = [workspace.package] version in Cargo.toml
# app:<id> version = "version" in apps/<id>/app.toml
# app:<id> version = "version" in apps/<id>/app.toml, or what the app's
# hook says (tools/pkg/<id>/package.sh: Steam follows Valve's
# official steam-launcher package)
#
# Environment:
# SF_SIGNING_KEY Ed25519 private key: the PEM file base64-encoded on one
@@ -22,7 +24,7 @@ GITEA="${SF_GITEA:-https://gitea.bluefox.support}"
OWNER="${SF_OWNER:-bluefox}"
OUT="${SF_OUT:-$ROOT/target/packages}"
# Binaries in the shell package (built with cargo --release).
SHELL_BINS=(sf-launcher sf-remote)
SHELL_BINS=(sf-launcher sf-remote sf-core sf-miracast sf-compositor sf-update)
UPLOAD=0
WANT=()
@@ -98,10 +100,17 @@ do_shell() {
pack sf-shell "$version" "$dir"
}
# An app with a hook (tools/pkg/<id>/package.sh, e.g. Steam from Valve's
# official package) gets its files and version from it: `--version` prints
# the upstream version, `<dir>` fills the app folder.
do_app() {
local id=$1 src="$ROOT/apps/$1" version
local id=$1 src="$ROOT/apps/$1" version hook="$ROOT/tools/pkg/$1/package.sh"
[ -f "$src/app.toml" ] || { echo "no app $id" >&2; return 1; }
version=$(toml_version "$src/app.toml")
if [ -f "$hook" ]; then
version=$(bash "$hook" --version)
else
version=$(toml_version "$src/app.toml")
fi
[ -n "$version" ] || { echo "apps/$id/app.toml has no version, skipped"; return; }
if published "sf-app-$id" "$version"; then
echo "sf-app-$id $version: already published"
@@ -110,14 +119,20 @@ do_app() {
local dir="$TMP/sf-app-$id"
rm -rf "$dir"
cp -r "$src" "$dir"
if [ -f "$hook" ]; then
[ "$(bash "$hook" "$dir" | tail -1)" = "$version" ] || { echo "$id: the hook built another version than $version" >&2; return 1; }
fi
chmod -R u=rwX,go=rX "$dir"
# Git on Windows loses the x bit: programs live in bin/.
[ -d "$dir/bin" ] && chmod -R a+x "$dir/bin"
pack "sf-app-$id" "$version" "$dir"
}
for w in "${WANT[@]}"; do
case "$w" in
shell) do_shell ;;
apps) for d in "$ROOT"/apps/*/; do do_app "$(basename "$d")"; done ;;
# A folder with its own .git is a store app developed in place: skipped.
apps) for d in "$ROOT"/apps/*/; do [ -e "$d/.git" ] || do_app "$(basename "$d")"; done ;;
app:*) do_app "${w#app:}" ;;
esac
done

View File

@@ -0,0 +1,81 @@
#!/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 <app-dir> fills <app-dir> (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.
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: "version<TAB>filename<TAB>sha256".
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 | <app-dir>}"
[ -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"

Binary file not shown.