fix install script.

This commit is contained in:
Michael Parker 2020-03-28 14:55:04 -04:00
parent 2b9fa70add
commit 41b32d72be

View File

@ -3,7 +3,7 @@
"meta": {
"version": "PTDL_v1"
},
"exported_at": "2020-03-08T22:56:37-04:00",
"exported_at": "2020-03-28T14:53:55-04:00",
"name": "Magma",
"author": "support@pterodactyl.io",
"description": "Magma is most powerful Forge server providing you with Forge mods and Bukkit Plugins using Spigot and Paper for Performance Optimization and Stability.",
@ -17,7 +17,7 @@
},
"scripts": {
"installation": {
"script": "## this is a simple script to use the github API for release versions.\r\n## this requires the egg has a variable for GITHUB_PACKAGE, VERSION and MATCH (match is to match the filename in some way)\r\n## this supports using oauth\/personal access tokens via GITHUB_USER and GITHUB_OAUTH_TOKEN (both are required.)\r\n## if you are getting hit with GitHub API limit issues then you need to have the user and token set.\r\n\r\napk add --no-cache curl\r\n\r\n## get latest download link\r\necho -e \"Set to download the ${BUILD} build\"\r\nif [ ${BUILD} == \"dev\" ]; then\r\n echo -e \"dev tag is ${tag}\"\r\nfi\r\n\r\ncase EXPRES${BUILD}SION in\r\n\r\n \"recommended\" | \"stable\" | \"latest\")\r\n DOWNLOAD_URL=$(https:\/\/api.magmafoundation.org\/api\/resources\/magma\/${VANILLA_VERSION}\/stable\/latest\/download)\r\n ;;\r\n\r\n \"dev\")\r\n DOWNLOAD_URL=$(https:\/\/api.magmafoundation.org\/api\/resources\/magma\/${VANILLA_VERSION}\/dev\/${TAG}\/download)\r\n ;;\r\n\r\n *)\r\n DOWNLOAD_URL=$(https:\/\/api.magmafoundation.org\/api\/resources\/magma\/${VANILLA_VERSION}\/stable\/latest\/download)\r\n ;;\r\nesac\r\n\r\n## validate download link\r\nif [ ! -z \"${DOWNLOAD_URL}\"] ; then \r\n if curl --output \/dev\/null --silent --head --fail ${DOWNLOAD_URL}; then\r\n echo -e \"link is valid. setting download link to ${DOWNLOAD_URL}\"\r\n DOWNLOAD_LINK=${DOWNLOAD_URL}\r\n else \r\n echo -e \"link is invalid closing out\"\r\n exit 2\r\n fi\r\nfi\r\n\r\n# Adding '.jar' if it isn't part of the file name\r\nif [[ ! ${SERVER_JARFILE} = *\\.jar ]]; then\r\n SERVER_JARFILE=\"${SERVER_JARFILE}.jar\"\r\nfi\r\n\r\n## mv old server files\r\nif [ -f ${SERVER_JARFILE} ]; then\r\n mv ${SERVER_JARFILE} ${SERVER_JARFILE}.old\r\nfi\r\n\r\n## download files\r\necho -e \"running: curl -sSL -o ${SERVER_JARFILE} ${DOWNLOAD_LINK}\"\r\ncurl -sSL -o ${SERVER_JARFILE} ${DOWNLOAD_LINK}\r\n\r\necho -e \"Install Complete\"",
"script": "## this is a simple script to use the github API for release versions.\r\n## this requires the egg has a variable for GITHUB_PACKAGE, VERSION and MATCH (match is to match the filename in some way)\r\n## this supports using oauth\/personal access tokens via GITHUB_USER and GITHUB_OAUTH_TOKEN (both are required.)\r\n## if you are getting hit with GitHub API limit issues then you need to have the user and token set.\r\n\r\napk add --no-cache curl\r\n\r\nif [ ! -d \/mnt\/server\/ ]; then\r\n mkdir \/mnt\/server\r\nfi\r\n\r\ncd \/mnt\/server\/\r\n\r\n## get latest download link\r\necho -e \"Set to download the ${BUILD} build\"\r\nif [ \"${BUILD}\" == \"dev\" ]; then\r\n echo -e \"dev tag is ${tag}\"\r\nfi\r\n\r\ncase ${BUILD} in\r\n\r\n \"recommended\" | \"stable\" | \"latest\")\r\n DOWNLOAD_URL=\"https:\/\/api.magmafoundation.org\/api\/resources\/magma\/${VANILLA_VERSION}\/stable\/latest\/download\"\r\n ;;\r\n\r\n \"dev\")\r\n DOWNLOAD_URL=\"https:\/\/api.magmafoundation.org\/api\/resources\/magma\/${VANILLA_VERSION}\/dev\/${TAG}\/download\"\r\n ;;\r\n\r\n *)\r\n DOWNLOAD_URL=\"https:\/\/api.magmafoundation.org\/api\/resources\/magma\/${VANILLA_VERSION}\/stable\/latest\/download\"\r\n ;;\r\nesac\r\n\r\necho -e \"Download URL is ${DOWNLOAD_URL}\"\r\n\r\n## validate download link\r\nif [ ! -z \"${DOWNLOAD_URL}\" ] ; then \r\n if curl --output \/dev\/null --silent --head --fail ${DOWNLOAD_URL}; then\r\n echo -e \"link is valid. setting download link to ${DOWNLOAD_URL}\"\r\n DOWNLOAD_LINK=${DOWNLOAD_URL}\r\n else \r\n echo -e \"link is invalid closing out\"\r\n exit 2\r\n fi\r\nfi\r\n\r\n# Adding '.jar' if it isn't part of the file name\r\nif [[ ${SERVER_JARFILE} == *\\.jar ]]; then\r\n echo -e \"adding.jar to server file name\"\r\n SERVER_JARFILE=\"${SERVER_JARFILE}.jar\"\r\nfi\r\n\r\n## mv old server files\r\nif [ -f ${SERVER_JARFILE} ]; then\r\n echo -e \"moving old server.jar\"\r\n mv ${SERVER_JARFILE} ${SERVER_JARFILE}.old\r\nfi\r\n\r\n## download files\r\necho -e \"running: curl -sSL -o ${SERVER_JARFILE} ${DOWNLOAD_LINK}\"\r\ncurl -sSL -o ${SERVER_JARFILE} ${DOWNLOAD_LINK}\r\n\r\necho -e \"Install Complete\"",
"container": "alpine:3.10",
"entrypoint": "ash"
}