31 lines
1.7 KiB
Bash
31 lines
1.7 KiB
Bash
#!/bin/bash
|
|
set -euo pipefail
|
|
# Pinned Universal binary: native Intel and Apple Silicon, no Rosetta required.
|
|
engine_install() {
|
|
local root="$1" archive stage actual
|
|
local expected="59d195d1876210fa0f8c36bc10b147339fc8e076c684b74111533992f1a1dcdc0f760461f4cadad627e5b11e74468b54b9355fc6ea0c507c52533dfa7aa0c617"
|
|
if [[ -x "$root/tools/godot/Godot.app/Contents/MacOS/Godot" ]]; then return; fi
|
|
mkdir -p "$root/tools/godot"
|
|
stage=$(mktemp -d "$root/tools/godot/.download.XXXXXX")
|
|
archive="$stage/godot.zip"
|
|
echo "02 / Godot 4.5 herunterladen und prüfen …"
|
|
if [[ -f "${BLOCKLINE_ENGINE_ARCHIVE:-$root/Godot_v4.5-stable_macos.universal.zip}" ]]; then
|
|
/bin/cp "${BLOCKLINE_ENGINE_ARCHIVE:-$root/Godot_v4.5-stable_macos.universal.zip}" "$archive"
|
|
elif ! /usr/bin/curl --fail --location --retry 3 --connect-timeout 20 --max-time 600 --proto '=https' --tlsv1.2 \
|
|
'https://github.com/godotengine/godot-builds/releases/download/4.5-stable/Godot_v4.5-stable_macos.universal.zip' -o "$archive"; then
|
|
echo "Download fehlgeschlagen. Erneuter Start versucht die Installation erneut." >&2; return 1
|
|
fi
|
|
actual=$(/usr/bin/shasum -a 512 "$archive" | /usr/bin/awk '{print $1}')
|
|
[[ "$actual" == "$expected" ]] || { echo "Godot-Prüfsumme ungültig." >&2; return 1; }
|
|
/usr/bin/ditto -x -k "$archive" "$stage"
|
|
[[ -f "$stage/Godot.app/Contents/MacOS/Godot" ]] || return 1
|
|
/bin/chmod +x "$stage/Godot.app/Contents/MacOS/Godot"
|
|
# Never alter Gatekeeper or remove quarantine attributes.
|
|
if [[ -e "$root/tools/godot/Godot.app" ]]; then
|
|
echo "Unvollständige Engine vorhanden. Bitte tools/godot/Godot.app prüfen." >&2; return 1
|
|
fi
|
|
/bin/mv "$stage/Godot.app" "$root/tools/godot/Godot.app"
|
|
/bin/rm -f "$archive"
|
|
/bin/rmdir "$stage"
|
|
}
|