feat(minecraft/entrypoint): download manifests

This commit is contained in:
Jeremy White 2019-02-08 08:11:01 -05:00
parent a994e67ebf
commit 5d55ce2b25

View File

@ -1,5 +1,8 @@
#!/bin/bash #!/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 # Remove old mods/plugins
if [ "$REMOVE_OLD_MODS" = "TRUE" ]; then if [ "$REMOVE_OLD_MODS" = "TRUE" ]; then
if [ "$TYPE" = "SPIGOT" ]; then if [ "$TYPE" = "SPIGOT" ]; then
@ -68,4 +71,23 @@ do
done done
fi 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 $@ exec /start-finalSetup03Modconfig $@