From 5d55ce2b259d24ebdf7e43b8fcd23da48cd30c96 Mon Sep 17 00:00:00 2001 From: Jeremy White Date: Fri, 8 Feb 2019 08:11:01 -0500 Subject: [PATCH] feat(minecraft/entrypoint): download manifests --- minecraft-server/start-finalSetup02Modpack | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/minecraft-server/start-finalSetup02Modpack b/minecraft-server/start-finalSetup02Modpack index 3894a1bc..5bb5e034 100755 --- a/minecraft-server/start-finalSetup02Modpack +++ b/minecraft-server/start-finalSetup02Modpack @@ -1,5 +1,8 @@ #!/bin/bash +# CURSE_URL_BASE used in manifest downloads below +CURSE_URL_BASE=${CURSE_URL_BASE:-https://minecraft.curseforge.com/projects} + # Remove old mods/plugins if [ "$REMOVE_OLD_MODS" = "TRUE" ]; then if [ "$TYPE" = "SPIGOT" ]; then @@ -68,4 +71,23 @@ do done fi +if [[ "$MANIFEST" ]]; then +case "X$MANIFEST" in + X*.json) + if [ -f "${MANIFEST}" ]; then + jq --slurpfile m "${MANIFEST}" '$m.files | (.projectID|tostring) + " " + (.fileID|tostring)'| while read -r p f + do + url="${CURSE_URL_BASE}/${p}/files/${f}/download" + # Manifest usually doesn't have mod names. Using id should be fine, tho + curl -sSL -o /data/mods/${p}_${f}.jar + done + else + echo "Could not find manifest file, unsufficient privs, or malformed path." + fi + *) + echo "Invalid manifest file for modpack. Please make sure it is a .json file." + ;; +esac +fi + exec /start-finalSetup03Modconfig $@