a669eeb503
modpack-final.zip is 78MB, well over Gitea's upload limit. Served directly from Caddy's existing static/ mount instead (path-routed within the minecraft.mivanchenko.de block, alongside the BlueMap failover) - no new container or mount needed. install.sh/install.ps1 MODPACK_URL updated accordingly; install scripts themselves stay on Gitea since they're small text files. Verified full byte-exact download end-to-end. Also drops the stale "moving to the venue" comments now that the server is permanently on mivanchenko.de.
102 lines
4.1 KiB
Bash
Executable File
102 lines
4.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# LAN party bootstrap: installs Fjord Launcher Unlocked (DRM-free Prism fork),
|
|
# seeds a persistent offline account, drops in the pre-built modpack instance,
|
|
# and launches straight into it on the LAN server.
|
|
#
|
|
# Hosted from Gitea (git.mivanchenko.de), not a local http.server — see HOSTING.md.
|
|
# Participants run: curl -fsSL https://git.mivanchenko.de/mivanchenko/mc-lan-party/raw/branch/main/install.sh | bash
|
|
set -euo pipefail
|
|
|
|
# ---- EDIT ME before hosting ----
|
|
HOST_URL="https://git.mivanchenko.de/mivanchenko/mc-lan-party/raw/branch/main" # Gitea raw-file base URL, for this script + install.ps1 (small text files)
|
|
MODPACK_URL="https://minecraft.mivanchenko.de/modpack.zip" # served directly by Caddy (static/ mount), NOT Gitea — modpack.zip is well over Gitea's 50MB upload cap
|
|
INSTANCE_NAME="LANParty" # must match the top-level folder name inside modpack.zip
|
|
SERVER_ADDR="minecraft.mivanchenko.de:25565" # always-on homelab box, same address for prep and the actual party
|
|
GH_REPO="unmojang/FjordLauncherUnlocked" # fallback if hero-persson's fork disappears; see note below
|
|
# ---------------------------------
|
|
|
|
INSTALL_DIR="$HOME/mc-lan-party"
|
|
mkdir -p "$INSTALL_DIR"
|
|
cd "$INSTALL_DIR"
|
|
|
|
echo "==> Setting up in $INSTALL_DIR"
|
|
|
|
os="$(uname -s)"
|
|
arch="$(uname -m)"
|
|
|
|
api_url="https://api.github.com/repos/hero-persson/FjordLauncherUnlocked/releases/latest"
|
|
release_json="$(curl -fsSL "$api_url")"
|
|
|
|
pick_asset() {
|
|
# $1 = grep pattern for the asset name
|
|
echo "$release_json" | grep -oE '"browser_download_url": *"[^"]+"' \
|
|
| cut -d'"' -f4 | grep -E "$1" | head -n1
|
|
}
|
|
|
|
LAUNCHER_BIN=""
|
|
|
|
if [[ "$os" == "Linux" ]]; then
|
|
if [[ "$arch" == "aarch64" ]]; then
|
|
url="$(pick_asset 'Linux-aarch64\.AppImage$')"
|
|
else
|
|
url="$(pick_asset 'Linux-x86_64\.AppImage$')"
|
|
fi
|
|
[[ -n "$url" ]] || { echo "Could not find a Linux AppImage in the latest release." >&2; exit 1; }
|
|
echo "==> Downloading $url"
|
|
curl -fsSL -o FjordLauncher.AppImage "$url"
|
|
chmod +x FjordLauncher.AppImage
|
|
LAUNCHER_BIN="$INSTALL_DIR/FjordLauncher.AppImage"
|
|
elif [[ "$os" == "Darwin" ]]; then
|
|
url="$(pick_asset 'macOS-.*\.zip$')"
|
|
[[ -n "$url" ]] || { echo "Could not find a macOS build in the latest release." >&2; exit 1; }
|
|
echo "==> Downloading $url"
|
|
curl -fsSL -o FjordLauncher.zip "$url"
|
|
unzip -oq FjordLauncher.zip -d app
|
|
app_path="$(find app -maxdepth 2 -name '*.app' | head -n1)"
|
|
LAUNCHER_BIN="$app_path/Contents/MacOS/$(ls "$app_path/Contents/MacOS" | head -n1)"
|
|
else
|
|
echo "Unsupported OS for install.sh: $os. Use install.ps1 on Windows." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# ---- offline account: compute Mojang-style offline UUID so playerdata persists across launches ----
|
|
read -rp "Minecraft nickname [${USER:-Player}]: " NICK
|
|
NICK="${NICK:-${USER:-Player}}"
|
|
|
|
md5hex="$(printf '%s' "OfflinePlayer:$NICK" | md5sum | cut -d' ' -f1)"
|
|
variant_nibble=$(( (16#${md5hex:16:1} & 3) | 8 ))
|
|
variant_hex="$(printf '%x' "$variant_nibble")"
|
|
patched="${md5hex:0:12}3${md5hex:13:3}${variant_hex}${md5hex:17:15}"
|
|
UUID="${patched:0:8}-${patched:8:4}-${patched:12:4}-${patched:16:4}-${patched:20:12}"
|
|
CLIENT_TOKEN="$(printf '%s' "ClientToken:$NICK" | md5sum | cut -d' ' -f1)"
|
|
|
|
cat > accounts.json <<EOF
|
|
{
|
|
"accounts": [
|
|
{
|
|
"active": true,
|
|
"type": "Offline",
|
|
"profile": { "id": "$UUID", "name": "$NICK", "capes": [], "skin": { "id": "", "url": "", "variant": "" } },
|
|
"entitlement": { "canPlayMinecraft": true, "ownsMinecraft": true },
|
|
"ygg": { "token": "0", "extra": { "clientToken": "$CLIENT_TOKEN", "userName": "$NICK" }, "iat": $(date +%s) }
|
|
}
|
|
],
|
|
"formatVersion": 3
|
|
}
|
|
EOF
|
|
echo "==> Offline account '$NICK' ready (UUID $UUID)"
|
|
|
|
# ---- modpack instance ----
|
|
mkdir -p instances
|
|
if [[ ! -d "instances/$INSTANCE_NAME" ]]; then
|
|
echo "==> Downloading modpack from $MODPACK_URL"
|
|
curl -fsSL -o modpack.zip "$MODPACK_URL"
|
|
unzip -oq modpack.zip -d instances
|
|
echo "==> Modpack installed to instances/$INSTANCE_NAME"
|
|
else
|
|
echo "==> Instance already present, skipping download"
|
|
fi
|
|
|
|
echo "==> Launching into $INSTANCE_NAME as $NICK, joining $SERVER_ADDR"
|
|
"$LAUNCHER_BIN" --dir "$INSTALL_DIR" --launch "$INSTANCE_NAME" --profile "$NICK" --server "$SERVER_ADDR"
|