diff --git a/game_eggs/minecraft/java/forge/curseforge-generic/egg-curseforge-generic.json b/game_eggs/minecraft/java/forge/curseforge-generic/egg-curseforge-generic.json index 8cb53d17..66706ae4 100644 --- a/game_eggs/minecraft/java/forge/curseforge-generic/egg-curseforge-generic.json +++ b/game_eggs/minecraft/java/forge/curseforge-generic/egg-curseforge-generic.json @@ -4,7 +4,7 @@ "version": "PTDL_v1", "update_url": null }, - "exported_at": "2022-01-24T02:52:47+01:00", + "exported_at": "2022-06-10T15:03:34-04:00", "name": "Curseforge Generic", "author": "parker@parkervcp.com", "description": "A generic egg for a forge modpack", @@ -29,7 +29,7 @@ }, "scripts": { "installation": { - "script": "#!\/bin\/bash\r\n# Forge Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\nif [ ! -d \/mnt\/server ]; then\r\n mkdir -p \/mnt\/server\r\nfi\r\n\r\nfunction install_required {\r\n apt update\r\n apt install -y curl jq unzip dos2unix\r\n}\r\n\r\nfunction get_download {\r\n # get json data to work with\r\n echo -e \"Curling the json for the modpack\"\r\n echo -e \"running: curl -sSL https:\/\/addons-ecs.forgesvc.net\/api\/v2\/addon\/${MODPACK_ID}\"\r\n JSON_DATA=$(curl -sSL https:\/\/addons-ecs.forgesvc.net\/api\/v2\/addon\/${MODPACK_ID})\r\n\r\n # if no modpack version is set or is set to latest\r\n if [ -z ${MODPACK_VERSION} ] || [ \"${MODPACK_VERSION}\" = \"latest\" ]; then\r\n echo -e \"Getting latest download url\"\r\n # parse data to get the download url\r\n FILE_ID=$(echo -e ${JSON_DATA} | jq -r .defaultFileId)\r\n echo -e \"File ID is: ${FILE_ID}\"\r\n if [ \"$(echo -e ${JSON_DATA} | jq -r --arg FILE_ID \"$FILE_ID\" \".latestFiles[] | select(.id==$FILE_ID) | .isServerPack\")\" == \"false\" ] && [ \"$(echo -e ${JSON_DATA} | jq -r --arg FILE_ID \"$FILE_ID\" \".latestFiles[] | select(.id==$FILE_ID) | .serverPackFileId\")\" != \"null\" ]; then\r\n FILE_ID=$(echo -e ${JSON_DATA} | jq -r --arg FILE_ID \"$FILE_ID\" \".latestFiles[] | select(.id==$FILE_ID) | .serverPackFileId\")\r\n DOWNLOAD_URL=$(curl -sSL https:\/\/addons-ecs.forgesvc.net\/api\/v2\/addon\/${MODPACK_ID}\/file\/${FILE_ID}\/download-url)\r\n else\r\n DOWNLOAD_URL=$(curl -sSL https:\/\/addons-ecs.forgesvc.net\/api\/v2\/addon\/${MODPACK_ID}\/file\/${FILE_ID}\/download-url)\r\n fi\r\n echo -e \"Download url set to ${DOWNLOAD_URL}\"\r\n else\r\n echo -e \"Looking for download url for version ${MODPACK_VERSION}\"\r\n # parse files for version match\r\n FILES_JSON_DATA=$(curl -sSL https:\/\/addons-ecs.forgesvc.net\/api\/v2\/addon\/${MODPACK_ID}\/files)\r\n # get element number to get the exact location in the json\r\n FILES_JSON_ELEMENT=$(echo -e ${FILES_JSON_DATA} | jq --arg VERSION \"${MODPACK_VERSION}\" '.[] | select(.displayName) | .displayName | contains($VERSION)' | grep -n true | cut -f1 -d: | tail -1)\r\n # if there wasn't a match default to latest\r\n if [ ! -z ${FILES_JSON_ELEMENT} ]; then\r\n echo -e \"No matching version found\"\r\n echo -e \"defaulting to latest\"\r\n DOWNLOAD_URL=$(echo -e ${FILES_JSON_DATA} | jq --arg ELEMENT \"${FILES_JSON_ELEMENT}\" '.[$ELEMENT|tonumber-1] | .downloadUrl')\r\n else\r\n echo -e \"Version match found\"\r\n DOWNLOAD_URL=$(echo -e ${JSON_DATA} | jq -r .latestFiles[0].downloadUrl)\r\n echo -e \"Download url set to ${DOWNLOAD_URL}\"\r\n fi\r\n fi\r\n ## download modpack files\r\n cd \/mnt\/server\r\n echo \"Executing curl -L ${DOWNLOAD_URL} -o server.zip\"\r\n curl -L -g \"${DOWNLOAD_URL}\" -o server.zip\r\n unzip -o server.zip\r\n rm -rf server.zip\r\n}\r\n\r\nfunction forge_install {\r\n echo -e \"\\nInstalling forge server using the installer jar file.\\n\"\r\n if [ -f \/mnt\/server\/*installer.jar ]; then\r\n java -jar installer.jar --installServer || { echo -e \"install failed\"; exit 4; }\r\n else\r\n echo \"No forge installer found moving on.\"\r\n fi\r\n mv FTBServer.jar server.jar\r\n}\r\n\r\nfunction forge_cleanup {\r\n echo -e \"\\nDeleting installer jar file and cleaning up.\\n\"\r\n rm -rf *installer.jar\r\n if [ ! -f \/mnt\/server\/*universal.jar ]; then\r\n mv -v \/mnt\/server\/*\/* \/mnt\/server\/\r\n if [ ! -f \/mnt\/server\/*universal.jar ]; then\r\n mv forge*.jar server.jar\r\n else\r\n mv *universal.jar server.jar \r\n fi\r\n else\r\n mv *universal.jar server.jar\r\n fi\r\n}\r\n\r\nfunction json_download_prework {\r\n mkdir -p \/mnt\/server\/mods\r\n cd \/mnt\/server\/mods\r\n}\r\n\r\nfunction json_download_mods {\r\n MANIFEST=\/mnt\/server\/manifest.json\r\n for mod in $(jq -c '.files[]' ${MANIFEST} ); do\r\n projID=$(echo $mod | jq -r \".projectID\")\r\n fileID=$(echo $mod | jq -r \".fileID\")\r\n URL=$(curl -sSL https:\/\/addons-ecs.forgesvc.net\/api\/v2\/addon\/${projID}\/file\/${fileID}\/download-url)\r\n # this is saving everything as \/mnt\/server\/mods\/download\r\n echo \"Mod direct url: ${URL}\"\r\n curl -JLO \"${URL}\"\r\n done\r\n}\r\n\r\nfunction json_download_forge {\r\n cd \/mnt\/server\r\n FORGE=$(jq -r '.minecraft.modLoaders[0].id' \/mnt\/server\/manifest.json | cut -d '-' -f2)\r\n MCVER=$(jq -r '.minecraft.version' \/mnt\/server\/manifest.json)\r\n\tif [ ${MCVER} == \"1.7.10\" ] || [ ${MCVER} == \"1.8.9\" ]; then\r\n\t\tFORGE=\"${FORGE}-${MCVER}\"\r\n\tfi\r\n FORGE_VERSION=\"${MCVER}-${FORGE}\"\r\n FORGE_DOWNLOAD=https:\/\/maven.minecraftforge.net\/net\/minecraftforge\/forge\r\n \r\n echo -e \"\\nDownloading Forge Version $FORGE_VERSION\\n\"\r\n echo -e \"Download link is $FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION\"\r\n curl -sS $FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION-installer.jar -o installer.jar\r\n curl -sS $FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION-universal.jar -o universal.jar\r\n java -jar installer.jar --installServer || { echo -e \"install failed\"; exit 4; }\r\n mv *universal.jar server.jar\r\n rm installer.jar\r\n}\r\n\r\nfunction json_download_overrides {\r\n if [ -d \/mnt\/server\/overrides ]; then\r\n mv \/mnt\/server\/overrides\/mods\/* \/mnt\/server\/mods\/\r\n rmdir \/mnt\/server\/overrides\/mods\r\n mv \/mnt\/server\/overrides\/* \/mnt\/server\r\n rmdir \/mnt\/server\/overrides\r\n fi\r\n}\r\n\r\nfunction cfg_download_forge {\r\n dos2unix settings.cfg # In case the pack was distributed with Windows-style line endings in the cfg file\r\n MCVER=`grep 'MCVER' settings.cfg | sed 's\/;\/\/g' | cut -d '=' -f 2-`\r\n FORGE=`grep 'FORGEVER' settings.cfg | sed 's\/;\/\/g' | cut -d '=' -f 2-`\r\n\r\n\tif [ ${MCVER} == \"1.7.10\" ] || [ ${MCVER} == \"1.8.9\" ]; then\r\n\t\tFORGE=\"${FORGE}-${MCVER}\"\r\n\tfi\r\n \r\n FORGE_VERSION=\"${MCVER}-${FORGE}\"\r\n echo -e ${FORGE_VERSION}\r\n FORGE_DOWNLOAD=https:\/\/maven.minecraftforge.net\/net\/minecraftforge\/forge\r\n \r\n echo -e \"\\nDownloading Forge Version $FORGE_VERSION\\n\"\r\n echo -e \"Download link is $FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION\"\r\n curl -sS $FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION-installer.jar -o installer.jar\r\n curl -sS $FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION-universal.jar -o universal.jar\r\n java -jar installer.jar --installServer || { echo -e \"install failed\"; exit 4; }\r\n mv *universal.jar server.jar\r\n rm installer.jar\r\n}\r\n\r\nfunction ftb_install {\r\n chmod +x \/mnt\/server\/settings.sh \r\n . \/mnt\/server\/settings.sh \r\n curl https:\/\/s3.amazonaws.com\/Minecraft.Download\/versions\/${MCVER}\/minecraft_server.${MCVER}.jar -o ${JARFILE} \r\n curl https:\/\/libraries.minecraft.net\/${LAUNCHWRAPPER} -o \/mnt\/server\/libraries\/${LAUNCHWRAPPER}\r\n}\r\n\r\ninstall_required\r\nget_download\r\n\r\nif [ -f \/mnt\/server\/manifest.json ]; then\r\n json_download_prework\r\n json_download_mods\r\n json_download_overrides\r\n json_download_forge\r\nelif [ -f \/mnt\/server\/settings.cfg ]; then\r\n cfg_download_forge\r\nelif [ -f \/mnt\/server\/version.json ]; then\r\n if [ \"$(cat \/mnt\/server\/version.json | jq -r '.packID | contains(\"FTB\")')\" == \"true\" ]; then\r\n ftb_install\r\n fi\r\nelse\r\n forge_install\r\n forge_cleanup\r\nfi\r\necho -e \"\\n\\nInstall completed succesfully, enjoy!\"", + "script": "#!\/bin\/bash\r\n# Forge Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\nif [ ! -d \/mnt\/server ]; then\r\n mkdir -p \/mnt\/server\r\nfi\r\n\r\nfunction install_required {\r\n apt update\r\n apt install -y curl jq unzip dos2unix\r\n}\r\n\r\nfunction get_download {\r\n # get json data to work with\r\n echo -e \"Curling the json for the modpack\"\r\n echo -e \"running: curl -sSLX GET https:\/\/api.curseforge.com\/v1\/mods\/${MODPACK_ID} -H 'Accept: application\/json' -H 'x-api-key: API_KEY'\"\r\n JSON_DATA=$(curl -ssLX GET https:\/\/api.curseforge.com\/v1\/mods\/${MODPACK_ID} -H 'Accept: application\/json' -H \"x-api-key: ${API_KEY}\")\r\n\r\n # if no modpack version is set or is set to latest\r\n if [ -z ${MODPACK_VERSION} ] || [ \"${MODPACK_VERSION}\" = \"latest\" ]; then\r\n echo -e \"Getting latest download url\"\r\n # parse data to get the download url\r\n FILE_ID=$(echo -e ${JSON_DATA} | jq -r \".data.mainFileId\")\r\n echo -e \"File ID is: ${FILE_ID}\"\r\n if [ \"$(echo -e ${JSON_DATA} | jq -r --arg FILE_ID \"$FILE_ID\" \".data.latestFiles[] | select(.id==$FILE_ID) | .isServerPack\")\" == \"false\" ] && [ \"$(echo -e ${JSON_DATA} | jq -r --arg FILE_ID \"$FILE_ID\" \".data.latestFiles[] | select(.id==$FILE_ID) | .serverPackFileId\")\" != \"null\" ]; then\r\n FILE_ID=$(echo -e ${JSON_DATA} | jq -r --arg FILE_ID \"$FILE_ID\" \".data.latestFiles[] | select(.id==$FILE_ID) | .serverPackFileId\")\r\n DOWNLOAD_URL=$(curl -sSL -H 'Accept: application\/json' -H \"x-api-key: ${API_KEY}\" https:\/\/api.curseforge.com\/v1\/mods\/${MODPACK_ID}\/files\/${FILE_ID}\/download-url | jq -r \".data\")\r\n else\r\n DOWNLOAD_URL=$(curl -sSL -H 'Accept: application\/json' -H \"x-api-key: ${API_KEY}\" https:\/\/api.curseforge.com\/v1\/mods\/${MODPACK_ID}\/files\/${FILE_ID}\/download-url | jq -r \".data\")\r\n fi\r\n echo -e \"Download url set to ${DOWNLOAD_URL}\"\r\n else\r\n echo -e \"Looking for download url for version ${MODPACK_VERSION}\"\r\n # parse files for version match\r\n FILES_JSON_DATA=$(curl -sSL -H 'Accept: application\/json' -H \"x-api-key: ${API_KEY}\" https:\/\/api.curseforge.com\/v1\/mods\/${MODPACK_ID}\/files)\r\n # get element number to get the exact location in the json\r\n FILES_JSON_ELEMENT=$(echo -e ${FILES_JSON_DATA} | jq --arg VERSION \"${MODPACK_VERSION}\" '.[] | select(.displayName) | .displayName | contains($VERSION)' | grep -n true | cut -f1 -d: | tail -1)\r\n # if there wasn't a match default to latest\r\n if [ ! -z ${FILES_JSON_ELEMENT} ]; then\r\n echo -e \"No matching version found\"\r\n echo -e \"defaulting to latest\"\r\n DOWNLOAD_URL=$(echo -e ${FILES_JSON_DATA} | jq --arg ELEMENT \"${FILES_JSON_ELEMENT}\" '.[$ELEMENT|tonumber-1] | .downloadUrl')\r\n else\r\n echo -e \"Version match found\"\r\n DOWNLOAD_URL=$(echo -e ${JSON_DATA} | jq -r .latestFiles[0].downloadUrl)\r\n echo -e \"Download url set to ${DOWNLOAD_URL}\"\r\n fi\r\n fi\r\n ## download modpack files\r\n cd \/mnt\/server\r\n echo \"Executing curl -L ${DOWNLOAD_URL} -o server.zip\"\r\n curl -L -g \"${DOWNLOAD_URL}\" -o server.zip\r\n unzip -o server.zip\r\n rm -rf server.zip\r\n}\r\n\r\nfunction forge_install {\r\n echo -e \"\\nInstalling forge server using the installer jar file.\\n\"\r\n if [ -f \/mnt\/server\/*installer.jar ]; then\r\n java -jar installer.jar --installServer || { echo -e \"install failed\"; exit 4; }\r\n else\r\n echo \"No forge installer found moving on.\"\r\n fi\r\n mv FTBServer.jar server.jar\r\n}\r\n\r\nfunction forge_cleanup {\r\n echo -e \"\\nDeleting installer jar file and cleaning up.\\n\"\r\n rm -rf *installer.jar\r\n if [ ! -f \/mnt\/server\/*universal.jar ]; then\r\n mv -v \/mnt\/server\/*\/* \/mnt\/server\/\r\n if [ ! -f \/mnt\/server\/*universal.jar ]; then\r\n mv forge*.jar server.jar\r\n else\r\n mv *universal.jar server.jar \r\n fi\r\n else\r\n mv forge*universal.jar server.jar\r\n fi\r\n}\r\n\r\nfunction json_download_prework {\r\n mkdir -p \/mnt\/server\/mods\r\n cd \/mnt\/server\/mods\r\n}\r\n\r\nfunction json_download_mods {\r\n MANIFEST=\/mnt\/server\/manifest.json\r\n for mod in $(jq -c '.files[]' ${MANIFEST} ); do\r\n projID=$(echo $mod | jq -r \".projectID\")\r\n fileID=$(echo $mod | jq -r \".fileID\")\r\n URL=$(curl -sSL -H 'Accept: application\/json' -H \"x-api-key: ${API_KEY}\" https:\/\/api.curseforge.com\/v1\/mods\/${projID}\/files\/${fileID}\/download-url jq -r \".data\")\r\n # this is saving everything as \/mnt\/server\/mods\/download\r\n echo \"Mod direct url: ${URL}\"\r\n curl -JLO \"${URL}\"\r\n done\r\n}\r\n\r\nfunction json_download_forge {\r\n cd \/mnt\/server\r\n FORGE=$(jq -r '.minecraft.modLoaders[0].id' \/mnt\/server\/manifest.json | cut -d '-' -f2)\r\n MCVER=$(jq -r '.minecraft.version' \/mnt\/server\/manifest.json)\r\n\tif [ ${MCVER} == \"1.7.10\" ] || [ ${MCVER} == \"1.8.9\" ]; then\r\n\t\tFORGE=\"${FORGE}-${MCVER}\"\r\n\tfi\r\n FORGE_VERSION=\"${MCVER}-${FORGE}\"\r\n FORGE_DOWNLOAD=https:\/\/maven.minecraftforge.net\/net\/minecraftforge\/forge\r\n \r\n echo -e \"\\nDownloading Forge Version $FORGE_VERSION\\n\"\r\n echo -e \"Download link is $FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION\"\r\n curl -sS $FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION-installer.jar -o installer.jar\r\n curl -sS $FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION-universal.jar -o universal.jar\r\n java -jar installer.jar --installServer || { echo -e \"install failed\"; exit 4; }\r\n mv *universal.jar server.jar\r\n rm installer.jar\r\n}\r\n\r\nfunction json_download_overrides {\r\n if [ -d \/mnt\/server\/overrides ]; then\r\n mv \/mnt\/server\/overrides\/mods\/* \/mnt\/server\/mods\/\r\n rmdir \/mnt\/server\/overrides\/mods\r\n mv \/mnt\/server\/overrides\/* \/mnt\/server\r\n rmdir \/mnt\/server\/overrides\r\n fi\r\n}\r\n\r\nfunction cfg_download_forge {\r\n dos2unix settings.cfg # In case the pack was distributed with Windows-style line endings in the cfg file\r\n MCVER=`grep 'MCVER' settings.cfg | sed 's\/;\/\/g' | cut -d '=' -f 2-`\r\n FORGE=`grep 'FORGEVER' settings.cfg | sed 's\/;\/\/g' | cut -d '=' -f 2-`\r\n\r\n\tif [ ${MCVER} == \"1.7.10\" ] || [ ${MCVER} == \"1.8.9\" ]; then\r\n\t\tFORGE=\"${FORGE}-${MCVER}\"\r\n\tfi\r\n \r\n FORGE_VERSION=\"${MCVER}-${FORGE}\"\r\n echo -e ${FORGE_VERSION}\r\n FORGE_DOWNLOAD=https:\/\/maven.minecraftforge.net\/net\/minecraftforge\/forge\r\n PARSED_LINK=$(echo -e \"$FORGE_DOWNLOAD\/$FORGE_VERSION\/forge-$FORGE_VERSION\" | sed 's\/ \/\/g')\r\n\r\n echo -e \"\\nDownloading Forge Version $FORGE_VERSION\\n\"\r\n echo -e \"Download link is $PARSED_LINK\"\r\n curl -sSL $PARSED_LINK-installer.jar -o installer.jar\r\n curl -sSL $PARSED_LINK-universal.jar -o universal.jar\r\n java -jar installer.jar --installServer || { echo -e \"install failed\"; exit 4; }\r\n mv *universal.jar server.jar\r\n rm installer.jar\r\n}\r\n\r\nfunction ftb_install {\r\n chmod +x \/mnt\/server\/settings.sh \r\n . \/mnt\/server\/settings.sh \r\n curl https:\/\/s3.amazonaws.com\/Minecraft.Download\/versions\/${MCVER}\/minecraft_server.${MCVER}.jar -o ${JARFILE} \r\n curl https:\/\/libraries.minecraft.net\/${LAUNCHWRAPPER} -o \/mnt\/server\/libraries\/${LAUNCHWRAPPER}\r\n}\r\n\r\ninstall_required\r\nget_download\r\n\r\nif [ -f \/mnt\/server\/manifest.json ]; then\r\n json_download_prework\r\n json_download_mods\r\n json_download_overrides\r\n json_download_forge\r\nelif [ -f \/mnt\/server\/settings.cfg ]; then\r\n cfg_download_forge\r\nelif [ -f \/mnt\/server\/version.json ]; then\r\n if [ \"$(cat \/mnt\/server\/version.json | jq -r '.packID | contains(\"FTB\")')\" == \"true\" ]; then\r\n ftb_install\r\n fi\r\nelse\r\n forge_install\r\n forge_cleanup\r\nfi\r\n\r\necho -e \"\\n\\nInstall completed succesfully, enjoy!\"", "container": "openjdk:8-jdk-slim", "entrypoint": "bash" } @@ -52,6 +52,15 @@ "user_viewable": true, "user_editable": true, "rules": "required|string|max:20" + }, + { + "name": "API Key", + "description": "This is a new requirement and will be needed to pull mods packs\r\n\r\nYou need and account to generate an api-key here\r\nhttps:\/\/console.curseforge.com\/#\/api-keys", + "env_variable": "API_KEY", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "required|string" } ] } \ No newline at end of file