Use the shared nightly launcher template (#835)

Renders the plain nightly tar's launcher from craft-common-actions' shared template.

Independent check: dylanmtaylor compared all 14 app launcher PRs byte for byte with the template rendered from the registry (https://github.com/storytold/craft-common-actions/pull/367#issuecomment-7172085284); this head was re-checked against craft-common-actions main 88148a5.
This commit is contained in:
skylar taylor-barrick authored and GitHub committed 2026-11-25 16:17:41 -06:00
1 parent 2d86cc04ba
commit dcf91a4f05
3 files changed
+68 -48

No files matched your search

+6 -3
View File
@@ -95,11 +95,14 @@ those values in the same reviewed change that promotes the policy to `release`.
## App-side producer scripts (Windows and macOS) ## App-side producer scripts (Windows and macOS)
**Every Linux Nightly format starts the app the flavor's way.** The `.deb`/`.rpm` wrapper, the **Every Linux Nightly format starts the app the flavor's way.** The `.deb`/`.rpm` wrapper, the
Arch launcher, the Flatpak wrapper, the AppImage's `AppRun` and the launcher inside the plain Arch launcher, the Flatpak wrapper and the AppImage's `AppRun` all exec the real GUI with the literal
`nightly.tar.gz` all exec the real GUI with the literal
`--launch-profile nightly-v1 --profile-root <${XDG_DATA_HOME:-~/.local/share}/TextureCraft-Nightly> --`, `--launch-profile nightly-v1 --profile-root <${XDG_DATA_HOME:-~/.local/share}/TextureCraft-Nightly> --`,
and pass a Launcher protocol or a `--version`/`-V` query through untouched (so the smoke checks and and pass a Launcher protocol or a `--version`/`-V` query through untouched (so the smoke checks and
`texturecraft-nightly --version` still answer). The profile is outside stable's folders and outside `texturecraft-nightly --version` still answer). The plain `nightly.tar.gz` (and `package.sh`'s tree tarball, which installs the same file) uses craft-common-actions'
shared launcher template (#363, rendered for this app) instead: its `texturecraft` adds its own
tokens unless the first argument is already a `--launch-profile` pair, execs `texturecraft-bin` beside it with
`--profile-root <${XDG_DATA_HOME:-~/.local/share}/ai.storyteller.texturecraft.nightly> --`, and asks a
bare `--version`/`-V` in the Launcher's own form. The profile is outside stable's folders and outside
the unpacked or installed copy, which the flavor's fence would otherwise refuse. the unpacked or installed copy, which the flavor's fence would otherwise refuse.
Every Nightly Linux format is GUI only. `texturecraft-cli` stays in the Stable packages: a headless Every Nightly Linux format is GUI only. `texturecraft-cli` stays in the Stable packages: a headless
+50 -28
View File
@@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# The launcher inside the plain Nightly tarball (packaging/linux/nightly-launch.sh): a launch adds # The launcher inside the plain Nightly tarball (packaging/linux/nightly-launch.sh): craft-common-actions'
# the Launcher's private profile, a version query or an existing protocol passes through, and the # template rendered for TextureCraft. Every argument follows the profile tokens, the profile root is the
# fence's shape holds (absolute root, no parent traversal, outside this copy). # package identity under the XDG data home (or HOME), and a version query is asked in the Launcher's
# own form so the GUI answers before any profile is read.
set -euo pipefail set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -16,42 +17,63 @@ printf '<%s>\n' "$@"
RECORDER RECORDER
chmod 755 "$work/tree/texturecraft-bin" chmod 755 "$work/tree/texturecraft-bin"
cp "$HERE/nightly-launch.sh" "$work/tree/texturecraft" cp "$HERE/nightly-launch.sh" "$work/tree/texturecraft"
chmod 755 "$work/tree/texturecraft"
profile="${XDG_DATA_HOME:-${HOME:-}/.local/share}/TextureCraft-Nightly" # The bytes are the shared template rendered for this app, not a local script.
# The profile must be something the app's fence accepts: absolute, no parent traversal, and not sha256sum "$HERE/nightly-launch.sh" | cut -d' ' -f1 | grep -qx \
# inside the unpacked copy (the running install). 8941ee4947ef4c3fc4a663600569d985b41c0b9ce6f9833d0c6777aa2b4d6acf || {
case "$profile" in echo "FAIL: nightly-launch.sh is not the shared template rendered for texturecraft" >&2
/*) ;; exit 1
*) echo "FAIL: the launcher profile is not absolute: $profile" >&2; exit 1 ;; }
esac head -n 1 "$work/tree/texturecraft" | grep -qx '#!/bin/sh' || { echo "FAIL: texturecraft is not a script" >&2; exit 1; }
case "/$profile/" in
*/../*) echo "FAIL: the launcher profile contains parent traversal" >&2; exit 1 ;;
esac
case "$profile/" in
"$work/tree/"*) echo "FAIL: the launcher profile is inside the unpacked copy" >&2; exit 1 ;;
esac
expect_launch() { # A hand-unpacked tar has to start the private profile even when nobody passes a flag.
expected="$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$profile" -- "$@")" export HOME="$work/home with space"
unset XDG_DATA_HOME
identity="ai.storyteller.texturecraft.nightly"
expect() {
local root="$1"
shift
expected="$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$root" -- "$@")"
actual=$("$work/tree/texturecraft" "$@") actual=$("$work/tree/texturecraft" "$@")
[[ "$actual" == "$expected" ]] || {
printf 'profile root %s\nexpected:\n%s\nactual:\n%s\n' "$root" "$expected" "$actual" >&2
exit 1
}
}
expect_query() {
local root="$1"
expected="$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$root" --version)"
actual=$("$work/tree/texturecraft" --version)
[[ "$actual" == "$expected" ]] || { [[ "$actual" == "$expected" ]] || {
printf 'expected:\n%s\nactual:\n%s\n' "$expected" "$actual" >&2 printf 'expected:\n%s\nactual:\n%s\n' "$expected" "$actual" >&2
exit 1 exit 1
} }
} actual=$("$work/tree/texturecraft" -V)
expect_forwarded() {
expected="$(printf '<%s>\n' "$@")"
actual=$("$work/tree/texturecraft" "$@")
[[ "$actual" == "$expected" ]] || { [[ "$actual" == "$expected" ]] || {
printf 'expected:\n%s\nactual:\n%s\n' "$expected" "$actual" >&2 printf 'expected:\n%s\nactual:\n%s\n' "$expected" "$actual" >&2
exit 1 exit 1
} }
} }
expect_launch expect "$HOME/.local/share/$identity"
expect_launch 'model with spaces.glb' '--other-name.tcraft' expect "$HOME/.local/share/$identity" 'model with spaces.glb' '--other-name.tcraft'
expect_forwarded --version export XDG_DATA_HOME="$work/xdg with space"
expect_forwarded -V expect "$XDG_DATA_HOME/$identity" 'model.glb'
expect_forwarded --launch-profile nightly-v1 --profile-root /launcher/profile --version expect_query "$XDG_DATA_HOME/$identity"
unset XDG_DATA_HOME
expect_query "$HOME/.local/share/$identity"
echo "PASS: tarball Nightly launcher starts the GUI with the Launcher profile and forwards files" # The ArtCraft Launcher names its own profile and per-install root: the argv goes through unchanged.
actual=$("$work/tree/texturecraft" --launch-profile nightly-v1 --profile-root "$work/launcher profile with space" -- file.doc)
[[ "$actual" == "$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$work/launcher profile with space" -- file.doc)" ]] || {
printf 'expected the Launcher argv unchanged\nactual:\n%s\n' "$actual" >&2
exit 1
}
# The launcher itself writes nothing: the profile folder is the GUI's to create.
[[ ! -e "$HOME/.local/share/$identity" ]] || { echo "FAIL: the launcher created the profile" >&2; exit 1; }
echo "PASS: the tarball launcher is the shared template and starts the GUI through the channel's profile"
+12 -17
View File
@@ -1,21 +1,16 @@
#!/bin/sh #!/bin/sh
# The entry point inside the Nightly tarball (packaging/linux/nightly.sh installs it as # Nightly launcher generated by craft-common-actions scripts/nightly-launcher.sh.in. Do not edit:
# `texturecraft`, beside the GUI as `texturecraft-bin`). # the shared nightly producer accepts this file only byte for byte as rendered for the app.
#
# A Nightly build only starts with its private profile, and every package format passes the
# Launcher's literal protocol: `--launch-profile nightly-v1 --profile-root <dir> -- <files>`. The
# profile sits outside stable's folders (its own settings, ui.json, crash log, autosaves, smart
# materials, layouts, templates and presets) and outside this unpacked copy, which the app's own
# fence would refuse.
set -eu set -eu
dir=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)
here="$(dirname "$(readlink -f "$0")")" readonly dir
bin="$here/texturecraft-bin" target="$dir/texturecraft-bin"
profile="${XDG_DATA_HOME:-${HOME:-}/.local/share}/TextureCraft-Nightly" readonly target
profile_root="${XDG_DATA_HOME:-$HOME/.local/share}/ai.storyteller.texturecraft.nightly"
# The Launcher's protocol, and a bare version query, pass through untouched: the first already readonly profile_root
# names its profile, and the second must answer without one.
case "${1-}" in case "${1-}" in
--launch-profile | --profile-root | --version | -V) exec "$bin" "$@" ;; # The ArtCraft Launcher passes its own profile and per-install root; the app validates the pair.
--launch-profile) exec "$target" "$@" ;;
--version | -V) exec "$target" --launch-profile nightly-v1 --profile-root "$profile_root" --version ;;
esac esac
exec "$bin" --launch-profile nightly-v1 --profile-root "$profile" -- "$@" exec "$target" --launch-profile nightly-v1 --profile-root "$profile_root" -- "$@"