Files
FrameAssistant/scripts/package-release.sh
T
matzmanandClaude Opus 5.5 179316db52 Document iteration 1: settings file, HA Dashboard tab, new hooks
README: settings file, --config, the new tab. ARCHITECTURE.md and
CLAUDE.md: prepare() hook, app command-line options, app code layout,
WebEngine notes, the moc raw-string pitfall. THIRD_PARTY_NOTICES: Qt
WebEngine. Ship config.example.json; the package README explains the
set-up. PROGRESS.md and DESIGN.md: phase 3 results and deviations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 22:21:34 +02:00

104 lines
4.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the dashboard for the Steam Frame (aarch64) and packages it for release:
#
# dist/<executable>-<version>-linux-arm64/ uses SteamOS's Qt (default, ~3 MB)
# dist/<executable>-<version>-linux-arm64-bundled/ Qt bundled (--bundle-qt, ~46 MB)
# (each also as .tar.gz)
#
# The package contains only the dashboard itself plus install.sh,
# uninstall.sh and a README. Installing again over an existing installation updates it.
#
# scripts/package-release.sh [--bundle-qt] [--no-build]
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
build=1 bundle_qt=0
for arg in "$@"; do
case "$arg" in
--no-build) build=0 ;;
--bundle-qt) bundle_qt=1 ;;
*) echo "usage: $0 [--bundle-qt] [--no-build]" >&2; exit 2 ;;
esac
done
if [[ "$(uname -m)" == aarch64 ]]; then mode=native; else mode=cross; fi
if (( bundle_qt )); then
mode+=-bundle
[[ "$mode" == native-bundle ]] && preset=native-bundle || preset=cross-arm64-bundle
else
[[ "$mode" == native ]] && preset=native-systemqt || preset=cross-arm64
fi
(( build )) && "$root/scripts/container-build.sh" "$mode"
cache="$root/build/$preset/CMakeCache.txt"
setting() { sed -n "s/^$1:[A-Z]*=//p" "$cache"; }
exe="$(setting VRDASH_EXECUTABLE_NAME)"
name="$(setting VRDASH_DISPLAY_NAME)"
key="$(setting VRDASH_APP_KEY)"
version="$(setting CMAKE_PROJECT_VERSION)"
project="$(setting CMAKE_PROJECT_NAME)"
stage="$root/build/$preset/stage"
[[ "$(file -b "$stage/bin/$exe")" == *aarch64* ]] || { echo "$stage/bin/$exe is not an aarch64 build" >&2; exit 1; }
package="$exe-$version-linux-arm64"
(( bundle_qt )) && package+=-bundled
out="$root/dist/$package"
rm -rf "$out" "$out.tar.gz"
mkdir -p "$out"
cp -a "$stage/." "$out/"
# Only the dashboard: drop any other executables.
find "$out/bin" -maxdepth 1 -type f -perm -u+x ! -name "$exe" -delete
cp "$root/LICENSE" "$out/"
cat > "$out/install.sh" <<EOF
#!/bin/sh
# Installs or updates $name: registers it with SteamVR (starts automatically with
# SteamVR) and starts it now. SteamVR must be running. Works over SSH.
cd "\$(dirname "\$0")" || exit 1
mkdir -p logs
# An update replaces the files of a running instance: stop it, SteamVR restarts it below.
# (Match the command line: process names are cut to 15 characters.)
pkill -f "/bin/$exe( |\\$)" 2>/dev/null && sleep 1
exec ./bin/$exe --install-manifest --launch --log-file logs/install.log
EOF
cat > "$out/uninstall.sh" <<EOF
#!/bin/sh
# Unregisters $name from SteamVR and stops it. The folder can be deleted afterwards.
cd "\$(dirname "\$0")" || exit 1
pkill -f "/bin/$exe( |\\$)" 2>/dev/null
exec ./bin/$exe --uninstall-manifest --log-file logs/install.log
EOF
chmod +x "$out/install.sh" "$out/uninstall.sh"
{
echo "$name $version (SteamVR dashboard overlay, app key $key)"
echo
if (( bundle_qt )); then
echo "Self-contained build: Qt is included."
else
echo "Uses the system's Qt (SteamOS: Qt 6.8 or newer). If it fails to start after a"
echo "SteamOS update, use the -bundled package instead."
fi
echo
echo "Settings (required before the first start):"
echo " mkdir -p ~/.config/$project"
echo " cp share/$project/config.example.json ~/.config/$project/config.json"
echo " chmod 600 ~/.config/$project/config.json"
echo " then edit it (device name, MQTT broker, Home Assistant URL)."
echo " Without valid settings the app exits; to see why, run"
echo " ./bin/$exe --desktop in a terminal."
echo
echo "Install / update: ./install.sh (SteamVR must be running)"
echo " SteamVR remembers this folder's location: after moving it,"
echo " run ./install.sh again."
echo "Uninstall: ./uninstall.sh"
echo "Logs: logs/install.log; run ./bin/$exe --help for options"
echo
echo "License: MIT (LICENSE). Third-party notices: share/doc/$project/."
} > "$out/README.txt"
tar -C "$root/dist" -czf "$out.tar.gz" "$package"
echo "Release folder: $out"
echo "Archive: $out.tar.gz ($(du -h "$out.tar.gz" | cut -f1))"