Skip to content

Commit

Permalink
Fix ARM64 modpack installation and improve error handling (#10)
Browse files Browse the repository at this point in the history
Closes #8
  • Loading branch information
flobernd authored Jan 2, 2025
1 parent 5d5bb10 commit 9839617
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions minecraft-ftb/data/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ get_and_run_installer() {
set -e

# shellcheck disable=SC2155
local architecture="$([ "$(uname -m)" == "x86_64" ] && echo "linux" || echo "arm\/linux")"
local architecture="$([ "$(uname -m)" == "x86_64" ] && echo "linux" || echo "arm/linux")"

local pack_url="https://api.modpacks.ch/public/modpack/${1}/${2}/server/${architecture}"
local pack_installer="/var/lib/minecraft/serverinstall_${1}_${2}"
Expand All @@ -105,7 +105,22 @@ get_and_run_installer() {
chmod 0700 /var/lib/minecraft

# Download the installer
curl --fail --connect-timeout 30 --max-time 30 --no-progress-meter -o "${pack_installer}" "${pack_url}"
local content_type
content_type=$(curl --fail --connect-timeout 30 --max-time 30 --no-progress-meter -w '%{content_type}' -o "${pack_installer}" "${pack_url}") || exit $?

if [ "$content_type" != "application/octet-stream" ]; then
echoerr "Failed to download the modpack installer. Unexpected response from server."

if [ "$content_type" = "application/json" ]; then
# shellcheck disable=SC2155
local response="$(cat "${pack_installer}")"
echoerr "$(echo "${response}" | jq -r '.message')"
fi

rm "${pack_installer}"
return 1
fi

chmod +x "${pack_installer}"

# Install- or update the modpack
Expand Down

0 comments on commit 9839617

Please sign in to comment.