okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
b6a38b328
main
1#!/usr/bin/env bash 2# Build the Strata DMG without a Finder session. 3# 4# Tauri's default DMG step runs an AppleScript that asks Finder to arrange the window (icon 5# positions, background). Finder AppleEvents time out in a non-GUI or sandboxed context — observed 6# here as `Finder got an error: AppleEvent timed out. (-1712)` — so the default path cannot be 7# relied on for an automated build. The upstream `create-dmg` script already supports exactly this 8# case via `--skip-jenkins`, which produces a plain, correct DMG with the app and the Applications 9# drop link and no cosmetic arrangement. 10# 11# Usage: scripts/make-dmg.sh [output.dmg] 12set -euo pipefail 13 14HERE =" $( cd " $( dirname " ${ BASH_SOURCE [0]} " ) " && pwd ) " 15DESKTOP =" $( cd " $ HERE /.." && pwd ) " 16BUNDLE =" $ DESKTOP /src-tauri/target/release/bundle" 17APP =" $ BUNDLE /macos/Strata.app" 18VERSION =" $( grep -m1 '^version = ' " $ DESKTOP /src-tauri/Cargo.toml" | cut -d '"' -f2 ) " # the one place the app version is written 19OUT =" ${ 1 :- $ BUNDLE /dmg/Strata_${ VERSION }_aarch64.dmg} " 20 21if [ ! -d" $ APP " ];then 22echo "error: $ APP does not exist; run 'cargo tauri build --bundles app' first" >&2 23exit 1 24fi 25 26WORK =" $( mktemp -d -t strata-dmg) " 27trap 'rm -rf "$WORK"' EXIT 28 29# A staging folder is what create-dmg copies into the image: the app, and nothing else. 30# 31# The Applications drop link is created by `--app-drop-link` below. Adding one here as well makes 32# create-dmg fail with "File exists", because it links into the volume it is assembling. 33mkdir -p " $ WORK /stage" 34cp -R " $ APP " " $ WORK /stage/" 35 36# Reuse Tauri's vendored create-dmg if the bundler left it behind, otherwise take it from the 37# bundle cache. Building it yourself is not necessary and not expected. 38SCRIPT =" $ BUNDLE /dmg/bundle_dmg.sh" 39if [ ! -x" $ SCRIPT " ];then 40echo "error: $ SCRIPT not found; run 'cargo tauri build --bundles dmg' once to vendor it" >&2 41exit 1 42fi 43 44mkdir -p " $( dirname " $ OUT " ) " 45rm -f " $ OUT " 46 47# --skip-jenkins: no Finder AppleScript. Everything else is the same code path Tauri uses. 48" $ SCRIPT " \ 49--volname "Strata $ VERSION " \ 50--volicon " $ BUNDLE /macos/Strata.app/Contents/Resources/Strata.icns" \ 51--app-drop-link 400 200 \ 52--skip-jenkins \ 53--no-internet-enable \ 54" $ OUT " " $ WORK /stage" 55 56echo 57echo "built: $ OUT " 58ls -lh " $ OUT " | awk '{print "size: " $5}' 59shasum -a 256" $ OUT "