Files
omarchy-pkgs/pkgbuilds/steam/steam.sh
T
Ryan Hughes 97a8032cd5 Build steam for aarch64 on Valve's native arm64 client
Arch ships steam for x86_64 only, so on AArch64 `omarchy-pkg-add steam`
found nothing. This aarch64 build installs the same Valve launcher files
(desktop entry, icons, steam-devices udev rules) but replaces the x86
bootstrap with Valve's native arm64 client, which then updates itself from
the stable steam_client_linuxarm64 channel.

The bootstrap is just the client binary, which links only glibc, taken
from the manifest's bins_linuxarm64_linuxarm64 zip and pinned to the sha2
the manifest publishes. /usr/bin/steam unpacks it on first launch, keeps
the ~/.steam links the client requires, and restarts the client when it
exits with 42 after updating. Valve's bin_steam.sh cannot do this: it only
knows the ubuntu12_32 bootstrap.

Beyond Arch's dependencies the client needs gtk2 and libibus for its UI,
and lsof, which it runs to find its own IPC ports.
2026-10-07 11:26:45 -04:00

43 lines
1.4 KiB
Bash

#!/bin/bash
# Launches Valve's native arm64 Steam client.
#
# Valve's own launcher (bin_steam.sh) only knows the x86 bootstrap, so this
# does its job for linuxarm64: unpack the client on first run, keep the
# ~/.steam links the client refuses to start without, and start the client
# again whenever it exits asking to be restarted after updating itself.
set -euo pipefail
bootstrap=/usr/lib/steam/bootstraplinux_linuxarm64.tar.xz
# The exit status Steam uses to ask to be started again.
restart_status=42
if [[ $(id -u) == 0 ]]; then
echo "steam: cannot run as root" >&2
exit 1
fi
# Like Valve's launcher, follow ~/.steam/steam when it points at a working
# install, so a library that was moved keeps working.
steamroot=$(readlink -e "$HOME/.steam/steam" || true)
if [[ -z $steamroot || ! -x $steamroot/steamrtarm64/steam ]]; then
steamroot=${XDG_DATA_HOME:-$HOME/.local/share}/Steam
if [[ ! -x $steamroot/steamrtarm64/steam ]]; then
(umask 077 && mkdir -p "$steamroot" && tar -xJf "$bootstrap" -C "$steamroot")
fi
fi
mkdir -p "$HOME/.steam"
ln -sfn "$steamroot" "$HOME/.steam/steam"
ln -sfn "$steamroot" "$HOME/.steam/root"
# The arm64 counterpart of the sdk32/sdk64 links steam.sh makes for games
# that load the Steam API from ~/.steam.
ln -sfn "$steamroot/linuxarm64" "$HOME/.steam/sdkarm64"
cd "$steamroot"
while :; do
status=0
"$steamroot/steamrtarm64/steam" "$@" || status=$?
((status == restart_status)) || exit "$status"
done