From f637460aeac14082d7e750e51b669c6f8578c156 Mon Sep 17 00:00:00 2001 From: Michael Parker Date: Sun, 25 Aug 2019 00:23:17 -0400 Subject: [PATCH] update to use the forge version json This uses the forge version json to get the latest version information from forge directly. --- .../forge-generic/egg-forge-enhanced.json | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/minecraft_java/forge/forge-generic/egg-forge-enhanced.json b/minecraft_java/forge/forge-generic/egg-forge-enhanced.json index 3c47856e..06ce8b5c 100644 --- a/minecraft_java/forge/forge-generic/egg-forge-enhanced.json +++ b/minecraft_java/forge/forge-generic/egg-forge-enhanced.json @@ -3,7 +3,7 @@ "meta": { "version": "PTDL_v1" }, - "exported_at": "2019-07-12T16:29:11-04:00", + "exported_at": "2019-08-25T00:22:02-04:00", "name": "Forge Enhanced", "author": "parker@parkervcp.com", "description": "Minecraft Forge Server. Minecraft Forge is a modding API (Application Programming Interface), which makes it easier to create mods, and also make sure mods are compatible with each other.", @@ -17,8 +17,8 @@ }, "scripts": { "installation": { - "script": "#!\/bin\/bash\r\n# Forge Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update\r\napt install -y curl\r\n\r\n#Fetching version\r\nif [ -z \"${MC_VERSION}\" ] || [ \"${MC_VERSION}\" == \"latest\" ]; then\r\n echo \"Fetching latest\"\r\n FORGE_VERSION=$(curl -sl https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/index.html | grep -A 2 \"Latest\" | awk NF=NF RS= OFS=\" \" | grep -o -e '[1]\\.[0-9][0-9]\\?\\.\\?[0-9]\\?[0-9] - [0-9][0-9]\\.[0-9][0-9]\\.[0-9]\\?[0-9]\\.[0-9][0-9][0-9][0-9]' | sed 's\/ \/\/g')\r\nelif [[ ! \"${MC_VERSION}\" =~ - ]]; then\r\n echo \"Fetching latest from version $MC_VERSION\"\r\n FORGE_VERSION=$(curl -sl https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/index_${MC_VERSION}.html | grep -A 2 \"Latest\" | awk NF=NF RS= OFS=\" \" | grep -o -e '[1]\\.[0-9][0-9]\\?\\.\\?[0-9]\\?[0-9] - [0-9][0-9]\\.[0-9][0-9]\\.[0-9]\\?[0-9]\\.[0-9][0-9][0-9][0-9]' | sed 's\/ \/\/g')\r\nfi\r\n\r\nif [ -z ${MC_VERSION} ]; then\r\n echo -e \"\"\r\nelse\r\n if [ ${MC_VERSION} == \"1.7.10\" ] || [ ${MC_VERSION} == \"1.8.9\" ]; then\r\n echo -e \"correcting forge version to ${FORGE_VERSION}-${MC_VERSION}\"\r\n\t FORGE_VERSION=\"${FORGE_VERSION}-${MC_VERSION}\"\r\n fi\r\nfi\r\n\r\n#Checking if forge version valid\r\nif [[ ! \"$FORGE_VERSION\" =~ [0-9]?[0-9]?\\.[0-9]?[0-9]?\\.?[0-9]?[0-9]-[0-9]?[0-9]\\.[0-9]?[0-9]\\.[0-9]?[0-9]\\.[0-9]?[0-9]?[0-9]?[0-9] ]]; then\r\n echo \"!!! Invalid forge version \\\"$FORGE_VERSION\\\" !!!\"\r\n exit\r\nfi\r\n\r\n#Go into main direction\r\ncd \/mnt\/server\r\n\r\n#Adding .jar when not eding by SERVER_JARFILE\r\nif [[ ! $SERVER_JARFILE = *\\.jar ]]; then\r\n SERVER_JARFILE=\"$SERVER_JARFILE.jar\"\r\nfi\r\n\r\n#Downloading jars\r\necho -e \"Downloading forge version ${FORGE_VERSION}\"\r\ncurl -o installer.jar -sS https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/${FORGE_VERSION}\/forge-${FORGE_VERSION}-installer.jar\r\ncurl -o $SERVER_JARFILE -sS https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/${FORGE_VERSION}\/forge-${FORGE_VERSION}-universal.jar\r\n\r\n#Checking if downloaded jars exist\r\nif [ ! -f .\/installer.jar ] || [ ! -f .\/$SERVER_JARFILE ]; then\r\n echo \"!!! Error by downloading forge version ${FORGE_VERSION} !!!\"\r\n exit\r\nfi\r\n\r\n#Installing server\r\necho -e \"Installing forge server.\\n\"\r\njava -jar installer.jar --installServer\r\n\r\n#Deleting installer.jar\r\necho -e \"Deleting installer.jar file.\\n\"\r\nrm -rf installer.jar", - "container": "openjdk:8", + "script": "#!\/bin\/bash\r\n# Forge Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update\r\napt install -y curl jq\r\n\r\necho -e \"minecraft version: ${MC_VERSION}\"\r\necho -e \"build type: ${BUILD_TYPE}\"\r\n\r\nif [ \"$MC_VERSION\" == \"latest\" ]; then\r\n echo -e \"getting latest recommended version of forge.\"\r\n LATEST_RECOMMENDED=$(curl -s https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/promotions_slim.json | jq -r '.promos.recommended')\r\n MC_VERSION=$(curl -s https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/promotions_slim.json | jq --arg LATEST \"$LATEST_RECOMMENDED\" '.promos | to_entries[] | select(.value==$LATEST)' | jq -rs '.[0].key' | sed 's\/-recommended\/\/g')\r\n\tBUILD_TYPE=recommended\r\n\t\r\n\techo -e \"minecraft version: ${MC_VERSION}\"\r\n\techo -e \"build type: ${BUILD_TYPE}\"\r\nfi\r\n\r\n## some variables for getting versions and things\r\nFILE_SITE=$(curl -s https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/promotions_slim.json | jq -r '.homepage')\r\nVERSION_KEY=$(curl -s https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/promotions_slim.json | jq -r --arg MC_VERSION \"$MC_VERSION\" --arg BUILD_TYPE \"$BUILD_TYPE\" '.promos | to_entries[] | .key | select(contains($MC_VERSION)) | select(contains($BUILD_TYPE))')\r\n\r\n## locating the forge version\r\nif [ \"${VERSION_KEY}\" == \"\" ] && [ \"${BUILD_TYPE}\" == \"recommended\" ]; then\r\n echo -e \"dropping back to latest from recommended due to there not being a recommended version of forge for the mc version requested.\"\r\n VERSION_KEY=$(curl -s https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/promotions_slim.json | jq -r --arg MC_VERSION \"$MC_VERSION\" '.promos | to_entries[] | .key | select(contains($MC_VERSION)) | select(contains(\"latest\"))')\r\nfi\r\n\r\n## Error if the mc version set wasn't valid.\r\nif [ \"${VERSION_KEY}\" == \"\" ]; then\r\n\techo -e \"The install failed because there is no valid version of forge for the version on minecraft selected.\"\r\n\texit 1\r\nfi\r\n\r\nFORGE_VERSION=$(curl -s https:\/\/files.minecraftforge.net\/maven\/net\/minecraftforge\/forge\/promotions_slim.json | jq -r --arg VERSION_KEY \"$VERSION_KEY\" '.promos | .[$VERSION_KEY]')\r\n\r\nif [ \"$MC_VERSION\" == \"1.7.10\" ] || [ \"$MC_VERSION\" == \"1.8.9\" ]; then\r\n DOWNLOAD_LINK=${FILE_SITE}${MC_VERSION}-${FORGE_VERSION}-${MC_VERSION}\/forge-${MC_VERSION}-${FORGE_VERSION}-${MC_VERSION}\r\nelse\r\n DOWNLOAD_LINK=${FILE_SITE}${MC_VERSION}-${FORGE_VERSION}\/forge-${MC_VERSION}-${FORGE_VERSION}\r\nfi\r\n\r\n#Go into main direction\r\ncd \/mnt\/server\r\n\r\n#Adding .jar when not eding by SERVER_JARFILE\r\nif [[ ! $SERVER_JARFILE = *\\.jar ]]; then\r\n SERVER_JARFILE=\"$SERVER_JARFILE.jar\"\r\nfi\r\n\r\n#Downloading jars\r\necho -e \"Downloading forge version ${FORGE_VERSION}\"\r\ncurl -s -o installer.jar -sS ${DOWNLOAD_LINK}-installer.jar\r\ncurl -s -o $SERVER_JARFILE -sS ${DOWNLOAD_LINK}-universal.jar\r\n\r\n#Checking if downloaded jars exist\r\nif [ ! -f .\/installer.jar ] || [ ! -f .\/$SERVER_JARFILE ]; then\r\n echo \"!!! Error by downloading forge version ${FORGE_VERSION} !!!\"\r\n exit\r\nfi\r\n\r\n#Installing server\r\necho -e \"Installing forge server.\\n\"\r\njava -jar installer.jar --installServer\r\n\r\n#Deleting installer.jar\r\necho -e \"Deleting installer.jar file.\\n\"\r\nrm -rf installer.jar", + "container": "openjdk:8-jdk-slim", "entrypoint": "bash" } }, @@ -34,12 +34,21 @@ }, { "name": "Forge version", - "description": "The version of forge that you want to run.\r\nExamples:\r\n- 1.12.2\r\n- 1.12.2-14.23.5.2810", + "description": "The version of minecraft you want to install for.\r\n\r\nLeaving latest will install the latest recommended version.", "env_variable": "MC_VERSION", "default_value": "latest", "user_viewable": 1, "user_editable": 1, - "rules": "required|string|max:22" + "rules": "required|string|max:9" + }, + { + "name": "Build Type", + "description": "The type of server jar to download from forge.\r\n\r\nValid types are \"recommended\" and \"latest\".", + "env_variable": "BUILD_TYPE", + "default_value": "recommended", + "user_viewable": 1, + "user_editable": 1, + "rules": "required|string|max:20" } ] } \ No newline at end of file