Files

47 lines
2.9 KiB
Bash

#!/bin/bash
set -euo pipefail
source_root=$(cd "$(dirname "$0")/.." && pwd)
source "$source_root/macos/engine.sh"
export BLOCKLINE_ENGINE_ARCHIVE="$source_root/Godot_v4.5-stable_macos.universal.zip"
target="$HOME/Applications/BLOCKLINE.app"
stage=""
fail() {
/usr/bin/osascript - "$stage" <<'APPLESCRIPT'
on run argv
display dialog "Installation nicht abgeschlossen. Vorhandene Installationen bleiben erhalten. Diagnose und temporäre Dateien: " & item 1 of argv with title "BLOCKLINE Setup" buttons {"OK"} default button 1 with icon caution
end run
APPLESCRIPT
}
trap fail ERR
/usr/bin/osascript <<'APPLESCRIPT'
display dialog "B / L — LOCAL OPERATIONS" & return & return & "DEIN NÄCHSTES MATCH." & return & "EINEN KLICK ENTFERNT." & return & return & "Spiel und Godot 4.5 werden für Intel oder Apple Silicon eingerichtet. Installation unter Benutzer → Programme → BLOCKLINE." & return & return & "Internet wird nur zum Engine-Download benötigt." with title "BLOCKLINE / Setup" buttons {"Abbrechen", "Installieren"} default button "Installieren" cancel button "Abbrechen" with icon note
APPLESCRIPT
if [[ -e "$target" ]]; then
/usr/bin/osascript -e 'display dialog "BLOCKLINE.app existiert bereits. Bitte die vorhandene App vor einer Neuinstallation im Finder umbenennen. Sie wird nicht überschrieben." with title "BLOCKLINE" buttons {"OK"}'
exit 1
fi
mkdir -p "$HOME/Applications"
stage=$(mktemp -d "$HOME/Applications/.blockline-setup.XXXXXX")
app="$stage/BLOCKLINE.app"
game="$app/Contents/Resources/game"
mkdir -p "$app/Contents/MacOS" "$game/logs"
echo "01 / Spieldateien installieren …"
for folder in assets scenes scripts macos; do /usr/bin/ditto "$source_root/$folder" "$game/$folder"; done
if [[ -d "$source_root/licenses" ]]; then /usr/bin/ditto "$source_root/licenses" "$game/licenses"; fi
/bin/cp "$source_root/project.godot" "$game/project.godot"
/bin/cp "$source_root/macos/Info.plist" "$app/Contents/Info.plist"
/bin/cp "$source_root/macos/app-launch.sh" "$app/Contents/MacOS/BLOCKLINE"
/bin/chmod +x "$app/Contents/MacOS/BLOCKLINE"
engine_install "$game"
echo "03 / Spielressourcen vorbereiten …"
"$game/tools/godot/Godot.app/Contents/MacOS/Godot" --headless --rendering-method gl_compatibility --editor --import --quit --path "$game" --log-file "$game/logs/setup-import.log"
if /usr/bin/grep -q 'SCRIPT ERROR' "$game/logs/setup-import.log"; then false; fi
/bin/mv "$app" "$target"
/bin/rmdir "$stage"
/usr/bin/osascript <<'APPLESCRIPT'
display dialog "RELAY DISTRICT IST BEREIT." & return & return & "BLOCKLINE wurde in deinem Programme-Ordner installiert. Du kannst die App künftig direkt öffnen und offline spielen." with title "BLOCKLINE / Fertig" buttons {"Schließen", "Jetzt spielen"} default button "Jetzt spielen" with icon note
if button returned of result is "Jetzt spielen" then
do shell script "/usr/bin/open " & quoted form of (POSIX path of (path to home folder) & "Applications/BLOCKLINE.app")
end if
APPLESCRIPT