monkeystudio / scripts /install_godot.sh
geter62's picture
Upload folder using huggingface_hub
84e8204 verified
Raw History Blame Contribute Delete
2.22 kB
#!/usr/bin/env bash
#
# install_godot.sh - install the latest stable Godot editor + export templates
# on a Debian/Ubuntu Linux development machine.
#
# This is the scripted form of STEP 1.1 from docs/BUILD_ANDROID.md.
# It is safe to re-run; it overwrites the previous binary.
#
set -euo pipefail
GODOT_VERSION="${GODOT_VERSION:-4.7.2-stable}"
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
TMP_DIR="$(mktemp -d)"
trap 'rm -rf "$TMP_DIR"' EXIT
echo "==> Installing Godot ${GODOT_VERSION} into ${INSTALL_DIR}"
# 1. Fetch the editor binary.
# The version-numbered name on the release server is the download URL.
EDITOR_URL="https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_linux.x86_64.zip"
curl -fL --retry 3 --max-time 600 -o "${TMP_DIR}/godot.zip" "${EDITOR_URL}"
# 2. Unzip and install.
unzip -o -q "${TMP_DIR}/godot.zip" -d "${TMP_DIR}"
install -m 0755 "${TMP_DIR}/Godot_v${GODOT_VERSION}_linux.x86_64" "${INSTALL_DIR}/godot"
# 3. Redirect the .editor_settings templates dir so export works on first run.
TEMPLATE_DIR="${HOME}/.local/share/godot/export_templates/$(echo "${GODOT_VERSION}" | sed 's/-stable/.stable/')"
mkdir -p "${TEMPLATE_DIR}"
TPZ_URL="https://github.com/godotengine/godot/releases/download/${GODOT_VERSION}/Godot_v${GODOT_VERSION}_export_templates.tpz"
curl -fL --retry 3 --max-time 600 -o "${TMP_DIR}/templates.tpz" "${TPZ_URL}" || {
echo "!! Could not auto-download export templates." >&2
echo " In the editor: Editor > Manage Export Templates > Download and Install." >&2
}
if [ -f "${TMP_DIR}/templates.tpz" ]; then
unzip -o -q "${TMP_DIR}/templates.tpz" -d "${TMP_DIR}/tpl"
cp -f "${TMP_DIR}"/tpl/templates/* "${TEMPLATE_DIR}/" 2>/dev/null || true
fi
# 4. Runtime libraries Godot needs on a headless Debian box.
# (Only the libs are installed here; skip if you already have a desktop.)
if command -v apt-get >/dev/null 2>&1; then
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq || true
apt-get install -y -qq \
libfontconfig1 libfreetype6 libx11-6 libxcursor1 libxinerama1 \
libxrandr2 libxi6 libgl1 libasound2 libpulse0 unzip curl || true
fi
echo "==> Done. Verify with: godot --version"
godot --version