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

View File

@@ -1,6 +1,8 @@
#!/bin/bash #!/bin/bash
: "${FTB_FORCE_REINSTALL:=false}" : "${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" ftbInstallMarker=".ftb-installed"
@@ -9,8 +11,30 @@ ftbInstallMarker=".ftb-installed"
isDebugging && set -x isDebugging && set -x
set -e 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 if [[ $(getDistro) = alpine ]]; then
@@ -29,7 +53,7 @@ if ! [[ ${FTB_MODPACK_ID} =~ [0-9]+ ]]; then
fi fi
if [[ ! $FTB_MODPACK_VERSION_ID ]]; then 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}" logError "Unable to resolve latest modpack version ID for modpack ${FTB_MODPACK_ID}"
exit 1 exit 1
fi fi
@@ -38,48 +62,51 @@ elif ! [[ ${FTB_MODPACK_VERSION_ID} =~ [0-9]+ ]]; then
exit 1 exit 1
fi 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 ftbInstaller=/data/ftb-installer
arm= arm=
if ! [[ -f "${ftbInstaller}" ]]; then if ! [[ -f "${ftbInstaller}" ]]; then
log "Downloading FTB installer"
if [ "$(uname -m)" == "aarch64" ]; then if [ "$(uname -m)" == "aarch64" ]; then
log "Downloading ARM installer" log "Downloading FTB installer for ARM"
arm="/arm" arm="/arm"
else 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 fi
curl -fsSL https://api.modpacks.ch/public/modpack/1/1/server${arm}/linux -o "${ftbInstaller}"
chmod +x "${ftbInstaller}" chmod +x "${ftbInstaller}"
fi fi
log "Installing modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID}" log "Installing modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID}"
log "This could take a while..." 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 rm -f forge*installer.jar
echo "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" > ${ftbInstallMarker} echo "${FTB_MODPACK_ID}=${FTB_MODPACK_VERSION_ID}" > ${ftbInstallMarker}
writeEula writeEula
# some modpacks result in --w----r-- permissions
chmod a+r version.json
else else
log "FTB modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID} is ready to go" log "FTB modpack ID ${FTB_MODPACK_ID}, version ID ${FTB_MODPACK_VERSION_ID} is ready to go"
fi fi
forgeVersion=$(getVersion "forge") modLoader="$(getModLoaderName)"
fabricVersion=$(getVersion "fabric") modLoaderVersion="$(getModLoaderVersion)"
mcVersion=$(getVersion "minecraft") mcVersion=$(getMinecraftVersion)
VERSION="$mcVersion" VERSION="$mcVersion"
export VERSION export VERSION
variants=( variants=(
"forge-${mcVersion}-${forgeVersion}.jar"
"forge-${mcVersion}-${forgeVersion}-universal.jar"
"forge-${mcVersion}-${forgeVersion}-${mcVersion}-universal.jar"
"fabric-${mcVersion}-${fabricVersion}-server-launch.jar"
run.sh 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 for f in "${variants[@]}"; do
if [ -f $f ]; then if [ -f $f ]; then

View File

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