mirror of
https://github.com/storytold/texturecraft.git
synced 2026-11-25 08:50:46 +01:00
packaging(linux): support co-installable nightly packages (#801)
Linux nightly packaging by @dylanmtaylor, with the per-app Nightly flavor commits stacked on his branch. Co-authored-by: Dylan M. Taylor <dylan@dylanmtaylor.com>
This commit is contained in:
1 parent
2a4ad138d9
commit
56efb48efb
72 files changed
+5488
-80
No files matched your search
@@ -13,6 +13,9 @@ set -u
|
||||
|
||||
APPDIR="$(dirname "$(readlink -f "$0")")"
|
||||
DESK_ID=ai.storyteller.texturecraft
|
||||
# package.sh rewrites this line for a Nightly AppImage, which starts the app with the Launcher's
|
||||
# private profile exactly as the deb, rpm, Arch, Flatpak and tarball launchers do.
|
||||
CHANNEL=stable
|
||||
|
||||
integrate() {
|
||||
case "${TEXTURECRAFT_NO_DESKTOP_INTEGRATION:-}" in
|
||||
@@ -69,4 +72,14 @@ integrate() {
|
||||
}
|
||||
|
||||
integrate
|
||||
|
||||
# The Launcher's own protocol, and a bare version query, pass through untouched: the first already
|
||||
# names its profile, and the second must answer without one.
|
||||
case "${1-}" in
|
||||
--launch-profile | --profile-root | --version | -V) exec "$APPDIR/usr/bin/texturecraft" "$@" ;;
|
||||
esac
|
||||
if [ "$CHANNEL" = nightly-v1 ]; then
|
||||
exec "$APPDIR/usr/bin/texturecraft" --launch-profile nightly-v1 \
|
||||
--profile-root "${XDG_DATA_HOME:-${HOME:-}/.local/share}/TextureCraft-Nightly" -- "$@"
|
||||
fi
|
||||
exec "$APPDIR/usr/bin/texturecraft" "$@"
|
||||
@@ -8,7 +8,7 @@ TryExec=texturecraft
|
||||
Icon=ai.storyteller.texturecraft
|
||||
Terminal=false
|
||||
StartupNotify=true
|
||||
StartupWMClass=texturecraft
|
||||
StartupWMClass=ai.storyteller.texturecraft
|
||||
Categories=Graphics;3DGraphics;
|
||||
Keywords=texture;paint;pbr;material;3d;mesh;bake;gltf;fbx;usd;
|
||||
MimeType=application/x-texturecraft;model/gltf-binary;model/gltf+json;model/x-fbx;model/vnd.collada+xml;model/x-usd;model/vnd.usda;model/vnd.usdz+zip;model/x-alembic;model/obj;model/x-ply;model/stl;
|
||||
@@ -95,4 +95,22 @@ out="$(APPIMAGE="$odd" "$APPDIR/AppRun" x)" || fail "launch with an odd path exi
|
||||
[[ "$out" = "stub: x" ]] || fail "odd path: $out"
|
||||
[[ ! -e "$XDG_DATA_HOME" ]] || fail "integrated an AppImage path that needs escaping"
|
||||
|
||||
# 10. A Nightly AppImage (package.sh rewrites the channel line) starts the app with the Launcher's
|
||||
# private profile; a version query still passes through untouched.
|
||||
NIGHTLY_APPDIR="$TMP/Nightly.AppDir"
|
||||
mkdir -p "$NIGHTLY_APPDIR/usr/bin"
|
||||
install -Dm755 "$HERE/AppRun" "$NIGHTLY_APPDIR/AppRun"
|
||||
cat >"$NIGHTLY_APPDIR/usr/bin/texturecraft" <<'RECORDER'
|
||||
#!/bin/sh
|
||||
printf '<%s>\n' "$@"
|
||||
RECORDER
|
||||
chmod +x "$NIGHTLY_APPDIR/usr/bin/texturecraft"
|
||||
sed -i 's|^CHANNEL=stable$|CHANNEL=nightly-v1|' "$NIGHTLY_APPDIR/AppRun"
|
||||
grep -qx 'CHANNEL=nightly-v1' "$NIGHTLY_APPDIR/AppRun" || fail "Nightly AppRun was not switched"
|
||||
out="$(env -u APPIMAGE XDG_DATA_HOME="$TMP/nightly-data" "$NIGHTLY_APPDIR/AppRun" a.glb)" || fail "Nightly AppRun exited non-zero"
|
||||
expected="$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$TMP/nightly-data/TextureCraft-Nightly" -- a.glb)"
|
||||
[[ "$out" = "$expected" ]] || fail "Nightly AppRun did not use the Launcher profile: $out"
|
||||
out="$(env -u APPIMAGE "$NIGHTLY_APPDIR/AppRun" --version)" || fail "Nightly version query exited non-zero"
|
||||
[[ "$out" = "<--version>" ]] || fail "Nightly AppRun rewrote a version query: $out"
|
||||
|
||||
echo "AppRun desktop integration ok"
|
||||
@@ -9,14 +9,20 @@
|
||||
# is built for the host architecture (x86_64 or aarch64), which must match the tarball's.
|
||||
# Needs flatpak, flatpak-builder and the SVG pixbuf loader (librsvg2-common) for the host's
|
||||
# `appstreamcli compose`; the freedesktop runtime and SDK named in the manifest are
|
||||
# installed per-user from Flathub. Unless --no-test, the bundle is then installed per-user and
|
||||
# `texturecraft-cli --version` is run inside the sandbox as a smoke test.
|
||||
# installed per-user from Flathub. Unless --no-test, the bundle is then installed per-user and the
|
||||
# app (`texturecraft --version`) is run inside the sandbox as a smoke test.
|
||||
# Manifest: packaging/linux/flatpak/ai.storyteller.TextureCraft.bundle.yml.
|
||||
set -euo pipefail
|
||||
# shellcheck source=../env.sh
|
||||
. "$(dirname "${BASH_SOURCE[0]}")/../env.sh"
|
||||
HERE="$ROOT/packaging/linux"
|
||||
APP_ID=ai.storyteller.texturecraft
|
||||
FLATPAK_ID="$APP_ID"
|
||||
# The remote indexes both app IDs on the stable ref branch; IDs isolate installations.
|
||||
FLATPAK_BRANCH=stable
|
||||
if [[ "${TEXTURECRAFT_BUILD_CHANNEL:-}" == nightly-v1 || "$VERSION" == *-nightly* ]]; then
|
||||
FLATPAK_ID="$APP_ID.nightly"
|
||||
fi
|
||||
FLATHUB=https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
# The OCI repository serves only the latest stable release, so a prerelease bundle gets no update
|
||||
# source: Flatpak would otherwise replace it with that older stable build.
|
||||
@@ -56,38 +62,98 @@ rm -rf "$WORK"
|
||||
mkdir -p "$WORK/stage"
|
||||
tar -xzf "$TARBALL" -C "$WORK/stage" --strip-components=1
|
||||
[[ -x "$WORK/stage/bin/texturecraft" ]] || { echo "error: $TARBALL has no bin/texturecraft" >&2; exit 1; }
|
||||
cp "$HERE/flatpak/ai.storyteller.TextureCraft.bundle.yml" "$WORK/$APP_ID.yml"
|
||||
if [[ "$FLATPAK_ID" != "$APP_ID" ]]; then
|
||||
# A Nightly tarball from package.sh already separates the launcher from the GUI; an older one
|
||||
# does not. Either way this bundle installs its own wrapper and the GUI in /app/libexec.
|
||||
if [[ -e "$WORK/stage/bin/texturecraft-bin" ]]; then
|
||||
rm -f "$WORK/stage/bin/texturecraft"
|
||||
else
|
||||
mv "$WORK/stage/bin/texturecraft" "$WORK/stage/bin/texturecraft-bin"
|
||||
fi
|
||||
cat >"$WORK/stage/bin/texturecraft" <<'WRAPPER'
|
||||
#!/bin/sh
|
||||
# TextureCraft Nightly: the GUI runs with the Launcher's private profile. Inside the sandbox
|
||||
# $XDG_DATA_HOME is the app's own per-app folder, so the profile never meets stable's.
|
||||
set -eu
|
||||
bin=/app/libexec/texturecraft
|
||||
profile="${XDG_DATA_HOME:-${HOME:-}/.local/share}/TextureCraft-Nightly"
|
||||
# The Launcher's protocol, and a bare version query, pass through untouched.
|
||||
case "${1-}" in
|
||||
--launch-profile | --profile-root | --version | -V) exec "$bin" "$@" ;;
|
||||
esac
|
||||
exec "$bin" --launch-profile nightly-v1 --profile-root "$profile" -- "$@"
|
||||
WRAPPER
|
||||
chmod 755 "$WORK/stage/bin/texturecraft"
|
||||
sed -e "s|^Icon=$APP_ID$|Icon=$FLATPAK_ID|" \
|
||||
-e "s|^Name=TextureCraft$|Name=TextureCraft Nightly|" \
|
||||
-e 's|^StartupWMClass=.*|StartupWMClass=ai.storyteller.texturecraft.nightly-v1|' \
|
||||
-e '/^MimeType=/d' \
|
||||
"$WORK/stage/share/applications/$APP_ID.desktop" >"$WORK/stage/share/applications/$FLATPAK_ID.desktop"
|
||||
rm -f "$WORK/stage/share/applications/$APP_ID.desktop"
|
||||
# The Nightly entry drops MimeType=, so the metainfo must not advertise the types either.
|
||||
sed -e "s|<id>$APP_ID</id>|<id>$FLATPAK_ID</id>|g" \
|
||||
-e "s|<name>TextureCraft</name>|<name>TextureCraft Nightly</name>|g" \
|
||||
-e "s|<launchable type=\"desktop-id\">$APP_ID.desktop</launchable>|<launchable type=\"desktop-id\">$FLATPAK_ID.desktop</launchable>|g" \
|
||||
-e "s|<icon type=\"stock\">$APP_ID</icon>|<icon type=\"stock\">$FLATPAK_ID</icon>|g" \
|
||||
-e '/<mediatype>/d' \
|
||||
"$WORK/stage/share/metainfo/$APP_ID.metainfo.xml" >"$WORK/stage/share/metainfo/$FLATPAK_ID.metainfo.xml"
|
||||
rm -f "$WORK/stage/share/metainfo/$APP_ID.metainfo.xml"
|
||||
rm -rf "$WORK/stage/share/mime"
|
||||
rm -rf "$WORK/stage/share/icons/hicolor"
|
||||
NIGHTLY_ICON="$ROOT/assets/app-icon/texturecraft-nightly.png"
|
||||
if [[ ! -f "$NIGHTLY_ICON" ]]; then
|
||||
NIGHTLY_ICON="$ROOT/assets/app-icon/hicolor/256x256/apps/$APP_ID.png"
|
||||
fi
|
||||
install -Dm644 "$NIGHTLY_ICON" \
|
||||
"$WORK/stage/share/icons/hicolor/256x256/apps/$FLATPAK_ID.png"
|
||||
# Omit conflicting MIME registrations and disable host Flatpak updater talk-name until
|
||||
# craft_update supports the nightly FLATPAK_ID. A Nightly bundle is also GUI-only: its tarball has
|
||||
# no texturecraft-cli, and a CLI would read Stable's Documents/TextureCraft brushes.
|
||||
sed -e "s|ai\.storyteller\.texturecraft|$FLATPAK_ID|g" \
|
||||
-e '/share\/mime\/packages\//d' \
|
||||
-e '/^\( *\)# \.tcraft, plus mesh types/d' \
|
||||
-e '/bin\/texturecraft-cli/d' \
|
||||
-e '/--talk-name=org\.freedesktop\.Flatpak/d' \
|
||||
-e 's|- install -Dm755 bin/texturecraft /app/bin/texturecraft|- install -Dm755 bin/texturecraft-bin /app/libexec/texturecraft\n - install -Dm755 bin/texturecraft /app/bin/texturecraft|' \
|
||||
"$HERE/flatpak/ai.storyteller.TextureCraft.bundle.yml" >"$WORK/$FLATPAK_ID.yml"
|
||||
else
|
||||
cp "$HERE/flatpak/ai.storyteller.TextureCraft.bundle.yml" "$WORK/$FLATPAK_ID.yml"
|
||||
fi
|
||||
|
||||
flatpak remote-add --user --if-not-exists flathub "$FLATHUB"
|
||||
# --disable-rofiles-fuse: no FUSE in containers and CI runners.
|
||||
flatpak-builder --user --install-deps-from=flathub --disable-rofiles-fuse --force-clean \
|
||||
--default-branch=stable --repo="$WORK/repo" --state-dir="$WORK/state" "$WORK/build" "$WORK/$APP_ID.yml"
|
||||
--default-branch="$FLATPAK_BRANCH" --repo="$WORK/repo" --state-dir="$WORK/state" "$WORK/build" "$WORK/$FLATPAK_ID.yml"
|
||||
|
||||
OUT="$DIST/$BASENAME.flatpak"
|
||||
# A release build (the shared release workflow sets SIGNING_FPR, SIGNING_PUBKEY and GNUPGHOME)
|
||||
# signs the commit and embeds the public key, so Flatpak verifies the bundle when installing it.
|
||||
GPG_KEYS=()
|
||||
if [[ -n "${SIGNING_FPR:-}" ]]; then
|
||||
flatpak build-sign "$WORK/repo" "$APP_ID" stable --gpg-sign="$SIGNING_FPR" --gpg-homedir="${GNUPGHOME:?}"
|
||||
flatpak build-sign "$WORK/repo" "$FLATPAK_ID" "$FLATPAK_BRANCH" --gpg-sign="$SIGNING_FPR" --gpg-homedir="${GNUPGHOME:?}"
|
||||
GPG_KEYS=(--gpg-keys="${SIGNING_PUBKEY:?}")
|
||||
if [[ "${OCI_SIGNATURES_READY:-}" != 1 ]]; then OCI_REPO=""; fi
|
||||
fi
|
||||
# --runtime-repo lets `flatpak install` fetch the freedesktop runtime from Flathub if missing.
|
||||
# --repo-url makes the installed origin update from the ArtCraft OCI repository.
|
||||
flatpak build-bundle --runtime-repo="$FLATHUB" ${OCI_REPO:+--repo-url="$OCI_REPO"} "${GPG_KEYS[@]}" "$WORK/repo" "$OUT" "$APP_ID" stable
|
||||
flatpak build-bundle --runtime-repo="$FLATHUB" ${OCI_REPO:+--repo-url="$OCI_REPO"} "${GPG_KEYS[@]}" "$WORK/repo" "$OUT" "$FLATPAK_ID" "$FLATPAK_BRANCH"
|
||||
echo "wrote $OUT"
|
||||
if [[ "$OCI" = 1 ]]; then
|
||||
OUT_OCI="$DIST/$BASENAME-oci"
|
||||
rm -rf "$OUT_OCI"
|
||||
flatpak build-bundle --oci "$WORK/repo" "$OUT_OCI" "$APP_ID" stable
|
||||
flatpak build-bundle --oci "$WORK/repo" "$OUT_OCI" "$FLATPAK_ID" "$FLATPAK_BRANCH"
|
||||
echo "wrote OCI layout to $OUT_OCI"
|
||||
fi
|
||||
|
||||
if [[ "$TEST" = 1 ]]; then
|
||||
flatpak install --user -y --noninteractive --reinstall "$OUT"
|
||||
flatpak info --user "$APP_ID"
|
||||
flatpak run --command=texturecraft-cli "$APP_ID" --version
|
||||
flatpak run --command=sh "$APP_ID" -c 'ls /app/share/applications /app/share/metainfo /app/share/mime/packages /app/share/icons/hicolor/scalable/apps'
|
||||
flatpak info --user "$FLATPAK_ID"
|
||||
flatpak run --command=texturecraft "$FLATPAK_ID" --version
|
||||
if [[ "$FLATPAK_ID" == "$APP_ID" ]]; then
|
||||
flatpak run --command=sh "$FLATPAK_ID" -c 'ls /app/share/applications /app/share/metainfo /app/share/mime/packages /app/share/icons/hicolor/*/apps'
|
||||
else
|
||||
flatpak run --command=sh "$FLATPAK_ID" -c 'ls /app/share/applications /app/share/metainfo /app/share/icons/hicolor/*/apps && test ! -e /app/share/mime/packages'
|
||||
fi
|
||||
fi
|
||||
echo "==> done"
|
||||
ls -lh "$OUT"
|
||||
@@ -1,9 +1,12 @@
|
||||
# .deb and .rpm packages (nfpm: https://nfpm.goreleaser.com). Run by package.sh, which stages
|
||||
# the file tree, substitutes its path for ${STAGE} (nfpm doesn't expand env vars in `src`) and
|
||||
# exports VERSION and NFPM_ARCH.
|
||||
# exports VERSION, NFPM_ARCH, NFPM_NAME, NFPM_BIN and NFPM_CLI (the Nightly package renames the
|
||||
# first two and has no CLI, so package.sh removes the CLI entry for it). By hand, all five are
|
||||
# needed:
|
||||
#
|
||||
# nfpm package -f packaging/linux/nfpm.yaml -p deb -t dist/release/
|
||||
name: texturecraft
|
||||
# VERSION=1.2.3 NFPM_ARCH=amd64 NFPM_NAME=texturecraft NFPM_BIN=texturecraft \
|
||||
# NFPM_CLI=texturecraft-cli nfpm package -f packaging/linux/nfpm.yaml -p deb -t dist/release/
|
||||
name: ${NFPM_NAME}
|
||||
arch: ${NFPM_ARCH}
|
||||
platform: linux
|
||||
version: ${VERSION}
|
||||
@@ -66,12 +69,15 @@ overrides:
|
||||
- xdg-desktop-portal
|
||||
|
||||
contents:
|
||||
- src: ${STAGE}/usr/bin/texturecraft
|
||||
dst: /usr/bin/texturecraft
|
||||
- src: ${STAGE}/usr/bin/${NFPM_BIN}
|
||||
dst: /usr/bin/${NFPM_BIN}
|
||||
file_info: { mode: 0755 }
|
||||
- src: ${STAGE}/usr/bin/texturecraft-cli
|
||||
dst: /usr/bin/texturecraft-cli
|
||||
- src: ${STAGE}/usr/bin/${NFPM_CLI}
|
||||
dst: /usr/bin/${NFPM_CLI}
|
||||
file_info: { mode: 0755 }
|
||||
- src: ${STAGE}/usr/lib/
|
||||
dst: /usr/lib/
|
||||
type: tree
|
||||
- src: ${STAGE}/usr/share/
|
||||
dst: /usr/share/
|
||||
type: tree
|
||||
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# The TextureCraft Nightly launcher for the Arch handoff (packaging/linux/nightly-arch-tar.sh):
|
||||
# the real GUI stays in .texturecraft-nightly/, and this starts it with the Launcher's private
|
||||
# profile, as every other Nightly package does.
|
||||
set -eu
|
||||
|
||||
bin="$(dirname "$0")/.texturecraft-nightly/texturecraft"
|
||||
profile="${XDG_DATA_HOME:-${HOME:-}/.local/share}/TextureCraft-Nightly"
|
||||
|
||||
# The Launcher's protocol, and a bare version query, pass through untouched.
|
||||
case "${1-}" in
|
||||
--launch-profile | --profile-root | --version | -V) exec "$bin" "$@" ;;
|
||||
esac
|
||||
exec "$bin" --launch-profile nightly-v1 --profile-root "$profile" -- "$@"
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
# Validate the staged Arch launcher without building or opening TextureCraft.
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||
work="$(mktemp -d)"
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
stage="$work/source"
|
||||
dst="$work/dist"
|
||||
base=texturecraft-0.0.1-nightly.1-linux-x86_64
|
||||
mkdir -p "$stage/bin" "$dst" "$work/extract"
|
||||
|
||||
# A local argv recorder stands in for the compiled binaries. It never opens a UI.
|
||||
cat >"$stage/bin/texturecraft" <<'RECORDER'
|
||||
#!/bin/sh
|
||||
printf '<%s>\n' "$@"
|
||||
RECORDER
|
||||
chmod 755 "$stage/bin/texturecraft"
|
||||
|
||||
bash "$HERE/nightly-arch-tar.sh" "$stage" "$work/stage" "$dst" "$base"
|
||||
tar -xzf "$dst/$base.tar.gz" -C "$work/extract"
|
||||
bin="$work/extract/$base/bin"
|
||||
# Simulate the existing Arch bin-tree copy and public launcher rename.
|
||||
mkdir -p "$work/installed"
|
||||
cp -R "$bin" "$work/installed/bin"
|
||||
bin="$work/installed/bin"
|
||||
mv "$bin/texturecraft" "$bin/texturecraft-nightly"
|
||||
|
||||
test ! -e "$stage/bin/.texturecraft-nightly"
|
||||
cmp "$stage/bin/texturecraft" "$bin/.texturecraft-nightly/texturecraft"
|
||||
# A Nightly package is GUI-only: the handoff must not carry a CLI that would use Stable's brushes.
|
||||
test ! -e "$bin/texturecraft-nightly-cli" || { echo "FAIL: the Arch handoff still ships a Nightly CLI" >&2; exit 1; }
|
||||
profile="${XDG_DATA_HOME:-${HOME:-}/.local/share}/TextureCraft-Nightly"
|
||||
# A launch adds the Launcher's literal selector/root pair and the file delimiter; a version query or
|
||||
# an already-formed protocol passes through untouched.
|
||||
expect_launch() {
|
||||
expected="$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$profile" -- "$@")"
|
||||
actual=$(PATH="$bin:$PATH" texturecraft-nightly "$@")
|
||||
[[ "$actual" == "$expected" ]] || {
|
||||
printf 'expected:\n%s\nactual:\n%s\n' "$expected" "$actual" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
expect_forwarded() {
|
||||
expected="$(printf '<%s>\n' "$@")"
|
||||
actual=$(PATH="$bin:$PATH" texturecraft-nightly "$@")
|
||||
[[ "$actual" == "$expected" ]] || {
|
||||
printf 'expected:\n%s\nactual:\n%s\n' "$expected" "$actual" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
expect_launch
|
||||
expect_launch 'mesh with spaces.glb' '--other-name.tcraft'
|
||||
expect_forwarded --version
|
||||
expect_forwarded -V
|
||||
expect_forwarded --launch-profile nightly-v1 --profile-root /launcher/profile --version
|
||||
|
||||
echo "PASS: Arch Nightly handoff preserves binary layout and passes the Launcher profile"
|
||||
Executable
+22
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stage the TextureCraft Nightly-only handoff for the Arch packager.
|
||||
set -euo pipefail
|
||||
|
||||
here="$(cd "$(dirname "$0")" && pwd)"
|
||||
source_tree="$1"
|
||||
work="$2"
|
||||
destination="$3"
|
||||
basename="$4"
|
||||
stage="$work/$basename"
|
||||
|
||||
mkdir -p "$work"
|
||||
cp -R "$source_tree" "$stage"
|
||||
# The Nightly package is GUI-only: texturecraft-cli would read and rewrite Stable's
|
||||
# Documents/TextureCraft brushes, which a private profile cannot redirect.
|
||||
rm -f "$stage/bin/texturecraft-cli"
|
||||
mkdir "$stage/bin/.texturecraft-nightly"
|
||||
mv "$stage/bin/texturecraft" "$stage/bin/.texturecraft-nightly/texturecraft"
|
||||
cp "$here/nightly-arch-launch.sh" "$stage/bin/texturecraft"
|
||||
chmod 755 "$stage/bin/texturecraft"
|
||||
tar -C "$work" -czf "$destination/$basename.tar.gz" "$basename"
|
||||
echo "wrote $destination/$basename.tar.gz"
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
# The launcher inside the plain Nightly tarball (packaging/linux/nightly-launch.sh): a launch adds
|
||||
# the Launcher's private profile, a version query or an existing protocol passes through, and the
|
||||
# fence's shape holds (absolute root, no parent traversal, outside this copy).
|
||||
set -euo pipefail
|
||||
|
||||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
work="$(mktemp -d)"
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
mkdir -p "$work/tree"
|
||||
|
||||
# An argv recorder stands in for the GUI. It never opens a window.
|
||||
cat >"$work/tree/texturecraft-bin" <<'RECORDER'
|
||||
#!/bin/sh
|
||||
printf '<%s>\n' "$@"
|
||||
RECORDER
|
||||
chmod 755 "$work/tree/texturecraft-bin"
|
||||
cp "$HERE/nightly-launch.sh" "$work/tree/texturecraft"
|
||||
|
||||
profile="${XDG_DATA_HOME:-${HOME:-}/.local/share}/TextureCraft-Nightly"
|
||||
# The profile must be something the app's fence accepts: absolute, no parent traversal, and not
|
||||
# inside the unpacked copy (the running install).
|
||||
case "$profile" in
|
||||
/*) ;;
|
||||
*) echo "FAIL: the launcher profile is not absolute: $profile" >&2; exit 1 ;;
|
||||
esac
|
||||
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() {
|
||||
expected="$(printf '<%s>\n' --launch-profile nightly-v1 --profile-root "$profile" -- "$@")"
|
||||
actual=$("$work/tree/texturecraft" "$@")
|
||||
[[ "$actual" == "$expected" ]] || {
|
||||
printf 'expected:\n%s\nactual:\n%s\n' "$expected" "$actual" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
expect_forwarded() {
|
||||
expected="$(printf '<%s>\n' "$@")"
|
||||
actual=$("$work/tree/texturecraft" "$@")
|
||||
[[ "$actual" == "$expected" ]] || {
|
||||
printf 'expected:\n%s\nactual:\n%s\n' "$expected" "$actual" >&2
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
expect_launch
|
||||
expect_launch 'model with spaces.glb' '--other-name.tcraft'
|
||||
expect_forwarded --version
|
||||
expect_forwarded -V
|
||||
expect_forwarded --launch-profile nightly-v1 --profile-root /launcher/profile --version
|
||||
|
||||
echo "PASS: tarball Nightly launcher starts the GUI with the Launcher profile and forwards files"
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
# The entry point inside the Nightly tarball (packaging/linux/nightly.sh installs it as
|
||||
# `texturecraft`, beside the GUI as `texturecraft-bin`).
|
||||
#
|
||||
# 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
|
||||
|
||||
here="$(dirname "$(readlink -f "$0")")"
|
||||
bin="$here/texturecraft-bin"
|
||||
profile="${XDG_DATA_HOME:-${HOME:-}/.local/share}/TextureCraft-Nightly"
|
||||
|
||||
# The Launcher's protocol, and a bare version query, pass through untouched: the first already
|
||||
# names its profile, and the second must answer without one.
|
||||
case "${1-}" in
|
||||
--launch-profile | --profile-root | --version | -V) exec "$bin" "$@" ;;
|
||||
esac
|
||||
exec "$bin" --launch-profile nightly-v1 --profile-root "$profile" -- "$@"
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env bash
|
||||
# App-owned GUI-only nightly tar: no FUSE/AppImage, CLI, association or install hooks.
|
||||
set -euo pipefail
|
||||
ARCH=
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--arch) [[ $# -ge 2 ]] || { echo 'missing --arch value' >&2; exit 2; }; ARCH="$2"; shift 2 ;;
|
||||
-h|--help) echo 'Usage: nightly.sh --arch x86_64'; exit 0 ;;
|
||||
*) echo "unsupported nightly argument: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
done
|
||||
[[ "$ARCH" == x86_64 && "$(uname -s)" == Linux ]] || { echo 'only native Linux x86_64 nightly packaging is supported' >&2; exit 2; }
|
||||
# shellcheck source=../nightly-common.sh
|
||||
. "$(dirname "${BASH_SOURCE[0]}")/../nightly-common.sh"
|
||||
nightly_init linux "$ARCH" x86_64-unknown-linux-gnu
|
||||
OUTPUT="$DIST/texturecraft-$VERSION-linux-x86_64-nightly.tar.gz"
|
||||
[[ ! -e "$OUTPUT" && ! -L "$OUTPUT" ]] || nightly_die 'refusing to replace an existing nightly archive'
|
||||
nightly_build_gui
|
||||
STAGE="$NIGHTLY_WORK/stage"
|
||||
mkdir -p "$STAGE"
|
||||
# The launcher is the entry point (`texturecraft`); the GUI sits beside it and is started with the
|
||||
# Launcher's private profile, so an unpacked tarball never writes stable's folders. The flat layout
|
||||
# is what nightly-archive.py allows, and the launcher is a committed script so shellcheck covers
|
||||
# it like every other shell script.
|
||||
cp "$NIGHTLY_GUI" "$STAGE/texturecraft-bin"
|
||||
chmod 755 "$STAGE/texturecraft-bin"
|
||||
cp "$ROOT/packaging/linux/nightly-launch.sh" "$STAGE/texturecraft"
|
||||
chmod 755 "$STAGE/texturecraft"
|
||||
cp "$ROOT/assets/app-icon/texturecraft-nightly-1024.png" "$STAGE/texturecraft-nightly.png"
|
||||
nightly_copy_notices "$STAGE"
|
||||
# The private mktemp cwd is the helper authority root, not a CLI path parent.
|
||||
(cd "$NIGHTLY_WORK" && python3 "$ROOT/packaging/nightly-archive.py" linux stage archive.tar.gz)
|
||||
nightly_publish_archive "$NIGHTLY_WORK/archive.tar.gz" "$OUTPUT"
|
||||
+172
-12
@@ -7,7 +7,7 @@
|
||||
# $DIST/texturecraft-<version>-linux-<arch>.rpm Fedora, openSUSE, RHEL, ...
|
||||
# $DIST/texturecraft-<version>-linux-<arch>.tar.gz plain FHS-style tree (bin/, share/)
|
||||
#
|
||||
# Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar"]
|
||||
# Usage: packaging/linux/package.sh [--skip-build] [--formats "appimage deb rpm tar"] [--arch-tar-dir DIRECTORY]
|
||||
#
|
||||
# Needs: cargo; nfpm for deb/rpm (https://nfpm.goreleaser.com); appimagetool for the AppImage
|
||||
# (downloaded into $CARGO_TARGET_DIR if missing). Build on an old distro (CI: Ubuntu 22.04,
|
||||
@@ -21,10 +21,16 @@ APP_ID=ai.storyteller.texturecraft
|
||||
|
||||
SKIP_BUILD=0
|
||||
FORMATS="appimage deb rpm tar"
|
||||
ARCH_TAR_DIR=
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--skip-build) SKIP_BUILD=1; shift ;;
|
||||
--formats) FORMATS="$2"; shift 2 ;;
|
||||
--arch-tar-dir)
|
||||
[[ -n "${2:-}" ]] || { echo "error: --arch-tar-dir needs a directory" >&2; exit 2; }
|
||||
ARCH_TAR_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h | --help) sed -n '2,15p' "$0"; exit 0 ;;
|
||||
*) echo "unknown argument: $1" >&2; exit 2 ;;
|
||||
esac
|
||||
@@ -38,9 +44,24 @@ case "$ARCH" in
|
||||
*) echo "unsupported architecture $ARCH" >&2; exit 2 ;;
|
||||
esac
|
||||
export TEXTURECRAFT_MAINTAINER="${TEXTURECRAFT_MAINTAINER:-TextureCraft maintainers <texturecraft@storyteller.ai>}"
|
||||
IS_NIGHTLY=0
|
||||
if [[ "${TEXTURECRAFT_BUILD_CHANNEL:-}" == nightly-v1 || "$VERSION" == *-nightly* ]]; then
|
||||
IS_NIGHTLY=1
|
||||
export TEXTURECRAFT_BUILD_CHANNEL=nightly-v1
|
||||
export TEXTURECRAFT_OVERRIDE_VERSION="$VERSION"
|
||||
fi
|
||||
NIGHTLY_ICON="$ROOT/assets/app-icon/texturecraft-nightly.png"
|
||||
if [[ ! -f "$NIGHTLY_ICON" ]]; then
|
||||
NIGHTLY_ICON="$ROOT/assets/app-icon/hicolor/256x256/apps/$APP_ID.png"
|
||||
fi
|
||||
BASENAME="texturecraft-$VERSION-linux-$ARCH"
|
||||
|
||||
echo "==> TextureCraft $VERSION for Linux $ARCH ($FORMATS)"
|
||||
if [[ -n "$ARCH_TAR_DIR" && "$IS_NIGHTLY" != 1 ]]; then
|
||||
echo "error: --arch-tar-dir is only for Nightly builds" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
echo "==> TextureCraft $VERSION for Linux $ARCH ($FORMATS, channel=${TEXTURECRAFT_BUILD_CHANNEL:-stable})"
|
||||
|
||||
if [[ "$SKIP_BUILD" = 0 ]]; then
|
||||
(cd "$ROOT" && cargo build --release --locked -p texturecraft -p texturecraft-cli ${CROSS_TARGET:+--target "$CROSS_TARGET"})
|
||||
@@ -52,9 +73,20 @@ rm -rf "$WORK"
|
||||
|
||||
# ---- stage an FHS tree (shared by every format) -------------------------------------------------
|
||||
install -Dm755 "$BIN/texturecraft" "$STAGE/usr/bin/texturecraft"
|
||||
install -Dm755 "$BIN/texturecraft-cli" "$STAGE/usr/bin/texturecraft-cli"
|
||||
"${CROSS_COMPILE:-}strip" "$STAGE/usr/bin/texturecraft" "$STAGE/usr/bin/texturecraft-cli" 2>/dev/null || true
|
||||
"${CROSS_COMPILE:-}strip" "$STAGE/usr/bin/texturecraft" 2>/dev/null || true
|
||||
# The Nightly formats ship the GUI only (the kit's rule). texturecraft-cli loads its brush presets
|
||||
# from the host's Documents/TextureCraft, which is Stable's folder (`crates/automation`'s Headless),
|
||||
# so a Nightly CLI would read and rewrite Stable's brushes. Stable keeps its CLI.
|
||||
if [[ "$IS_NIGHTLY" = 0 ]]; then
|
||||
install -Dm755 "$BIN/texturecraft-cli" "$STAGE/usr/bin/texturecraft-cli"
|
||||
"${CROSS_COMPILE:-}strip" "$STAGE/usr/bin/texturecraft-cli" 2>/dev/null || true
|
||||
fi
|
||||
install -Dm644 "$HERE/$APP_ID.desktop" "$STAGE/usr/share/applications/$APP_ID.desktop"
|
||||
if [[ "$IS_NIGHTLY" = 1 ]]; then
|
||||
sed -e 's|^StartupWMClass=.*|StartupWMClass=ai.storyteller.texturecraft.nightly-v1|' \
|
||||
"$STAGE/usr/share/applications/$APP_ID.desktop" >"$STAGE/usr/share/applications/$APP_ID.desktop.tmp"
|
||||
mv "$STAGE/usr/share/applications/$APP_ID.desktop.tmp" "$STAGE/usr/share/applications/$APP_ID.desktop"
|
||||
fi
|
||||
install -Dm644 "$HERE/$APP_ID.mime.xml" "$STAGE/usr/share/mime/packages/$APP_ID.xml"
|
||||
mkdir -p "$STAGE/usr/share/metainfo"
|
||||
sed -e "s/@VERSION@/$VERSION/g" -e "s/@DATE@/$TEXTURECRAFT_BUILD_DATE/g" \
|
||||
@@ -77,17 +109,91 @@ has() { case " $FORMATS " in *" $1 "*) return 0 ;; *) return 1 ;; esac; }
|
||||
if has tar; then
|
||||
mkdir -p "$WORK/tar"
|
||||
cp -R "$STAGE/usr" "$WORK/tar/$BASENAME"
|
||||
if [[ "$IS_NIGHTLY" = 1 ]]; then
|
||||
# A Nightly binary only starts with its private profile, so an unpacked tarball gets the same
|
||||
# launcher the other Nightly formats install: `texturecraft` starts `texturecraft-bin`.
|
||||
mv "$WORK/tar/$BASENAME/bin/texturecraft" "$WORK/tar/$BASENAME/bin/texturecraft-bin"
|
||||
install -Dm755 "$HERE/nightly-launch.sh" "$WORK/tar/$BASENAME/bin/texturecraft"
|
||||
fi
|
||||
tar -C "$WORK/tar" -czf "$DIST/$BASENAME.tar.gz" "$BASENAME"
|
||||
echo "wrote $DIST/$BASENAME.tar.gz"
|
||||
fi
|
||||
|
||||
# The Arch handoff keeps the same basename as the plain tarball in a separate directory.
|
||||
if [[ -n "$ARCH_TAR_DIR" ]]; then
|
||||
mkdir -p "$ARCH_TAR_DIR"
|
||||
if [[ "$(cd "$ARCH_TAR_DIR" && pwd -P)" == "$(cd "$DIST" && pwd -P)" ]]; then
|
||||
echo "error: the Arch tar directory must differ from the release directory" >&2
|
||||
exit 2
|
||||
fi
|
||||
bash "$HERE/nightly-arch-tar.sh" "$STAGE/usr" "$WORK/arch-tar" "$ARCH_TAR_DIR" "$BASENAME"
|
||||
fi
|
||||
|
||||
# ---- .deb / .rpm --------------------------------------------------------------------------------
|
||||
if has deb || has rpm; then
|
||||
command -v nfpm >/dev/null || { echo "error: nfpm not found (https://nfpm.goreleaser.com/install/)" >&2; exit 1; }
|
||||
export VERSION
|
||||
export NFPM_ARCH="$DEB_ARCH"
|
||||
NFPM_STAGE="$STAGE"
|
||||
export NFPM_NAME="texturecraft"
|
||||
export NFPM_BIN="texturecraft"
|
||||
export NFPM_CLI="texturecraft-cli"
|
||||
if [[ "$IS_NIGHTLY" = 1 ]]; then
|
||||
NIGHTLY_DESK_ID="$APP_ID.nightly-v1"
|
||||
export NFPM_NAME="texturecraft-nightly"
|
||||
export NFPM_BIN="texturecraft-nightly"
|
||||
NFPM_STAGE="$WORK/nfpm-root"
|
||||
rm -rf "$NFPM_STAGE"
|
||||
cp -R "$STAGE" "$NFPM_STAGE"
|
||||
install -Dm755 "$NFPM_STAGE/usr/bin/texturecraft" "$NFPM_STAGE/usr/lib/texturecraft-nightly/texturecraft"
|
||||
cat >"$NFPM_STAGE/usr/bin/$NFPM_BIN" <<'WRAPPER'
|
||||
#!/bin/sh
|
||||
# TextureCraft Nightly: the GUI runs with the Launcher's private profile, which holds every
|
||||
# per-user file (settings, ui.json, logs, autosaves, materials, layouts, templates, presets).
|
||||
set -eu
|
||||
bin=/usr/lib/texturecraft-nightly/texturecraft
|
||||
profile="${XDG_DATA_HOME:-${HOME:-}/.local/share}/TextureCraft-Nightly"
|
||||
# The Launcher's protocol, and a bare version query, pass through untouched.
|
||||
case "${1-}" in
|
||||
--launch-profile | --profile-root | --version | -V) exec "$bin" "$@" ;;
|
||||
esac
|
||||
exec "$bin" --launch-profile nightly-v1 --profile-root "$profile" -- "$@"
|
||||
WRAPPER
|
||||
chmod 755 "$NFPM_STAGE/usr/bin/$NFPM_BIN"
|
||||
rm -f "$NFPM_STAGE/usr/bin/texturecraft"
|
||||
mv "$NFPM_STAGE/usr/share/doc/texturecraft" "$NFPM_STAGE/usr/share/doc/$NFPM_NAME"
|
||||
sed -e "s#^Exec=texturecraft\([[:space:]]\|$\)#Exec=$NFPM_BIN\1#" \
|
||||
-e "s|^TryExec=texturecraft$|TryExec=$NFPM_BIN|" \
|
||||
-e "s|^Icon=$APP_ID$|Icon=$NIGHTLY_DESK_ID|" \
|
||||
-e "s|^Name=TextureCraft$|Name=TextureCraft Nightly|" \
|
||||
-e '/^MimeType=/d' \
|
||||
"$NFPM_STAGE/usr/share/applications/$APP_ID.desktop" >"$NFPM_STAGE/usr/share/applications/$NIGHTLY_DESK_ID.desktop"
|
||||
rm -f "$NFPM_STAGE/usr/share/applications/$APP_ID.desktop"
|
||||
# The Nightly entry claims no MIME types (stable keeps the associations), so the metainfo must
|
||||
# not advertise them either.
|
||||
sed -e "s|<id>$APP_ID</id>|<id>$NIGHTLY_DESK_ID</id>|g" \
|
||||
-e "s|<name>TextureCraft</name>|<name>TextureCraft Nightly</name>|g" \
|
||||
-e "s|<launchable type=\"desktop-id\">$APP_ID.desktop</launchable>|<launchable type=\"desktop-id\">$NIGHTLY_DESK_ID.desktop</launchable>|g" \
|
||||
-e "s|<icon type=\"stock\">$APP_ID</icon>|<icon type=\"stock\">$NIGHTLY_DESK_ID</icon>|g" \
|
||||
-e "s|<binary>texturecraft</binary>|<binary>$NFPM_BIN</binary>|g" \
|
||||
-e '/<mediatype>/d' \
|
||||
"$NFPM_STAGE/usr/share/metainfo/$APP_ID.metainfo.xml" >"$NFPM_STAGE/usr/share/metainfo/$NIGHTLY_DESK_ID.metainfo.xml"
|
||||
rm -f "$NFPM_STAGE/usr/share/metainfo/$APP_ID.metainfo.xml"
|
||||
rm -rf "$NFPM_STAGE/usr/share/mime"
|
||||
rm -rf "$NFPM_STAGE/usr/share/icons/hicolor"
|
||||
install -Dm644 "$NIGHTLY_ICON" \
|
||||
"$NFPM_STAGE/usr/share/icons/hicolor/256x256/apps/$NIGHTLY_DESK_ID.png"
|
||||
fi
|
||||
# nfpm expands env vars in fields like `version` and `arch`, but not in `contents[].src`.
|
||||
sed "s|\${STAGE}|$STAGE|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
|
||||
DROP_LIB_TREE=
|
||||
DROP_CLI=
|
||||
# shellcheck disable=SC2016
|
||||
[[ -d "$NFPM_STAGE/usr/lib" ]] || DROP_LIB_TREE='\|^ - src: \${STAGE}/usr/lib/|,+2d;'
|
||||
# A Nightly package has no CLI, so its file list must not name one either.
|
||||
# shellcheck disable=SC2016
|
||||
[[ "$IS_NIGHTLY" = 0 ]] || DROP_CLI='\|^ - src: \${STAGE}/usr/bin/\${NFPM_CLI}|,+2d;/Includes texturecraft-cli/d;'
|
||||
# shellcheck disable=SC2016
|
||||
sed "${DROP_LIB_TREE}${DROP_CLI}s|\${STAGE}|$NFPM_STAGE|g;s|\${NFPM_BIN}|$NFPM_BIN|g;s|\${NFPM_CLI}|$NFPM_CLI|g" "$HERE/nfpm.yaml" >"$WORK/nfpm.yaml"
|
||||
# The riscv64 cross sysroot is Ubuntu 24.04, whose glibc floor is 2.39.
|
||||
if [[ "$ARCH" = riscv64 ]]; then sed -i "s/libc6 (>= 2.35)/libc6 (>= 2.39)/" "$WORK/nfpm.yaml"; fi
|
||||
for fmt in deb rpm; do
|
||||
@@ -105,9 +211,46 @@ if has appimage; then
|
||||
# app_id to our icon instead of the generic Wayland logo (opt-out env in the
|
||||
# script header). Logic is covered by packaging/linux/apprun-test.sh.
|
||||
install -Dm755 "$HERE/AppRun" "$APPDIR/AppRun"
|
||||
cp "$HERE/$APP_ID.desktop" "$APPDIR/$APP_ID.desktop"
|
||||
cp "$ROOT/assets/app-icon/hicolor/256x256/apps/$APP_ID.png" "$APPDIR/$APP_ID.png"
|
||||
ln -s "$APP_ID.png" "$APPDIR/.DirIcon"
|
||||
if [[ "$IS_NIGHTLY" = 1 ]]; then
|
||||
APPIMAGE_ID="$APP_ID.nightly-v1"
|
||||
# The desktop id and the channel line: a Nightly AppImage must start the app with the
|
||||
# Launcher's private profile, not with stable's folders (AppRun's tail does the exec).
|
||||
awk -v old_id="$APP_ID" -v new_id="$APPIMAGE_ID" '
|
||||
$0 == "DESK_ID=" old_id { print "DESK_ID=" new_id; next }
|
||||
$0 == "CHANNEL=stable" { print "CHANNEL=nightly-v1"; next }
|
||||
{ print }
|
||||
' "$APPDIR/AppRun" >"$APPDIR/AppRun.tmp"
|
||||
grep -qx 'CHANNEL=nightly-v1' "$APPDIR/AppRun.tmp" || {
|
||||
echo "error: AppRun has no CHANNEL=stable line to switch for Nightly" >&2
|
||||
exit 1
|
||||
}
|
||||
mv "$APPDIR/AppRun.tmp" "$APPDIR/AppRun"
|
||||
chmod 755 "$APPDIR/AppRun"
|
||||
sed -e "s|^Icon=$APP_ID$|Icon=$APPIMAGE_ID|" \
|
||||
-e "s|^Name=TextureCraft$|Name=TextureCraft Nightly|" \
|
||||
-e '/^MimeType=/d' \
|
||||
"$APPDIR/usr/share/applications/$APP_ID.desktop" >"$APPDIR/usr/share/applications/$APPIMAGE_ID.desktop"
|
||||
rm -f "$APPDIR/usr/share/applications/$APP_ID.desktop"
|
||||
cp "$APPDIR/usr/share/applications/$APPIMAGE_ID.desktop" "$APPDIR/$APPIMAGE_ID.desktop"
|
||||
# The Nightly desktop entry drops MimeType=, so the metainfo must not advertise the same types
|
||||
# either: AppStream would otherwise list a type the package cannot open.
|
||||
sed -e "s|<id>$APP_ID</id>|<id>$APPIMAGE_ID</id>|g" \
|
||||
-e "s|<name>TextureCraft</name>|<name>TextureCraft Nightly</name>|g" \
|
||||
-e "s|<launchable type=\"desktop-id\">$APP_ID.desktop</launchable>|<launchable type=\"desktop-id\">$APPIMAGE_ID.desktop</launchable>|g" \
|
||||
-e "s|<icon type=\"stock\">$APP_ID</icon>|<icon type=\"stock\">$APPIMAGE_ID</icon>|g" \
|
||||
-e '/<mediatype>/d' \
|
||||
"$APPDIR/usr/share/metainfo/$APP_ID.metainfo.xml" >"$APPDIR/usr/share/metainfo/$APPIMAGE_ID.metainfo.xml"
|
||||
rm -f "$APPDIR/usr/share/metainfo/$APP_ID.metainfo.xml"
|
||||
rm -rf "$APPDIR/usr/share/icons/hicolor"
|
||||
install -Dm644 "$NIGHTLY_ICON" \
|
||||
"$APPDIR/usr/share/icons/hicolor/256x256/apps/$APPIMAGE_ID.png"
|
||||
cp "$NIGHTLY_ICON" "$APPDIR/$APPIMAGE_ID.png"
|
||||
ln -s "$APPIMAGE_ID.png" "$APPDIR/.DirIcon"
|
||||
else
|
||||
cp "$HERE/$APP_ID.desktop" "$APPDIR/$APP_ID.desktop"
|
||||
cp "$ROOT/assets/app-icon/hicolor/256x256/apps/$APP_ID.png" "$APPDIR/$APP_ID.png"
|
||||
ln -s "$APP_ID.png" "$APPDIR/.DirIcon"
|
||||
fi
|
||||
|
||||
TOOL="${APPIMAGETOOL:-$(command -v appimagetool || true)}"
|
||||
if [[ -z "$TOOL" ]]; then
|
||||
@@ -129,11 +272,24 @@ if has appimage; then
|
||||
# next to each AppImage on GitHub Releases. `latest` is the newest published release that is
|
||||
# not a pre-release. A fork's builds point at its own releases through GITHUB_REPOSITORY.
|
||||
REPO="${GITHUB_REPOSITORY:-storytold/texturecraft}"
|
||||
UPDATE_INFO="gh-releases-zsync|${REPO%%/*}|${REPO#*/}|latest|texturecraft-*-linux-$ARCH.AppImage.zsync"
|
||||
UPDATE_ARGS=()
|
||||
if [[ "$IS_NIGHTLY" = 0 ]]; then
|
||||
UPDATE_INFO="gh-releases-zsync|${REPO%%/*}|${REPO#*/}|latest|texturecraft-*-linux-$ARCH.AppImage.zsync"
|
||||
UPDATE_ARGS=(-u "$UPDATE_INFO")
|
||||
else
|
||||
# Nightly releases are GitHub pre-releases (`latest` only selects stable releases), so point
|
||||
# zsync update metadata at pre-release tags rather than stable `latest`.
|
||||
if [[ "$VERSION" == *-nightly* ]]; then
|
||||
UPDATE_INFO="gh-releases-zsync|${REPO%%/*}|${REPO#*/}|latest-pre|texturecraft-*-nightly*-linux-$ARCH.AppImage.zsync"
|
||||
else
|
||||
UPDATE_INFO="gh-releases-zsync|${REPO%%/*}|${REPO#*/}|latest-pre|texturecraft-*-linux-$ARCH.AppImage.zsync"
|
||||
fi
|
||||
UPDATE_ARGS=(-u "$UPDATE_INFO")
|
||||
fi
|
||||
# Extract-and-run: works without FUSE (containers, CI). The output embeds the static runtime,
|
||||
# so users don't need libfuse2 either. With zsyncmake on the host (CI installs the zsync
|
||||
# package) appimagetool also writes the .zsync, into its working directory, hence the cd.
|
||||
(cd "$DIST" && ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream -u "$UPDATE_INFO" "$APPDIR" "$OUT")
|
||||
(cd "$DIST" && ARCH="$ARCH" APPIMAGE_EXTRACT_AND_RUN=1 "$TOOL" --no-appstream "${UPDATE_ARGS[@]}" "$APPDIR" "$OUT")
|
||||
echo "wrote $OUT"
|
||||
if [[ -s "$OUT.zsync" ]]; then
|
||||
echo "wrote $OUT.zsync"
|
||||
@@ -142,10 +298,14 @@ if has appimage; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# A Stable tree is checked through its CLI; a Nightly tree has only the GUI, which answers the
|
||||
# same bare `--version` query (no profile, so nothing is created) with its channel line.
|
||||
SMOKE_BIN="$STAGE/usr/bin/texturecraft-cli"
|
||||
if [[ "$IS_NIGHTLY" = 1 ]]; then SMOKE_BIN="$STAGE/usr/bin/texturecraft"; fi
|
||||
if [[ -n "${CROSS_TARGET:-}" ]]; then
|
||||
if [[ -n "${EMULATOR:-}" ]]; then "$EMULATOR" "$STAGE/usr/bin/texturecraft-cli" --version; fi
|
||||
if [[ -n "${EMULATOR:-}" ]]; then "$EMULATOR" "$SMOKE_BIN" --version; fi
|
||||
else
|
||||
"$STAGE/usr/bin/texturecraft-cli" --version
|
||||
"$SMOKE_BIN" --version
|
||||
fi
|
||||
echo "==> done"
|
||||
ls -lh "$DIST"
|
||||
Reference in new issue
Block a user