Compare commits

...

4 Commits

Author SHA1 Message Date
Geoff Bourne
30000819d8 Fix syntax error in start-deployPurpur 2024-12-06 07:52:59 -06:00
Geoff Bourne
c6dbc88ea9 Re-install FTB if manifest is missing (#3177) 2024-12-05 07:40:50 -06:00
Geoff Bourne
a31440476c Fixed new FTB installer args and manifest (#3176) 2024-12-04 07:20:10 -06:00
Geoff Bourne
350bada3a8 Switch FTBA to use https://api.feed-the-beast.com/v1 (#3174) 2024-12-03 21:25:44 -06:00
3 changed files with 53 additions and 27 deletions

View File

@@ -1,22 +1,21 @@
services:
mc:
# FTBA support is only available in non-Alpine images
image: itzg/minecraft-server:${IMAGE_TAG:-java8-multiarch}
image: itzg/minecraft-server
ports:
# expose the Minecraft server port outside of container
- 25565:25565
- "25565:25565"
environment:
# REQUIRED for all types
EULA: "TRUE"
# Set server type (vs the default of vanilla)
TYPE: FTBA
# Use Pack ID from https://ftb.neptunepowered.org/pack/ftb-presents-direwolf20-1-12/
FTB_MODPACK_ID: "31"
FTB_MODPACK_VERSION_ID: ""
# Use Pack ID from https://www.feed-the-beast.com/modpacks/119-ftb-presents-direwolf20-120?tab=about
FTB_MODPACK_ID: "119"
# FTB_MODPACK_VERSION_ID: ""
volumes:
# use a named, managed volume for data volume
- ftba:/data
- data:/data
volumes:
# declared the named volume, but use default/local storage engine
ftba: {}
data: {}

View File

@@ -1,6 +1,8 @@
#!/bin/bash
: "${FTB_FORCE_REINSTALL:=false}"
: "${FTB_BASE_URL:=https://api.feed-the-beast.com/v1/modpacks}"
# Legacy base URL was https://api.modpacks.ch
ftbInstallMarker=".ftb-installed"
@@ -9,8 +11,30 @@ ftbInstallMarker=".ftb-installed"
isDebugging && set -x
set -e
function getVersion() {
jq -r --arg name "$1" '.targets|unique[] | select(.name == $name) | .version' version.json
#
#{
# "id": 119,
# "name": "FTB Presents Direwolf20 1.20",
# "versionName": "1.16.0",
# "versionId": 12252,
# "modPackTargets": {
# "modLoader": {
# "name": "neoforge",
# "version": "47.1.84"
# },
# "javaVersion": "17.0.7+7",
# "mcVersion": "1.20.1"
# },
ftbManifest=.manifest.json
function getModLoaderName() {
jq -r ".modPackTargets.modLoader.name" ${ftbManifest}
}
function getModLoaderVersion() {
jq -r ".modPackTargets.modLoader.version" ${ftbManifest}
}
function getMinecraftVersion() {
jq -r ".modPackTargets.mcVersion" ${ftbManifest}
}
if [[ $(getDistro) = alpine ]]; then
@@ -29,7 +53,7 @@ if ! [[ ${FTB_MODPACK_ID} =~ [0-9]+ ]]; then
fi
if [[ ! $FTB_MODPACK_VERSION_ID ]]; then
if ! FTB_MODPACK_VERSION_ID=$(curl -fsSL https://api.modpacks.ch/public/modpack/${FTB_MODPACK_ID} | jq -r '.versions | sort_by(.updated)[-1].id'); then
if ! FTB_MODPACK_VERSION_ID=$(curl -fsSL "${FTB_BASE_URL}/public/modpack/${FTB_MODPACK_ID}" | jq -r '.versions | sort_by(.updated)[-1].id'); then
logError "Unable to resolve latest modpack version ID for modpack ${FTB_MODPACK_ID}"
exit 1
fi
@@ -38,48 +62,51 @@ elif ! [[ ${FTB_MODPACK_VERSION_ID} =~ [0-9]+ ]]; then
exit 1
fi
if isTrue "$FTB_FORCE_REINSTALL" || ! [ -f "${ftbInstallMarker}" ] || [ "$(cat "${ftbInstallMarker}")" != "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" ]; then
if isTrue "$FTB_FORCE_REINSTALL" || ! [ -f "${ftbManifest}" ] || ! [ -f "${ftbInstallMarker}" ] || [ "$(cat "${ftbInstallMarker}")" != "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" ]; then
ftbInstaller=/data/ftb-installer
arm=
if ! [[ -f "${ftbInstaller}" ]]; then
log "Downloading FTB installer"
if [ "$(uname -m)" == "aarch64" ]; then
log "Downloading ARM installer"
log "Downloading FTB installer for ARM"
arm="/arm"
else
log "Downloading x86 installer"
log "Downloading FTB installer for x86"
fi
# Example: https://api.feed-the-beast.com/v1/modpacks/public/modpack/119/12252/server/linux
# https://api.feed-the-beast.com/v1/modpacks/public/modpack/119/12252/server/arm/linux
# 1-1 is a placeholder modpack for just grabbing the installer
if ! get -o "${ftbInstaller}" "${FTB_BASE_URL}/public/modpack/1/1/server${arm}/linux"; then
logError "Failed to download FTB installer"
exit 1
fi
curl -fsSL https://api.modpacks.ch/public/modpack/1/1/server${arm}/linux -o "${ftbInstaller}"
chmod +x "${ftbInstaller}"
fi
log "Installing modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID}"
log "This could take a while..."
${ftbInstaller} "${FTB_MODPACK_ID}" "${FTB_MODPACK_VERSION_ID}" --noscript --auto > ftb-installer.log
${ftbInstaller} -pack "${FTB_MODPACK_ID}" -version "${FTB_MODPACK_VERSION_ID}" -auto -force | tee ftb-installer.log
rm -f forge*installer.jar
echo "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" > ${ftbInstallMarker}
writeEula
# some modpacks result in --w----r-- permissions
chmod a+r version.json
else
log "FTB modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID} is ready to go"
fi
forgeVersion=$(getVersion "forge")
fabricVersion=$(getVersion "fabric")
mcVersion=$(getVersion "minecraft")
modLoader="$(getModLoaderName)"
modLoaderVersion="$(getModLoaderVersion)"
mcVersion=$(getMinecraftVersion)
VERSION="$mcVersion"
export VERSION
variants=(
"forge-${mcVersion}-${forgeVersion}.jar"
"forge-${mcVersion}-${forgeVersion}-universal.jar"
"forge-${mcVersion}-${forgeVersion}-${mcVersion}-universal.jar"
"fabric-${mcVersion}-${fabricVersion}-server-launch.jar"
run.sh
"${modLoader}-${mcVersion}-${modLoaderVersion}-universal.jar"
"${modLoader}-${mcVersion}-${modLoaderVersion}-${mcVersion}-universal.jar"
"${modLoader}-${mcVersion}-${modLoaderVersion}-server-launch.jar"
"${modLoader}-${mcVersion}-${modLoaderVersion}.jar"
)
for f in "${variants[@]}"; do
if [ -f $f ]; then

View File

@@ -15,7 +15,7 @@ if [[ $PURPUR_DOWNLOAD_URL ]]; then
if ! mc-image-helper install-purpur \
--output-directory=/data \
--results-file="$resultsFile" \
--url="$PURPUR_DOWNLOAD_URL}"; then
--url="${PURPUR_DOWNLOAD_URL}"; then
logError "Failed to download from custom Purpur URL"
exit 1
fi