1
0
mirror of https://github.com/parkervcp/eggs.git synced 2024-10-06 23:57:07 +02:00

Fix broken default save URL in installation script

This commit is contained in:
Red-Thirten 2022-01-12 16:26:01 -08:00
parent 003c1ae215
commit 08c55cfaed

View File

@ -21,7 +21,7 @@
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\r\n\r\n## File: Pterodactyl OpenRCT2 Egg - egg-openrct2.json\r\n## Authors: David Wolfe (Red-Thirten), parkervcp\r\n## Date: 2022\/01\/12\r\n## License: MIT License\r\n\r\nGITHUB_PACKAGE=\"OpenRCT2\/OpenRCT2\"\r\nMATCH=\"linux-bullseye-x86_64.tar.gz\"\r\nDEFAULT_SAVE=\"https:\/\/github.com\/parkervcp\/eggs\/blob\/master\/game_eggs\/tycoon_games\/openrct2\/save.park\"\r\n\r\n## OpenRCT2 Install\r\napt -y update\r\n[ ! -d \/mnt\/server ] && mkdir \/mnt\/server\r\ncd \/mnt\/server\r\n# Remove existing installation if present\r\n[ -d OpenRCT2 ] && rm -rf OpenRCT2\r\n\r\n# Determine if installing from source or from release\r\nif [ \"${VERSION}\" == \"develop\" ]; then\r\n # Get required packages\r\n apt -y install curl git make cmake gcc build-essential libicu-dev pkg-config libcurl4-openssl-dev libcrypto++-dev libpng-dev libssl-dev libzip-dev duktape-dev nlohmann-json3-dev\r\n echo -e \"\\nInstalling\/Updating OpenRCT2 from source...\\n\"\r\n # Setup temp directory for building and move to it\r\n [ -d temp ] && rm -rf temp\r\n mkdir temp && cd temp\r\n # Clone the branch and check if successful\r\n git clone --branch \"${VERSION}\" https:\/\/github.com\/${GITHUB_PACKAGE}\r\n if [ ! -d OpenRCT2 ]; then\r\n echo -e \"\\nFailed to clone \\\"${VERSION}\\\" branch from https:\/\/github.com\/${GITHUB_PACKAGE}\\n\"\r\n exit 1\r\n fi\r\n cd OpenRCT2\r\n mkdir build && cd build\r\n # Prepare CMake files for a lightweight and CLI-only build of OpenRCT2, using the appropriate flags\r\n cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DPORTABLE=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CXX_FLAGS=\"-g -gz\" -DDISABLE_TTF=ON -DDISABLE_GOOGLE_BENCHMARK=ON -DDISABLE_DISCORD_RPC=ON -DDISABLE_GUI=ON\r\n echo -e \"\\nBuilding OpenRCT2 package from source...\\n\\tThis process can take quite some time. Grab a coffee :)\\n\"\r\n # Build OpenRCT2\r\n DESTDIR=. make install\r\n # Check if build was successful and move to it\r\n if [ ! -d usr\/local ]; then\r\n echo -e \"\\nFailed to successfully build OpenRCT2!\\n\"\r\n exit 1\r\n fi\r\n cd usr\/local\r\n # Make executable-ready package by moving compiled files to the correct locations\r\n mkdir -p \/mnt\/server\/OpenRCT2\/data\r\n mv bin\/* \/mnt\/server\/OpenRCT2\/\r\n mv share\/openrct2\/* share\/openrct2-cli\/* \/mnt\/server\/OpenRCT2\/data\/\r\n mv share\/doc \/mnt\/server\/OpenRCT2\/\r\n cd \/mnt\/server\r\n rm -rf temp # Clean up temp building directory\r\n echo -e \"\\nBuild of OpenRCT2 package complete!\"\r\nelse\r\n # Get required packages\r\n apt install -y curl jq\r\n echo -e \"\\nInstalling\/Updating OpenRCT2 from release tag \\\"${VERSION}\\\"...\\n\"\r\n # 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 # Get release info and download links\r\n LATEST_JSON=$(curl --silent \"https:\/\/api.github.com\/repos\/${GITHUB_PACKAGE}\/releases\/latest\")\r\n RELEASES=$(curl --silent \"https:\/\/api.github.com\/repos\/${GITHUB_PACKAGE}\/releases\")\r\n\r\n if [ -z \"${VERSION}\" ] || [ \"${VERSION}\" == \"latest\" ]; then\r\n DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})\r\n else\r\n VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .tag_name')\r\n if [ \"${VERSION}\" == \"${VERSION_CHECK}\" ]; then\r\n DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})\r\n else\r\n DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)\r\n fi\r\n fi\r\n # Download and unpackage the release\r\n curl -L ${DOWNLOAD_URL} | tar -xzv\r\n # Check if it was successful\r\n if [ -d OpenRCT2 ]; then\r\n echo -e \"\\nDownload of OpenRCT2 release successful!\"\r\n else\r\n echo -e \"\\nFailed to download\/unpack file: ${DOWNLOAD_URL}\\n\"\r\n exit 1\r\n fi\r\nfi\r\n\r\n## OpenRCT2 Setup\r\n# Setup ServerData\/save directory\r\n[ ! -d ServerData\/save ] && mkdir -p ServerData\/save\r\ncd ServerData\/save\r\n# Download default save.park if missing\r\nif [ ! -f save.park ]; then\r\n echo -e \"Downloading default save.park file from ${DEFAULT_SAVE}\"\r\n curl -sSLO ${DEFAULT_SAVE}\r\nfi\r\n\r\necho -e \"\\nOpenRCT2 Successfully Installed!\"",
"script": "#!\/bin\/bash\r\n\r\n## File: Pterodactyl OpenRCT2 Egg - egg-openrct2.json\r\n## Authors: David Wolfe (Red-Thirten), parkervcp\r\n## Date: 2022\/01\/12\r\n## License: MIT License\r\n\r\nGITHUB_PACKAGE=\"OpenRCT2\/OpenRCT2\"\r\nMATCH=\"linux-bullseye-x86_64.tar.gz\"\r\nDEFAULT_SAVE=\"https:\/\/raw.githubusercontent.com\/parkervcp\/eggs\/master\/game_eggs\/tycoon_games\/openrct2\/save.park\"\r\n\r\n## OpenRCT2 Install\r\napt -y update\r\n[ ! -d \/mnt\/server ] && mkdir \/mnt\/server\r\ncd \/mnt\/server\r\n# Remove existing installation if present\r\n[ -d OpenRCT2 ] && rm -rf OpenRCT2\r\n\r\n# Determine if installing from source or from release\r\nif [ \"${VERSION}\" == \"develop\" ]; then\r\n # Get required packages\r\n apt -y install curl git make cmake gcc build-essential libicu-dev pkg-config libcurl4-openssl-dev libcrypto++-dev libpng-dev libssl-dev libzip-dev duktape-dev nlohmann-json3-dev\r\n echo -e \"\\nInstalling\/Updating OpenRCT2 from source...\\n\"\r\n # Setup temp directory for building and move to it\r\n [ -d temp ] && rm -rf temp\r\n mkdir temp && cd temp\r\n # Clone the branch and check if successful\r\n git clone --branch \"${VERSION}\" https:\/\/github.com\/${GITHUB_PACKAGE}\r\n if [ ! -d OpenRCT2 ]; then\r\n echo -e \"\\nFailed to clone \\\"${VERSION}\\\" branch from https:\/\/github.com\/${GITHUB_PACKAGE}\\n\"\r\n exit 1\r\n fi\r\n cd OpenRCT2\r\n mkdir build && cd build\r\n # Prepare CMake files for a lightweight and CLI-only build of OpenRCT2, using the appropriate flags\r\n cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DPORTABLE=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_CXX_FLAGS=\"-g -gz\" -DDISABLE_TTF=ON -DDISABLE_GOOGLE_BENCHMARK=ON -DDISABLE_DISCORD_RPC=ON -DDISABLE_GUI=ON\r\n echo -e \"\\nBuilding OpenRCT2 package from source...\\n\\tThis process can take quite some time. Grab a coffee :)\\n\"\r\n # Build OpenRCT2\r\n DESTDIR=. make install\r\n # Check if build was successful and move to it\r\n if [ ! -d usr\/local ]; then\r\n echo -e \"\\nFailed to successfully build OpenRCT2!\\n\"\r\n exit 1\r\n fi\r\n cd usr\/local\r\n # Make executable-ready package by moving compiled files to the correct locations\r\n mkdir -p \/mnt\/server\/OpenRCT2\/data\r\n mv bin\/* \/mnt\/server\/OpenRCT2\/\r\n mv share\/openrct2\/* share\/openrct2-cli\/* \/mnt\/server\/OpenRCT2\/data\/\r\n mv share\/doc \/mnt\/server\/OpenRCT2\/\r\n cd \/mnt\/server\r\n rm -rf temp # Clean up temp building directory\r\n echo -e \"\\nBuild of OpenRCT2 package complete!\"\r\nelse\r\n # Get required packages\r\n apt install -y curl jq\r\n echo -e \"\\nInstalling\/Updating OpenRCT2 from release tag \\\"${VERSION}\\\"...\\n\"\r\n # 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 # Get release info and download links\r\n LATEST_JSON=$(curl --silent \"https:\/\/api.github.com\/repos\/${GITHUB_PACKAGE}\/releases\/latest\")\r\n RELEASES=$(curl --silent \"https:\/\/api.github.com\/repos\/${GITHUB_PACKAGE}\/releases\")\r\n\r\n if [ -z \"${VERSION}\" ] || [ \"${VERSION}\" == \"latest\" ]; then\r\n DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i ${MATCH})\r\n else\r\n VERSION_CHECK=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .tag_name')\r\n if [ \"${VERSION}\" == \"${VERSION_CHECK}\" ]; then\r\n DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION \"${VERSION}\" '.[] | select(.tag_name==$VERSION) | .assets[].browser_download_url' | grep -i ${MATCH})\r\n else\r\n DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url)\r\n fi\r\n fi\r\n # Download and unpackage the release\r\n curl -L ${DOWNLOAD_URL} | tar -xzv\r\n # Check if it was successful\r\n if [ -d OpenRCT2 ]; then\r\n echo -e \"\\nDownload of OpenRCT2 release successful!\"\r\n else\r\n echo -e \"\\nFailed to download\/unpack file: ${DOWNLOAD_URL}\\n\"\r\n exit 1\r\n fi\r\nfi\r\n\r\n## OpenRCT2 Setup\r\n# Setup ServerData\/save directory\r\n[ ! -d ServerData\/save ] && mkdir -p ServerData\/save\r\ncd ServerData\/save\r\n# Download default save.park if missing\r\nif [ ! -f save.park ]; then\r\n echo -e \"Downloading default save.park file from ${DEFAULT_SAVE}\"\r\n curl -sSLO ${DEFAULT_SAVE}\r\nfi\r\n\r\necho -e \"\\nOpenRCT2 Successfully Installed!\"",
"container": "debian:bullseye-slim",
"entrypoint": "\/bin\/bash"
}