From 2e233179e6b71f9d1a048a144d9e92ca48a7c236 Mon Sep 17 00:00:00 2001 From: David Katz Date: Fri, 5 May 2023 19:06:27 -0700 Subject: [PATCH 1/6] Add new and improved CurseForge generic egg --- game_eggs/minecraft/java/curseforge/README.md | 23 +++++++ .../curseforge/egg-curse-forge-generic.json | 69 +++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 game_eggs/minecraft/java/curseforge/README.md create mode 100644 game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json diff --git a/game_eggs/minecraft/java/curseforge/README.md b/game_eggs/minecraft/java/curseforge/README.md new file mode 100644 index 00000000..d74cba0f --- /dev/null +++ b/game_eggs/minecraft/java/curseforge/README.md @@ -0,0 +1,23 @@ +# CurseForge Generic + +## This is a generic egg for CurseForge modpacks + +You will need to give it a modpack project ID. The project ID for [All the Mods 8 - ATM8](https://www.curseforge.com/minecraft/modpacks/all-the-mods-8) is `520914` for example. +This can be found on the modpack page in the `About Project` section in the right sidebar. + +You can also optionally specify a file ID. If you do not specify a file ID, the latest version will be used. +The file ID for the server pack for [All the Mods 8 - ATM8](https://www.curseforge.com/minecraft/modpacks/all-the-mods-8) version `1.0.17` is `4504876` for example. +This can be found on the modpack page by clicking the wanted file and copying the id at the end of the URL (the number after `/files/`). + +The script will automatically setup of Forge, Fabric, or Quilt depending on the modpack. + +You *must* specify a CurseForge API key. +You can find out how to get an API key [here](https://support.curseforge.com/en/support/solutions/articles/9000208346-about-the-curseforge-api-and-how-to-apply-for-a-key) + +## Server Ports + +The minecraft server requires a single port for access (default 25565) but plugins may require extra ports to enabled for the server. + +| Port | default | +|-------|---------| +| Game | 25565 | \ No newline at end of file diff --git a/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json b/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json new file mode 100644 index 00000000..05b1b87b --- /dev/null +++ b/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json @@ -0,0 +1,69 @@ +{ + "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", + "meta": { + "version": "PTDL_v2", + "update_url": null + }, + "exported_at": "2023-05-05T19:03:39-07:00", + "name": "CurseForge Generic", + "author": "contact@chromozone.dev", + "description": "A generic egg for a CurseForge modpack.", + "features": [ + "eula", + "java_version", + "pid_limit" + ], + "docker_images": { + "Java 8": "ghcr.io\/pterodactyl\/yolks:java_8", + "Java 11": "ghcr.io\/pterodactyl\/yolks:java_11", + "Java 16": "ghcr.io\/pterodactyl\/yolks:java_16", + "Java 17": "ghcr.io\/pterodactyl\/yolks:java_17" + }, + "file_denylist": [], + "startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -Dterminal.jline=false -Dterminal.ansi=true $([[ ! -f unix_args.txt ]] && printf %s \"-jar `cat .serverjar`\" || printf %s \"@unix_args.txt\")", + "config": { + "files": "{\r\n \"server.properties\": {\r\n \"parser\": \"properties\",\r\n \"find\": {\r\n \"server-ip\": \"0.0.0.0\",\r\n \"server-port\": \"{{server.build.default.port}}\",\r\n \"query.port\": \"{{server.build.default.port}}\"\r\n }\r\n }\r\n}", + "startup": "{\r\n \"done\": \")! For help, type \"\r\n}", + "logs": "{}", + "stop": "stop" + }, + "scripts": { + "installation": { + "script": "#!\/bin\/bash\r\n# shellcheck disable=SC2155\r\n#\r\n# CurseForge Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\n\r\n: \"${SERVER_DIR:=\/mnt\/server}\"\r\n: \"${PROJECT_ID:=}\"\r\n: \"${VERSION_ID:=}\"\r\n: \"${API_KEY:=}\"\r\n\r\nif [[ ! -d $SERVER_DIR ]]; then\r\n mkdir -p \"$SERVER_DIR\"\r\nfi\r\n\r\nif ! cd \"$SERVER_DIR\"; then\r\n echo -e \"Failed to change directory to ${SERVER_DIR}\"\r\n exit 1\r\nfi\r\n\r\nfunction install_required {\r\n echo -e \"Installing required packages...\"\r\n echo -e \"\\tRunning apt update\"\r\n apt update > \/dev\/null 2>&1 || { echo \"apt update failed!\"; exit 1; }\r\n echo -e \"\\tRunning apt install\"\r\n apt install -y wget jq unzip > \/dev\/null 2>&1 || { echo \"apt install failed!\"; exit 1; }\r\n}\r\n\r\nCURSEFORGE_API_URL=\"https:\/\/api.curseforge.com\/v1\/mods\/\"\r\nCURSEFORGE_API_HEADERS=(\"--header=Accept: application\/json\" \"--header=x-api-key: ${API_KEY}\")\r\n\r\nfunction get_download {\r\n echo -e \"Retrieving CurseForge project information...\"\r\n local PROJECT_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\" -O -)\r\n local PROJECT_TITLE=$(echo \"$PROJECT_DATA\" | jq -r '.data.name \/\/ empty')\r\n\r\n if [[ -z \"${PROJECT_DATA}\" ]]; then\r\n echo -e \"\\tERROR: Failed to retrieve project data for project id '${PROJECT_ID}'\"\r\n exit 1\r\n fi\r\n\r\n local IS_SERVER_PACK=false\r\n\r\n if [[ -z \"${VERSION_ID}\" || \"${VERSION_ID}\" == \"latest\" ]]; then\r\n echo -e \"\\tNo version ID specified, using latest version\"\r\n VERSION_ID=$(echo \"$PROJECT_DATA\" | jq -r '.data.mainFileId \/\/ empty')\r\n\r\n local VERSION_SERVER_PACK=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .isServerPack')\"\r\n local VERSION_SERVER_ID=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .serverPackFileId')\"\r\n\r\n if [[ \"${VERSION_SERVER_PACK}\" == \"false\" && -n \"${VERSION_SERVER_ID}\" ]]; then\r\n echo -e \"\\tFound server pack version id '${VERSION_SERVER_ID}'\"\r\n VERSION_ID=$VERSION_SERVER_ID\r\n IS_SERVER_PACK=true\r\n elif [[ \"${VERSION_SERVER_PACK}\" == \"true\" ]]; then\r\n IS_SERVER_PACK=true\r\n fi\r\n else\r\n echo -e \"\\tChecking if provided version id '${VERSION_ID}' exists\"\r\n\r\n local VERSION_SERVER_PACK=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[]? | select(.serverPackFileId|tostring==$VERSION_ID) | .serverPackFileId')\"\r\n local VERSION_SERVER_ID;\r\n if [[ -n \"${VERSION_SERVER_PACK}\" ]]; then\r\n VERSION_ID=$VERSION_SERVER_PACK\r\n IS_SERVER_PACK=true\r\n elif [[ $(echo \"$PROJECT_DATA\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[]? | select(.id|tostring == $VERSION_ID) | .id') == \"${VERSION_ID}\" ]]; then\r\n VERSION_SERVER_PACK=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .isServerPack')\"\r\n VERSION_SERVER_ID=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .serverPackFileId')\"\r\n\r\n if [[ \"${VERSION_SERVER_PACK}\" == \"false\" && -n \"${VERSION_SERVER_ID}\" ]]; then\r\n echo -e \"\\tFound server pack version id '${VERSION_SERVER_ID}'\"\r\n VERSION_ID=$VERSION_SERVER_ID\r\n IS_SERVER_PACK=true\r\n elif [[ \"${VERSION_SERVER_PACK}\" == \"true\" ]]; then\r\n IS_SERVER_PACK=true\r\n fi\r\n else\r\n echo -e \"\\tERROR: Version id '${VERSION_ID}' not found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n fi\r\n\r\n # Check if version id is unset or empty string\r\n if [[ -z \"${VERSION_ID}\" ]]; then\r\n echo -e \"\\tERROR: No version id found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n\r\n if [[ \"${IS_SERVER_PACK}\" == \"false\" ]]; then\r\n echo -e \"\\tWARNING: Version id '${VERSION_ID}' is not a server pack, attempting to use client files\"\r\n fi\r\n\r\n # get json data to work with\r\n echo -e \"\\tRetrieving version information for '${VERSION_ID}'\"\r\n local JSON_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\/files\/${VERSION_ID}\/download-url\" -O -)\r\n\r\n if [[ -z \"${JSON_DATA}\" ]]; then\r\n echo -e \"\\tERROR: Failed to retrieve version data for version id '${VERSION_ID}'\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tParsing CurseForge pack download url\"\r\n\r\n local DOWNLOAD_URL=$(echo -e \"$JSON_DATA\" | jq -r '.data \/\/ empty')\r\n if [[ -z \"${DOWNLOAD_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for version ${VERSION_ID}\"\r\n exit 1\r\n fi\r\n\r\n # download modpack files\r\n echo -e \"\\tDownloading ${DOWNLOAD_URL}\"\r\n if ! wget -q \"${DOWNLOAD_URL}\" -O server.zip; then\r\n echo -e \"Download failed!\"\r\n exit 1\r\n fi\r\n}\r\n\r\nfunction get_loader {\r\n echo -e \"Retrieving loader information...\"\r\n\r\n local PROJECT_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\" -O -)\r\n if [[ -z \"${PROJECT_DATA}\" ]]; then\r\n echo -e \"\\tERROR: Failed to retrieve project data for project id '${PROJECT_ID}'\"\r\n exit 1\r\n fi\r\n\r\n local CLIENT_VERSION_ID;\r\n if [[ $(echo \"$PROJECT_DATA\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[]? | select(.id|tostring == $VERSION_ID) | .id') != \"${VERSION_ID}\" ]]; then\r\n # Check if the provided version id is a server pack\r\n VERSION_CLIENT_PACK=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[]? | select(.serverPackFileId|tostring==$VERSION_ID) | .id')\"\r\n\r\n if [[ -n \"${VERSION_CLIENT_PACK}\" ]]; then\r\n CLIENT_VERSION_ID=$VERSION_CLIENT_PACK\r\n else\r\n echo -e \"\\tERROR: Version id '${VERSION_ID}' not found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n else\r\n CLIENT_VERSION_ID=$VERSION_ID\r\n fi\r\n\r\n echo -e \"\\tRetrieving version information for '${CLIENT_VERSION_ID}'\"\r\n local JSON_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\/files\/${CLIENT_VERSION_ID}\/download-url\" -O -)\r\n\r\n echo -e \"\\tParsing CurseForge pack download url\"\r\n\r\n local DOWNLOAD_URL=$(echo -e \"$JSON_DATA\" | jq -r '.data \/\/ empty')\r\n\r\n if [[ -z \"${DOWNLOAD_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for version ${CLIENT_VERSION_ID}\"\r\n exit 1\r\n fi\r\n\r\n # download modpack files\r\n echo -e \"\\tDownloading ${DOWNLOAD_URL}\"\r\n wget -q \"${DOWNLOAD_URL}\" -O client.zip\r\n\r\n echo -e \"\\tUnpacking client manifest\"\r\n unzip -jo client.zip manifest.json -d \"${SERVER_DIR}\"\r\n mv \"${SERVER_DIR}\/manifest.json\" \"${SERVER_DIR}\/client.manifest.json\" # rename to avoid conflicts with main manifest\r\n rm -rf client.zip\r\n\r\n echo -e \"\\tParsing client manifest\"\r\n local MANIFEST=\"${SERVER_DIR}\/client.manifest.json\"\r\n\r\n LOADER_ID=$(jq -r '.minecraft.modLoaders[]? | select(.primary == true) | .id' \"${MANIFEST}\")\r\n LOADER_NAME=$(echo \"${LOADER_ID}\" | cut -d'-' -f1)\r\n LOADER_VERSION=$(echo \"${LOADER_ID}\" | cut -d'-' -f2)\r\n\r\n if [[ -z \"${LOADER_NAME}\" || -z \"${LOADER_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No loader found in client manifest!\"\r\n exit 1\r\n fi\r\n\r\n MINECRAFT_VERSION=$(jq -r '.minecraft.version \/\/ empty' \"${MANIFEST}\")\r\n\r\n if [[ -z \"${MINECRAFT_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No minecraft version found in client manifest!\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tFound loader ${LOADER_NAME} ${LOADER_VERSION} for Minecraft ${MINECRAFT_VERSION}\"\r\n}\r\n\r\nfunction unzip-strip() (\r\n set -u\r\n\r\n local archive=$1\r\n local destdir=${2:-}\r\n shift; shift || :\r\n echo -e \"\\tUnpacking ${archive} to ${destdir}\"\r\n\r\n echo -e \"\\tCreating temporary directory\"\r\n local tmpdir=\/mnt\/server\/tmp\r\n if ! mkdir -p \"${tmpdir}\"; then\r\n echo -e \"\\tERROR: mkdir failed to create temporary directory\"\r\n return 1\r\n fi\r\n\r\n trap 'rm -rf -- \"$tmpdir\"' EXIT\r\n\r\n echo -e \"\\tUnpacking archive\"\r\n\r\n if ! unzip -q \"$archive\" -d \"$tmpdir\"; then\r\n echo -e \"\\tERROR: unzip failed to unpack archive\"\r\n return 1\r\n fi\r\n\r\n echo -e \"\\tSetting glob settings\"\r\n\r\n shopt -s dotglob\r\n\r\n echo -e \"\\tCleaning up directory structure\"\r\n\r\n local files=(\"$tmpdir\"\/*) name i=1\r\n\r\n if (( ${#files[@]} == 1 )) && [[ -d \"${files[0]}\" ]]; then\r\n name=$(basename \"${files[0]}\")\r\n files=(\"$tmpdir\"\/*\/*)\r\n else\r\n name=$(basename \"$archive\"); name=${archive%.*}\r\n files=(\"$tmpdir\"\/*)\r\n fi\r\n\r\n if [[ -z \"$destdir\" ]]; then\r\n destdir=.\/\"$name\"\r\n fi\r\n\r\n while [[ -f \"$destdir\" ]]; do\r\n destdir=${destdir}-$((i++));\r\n done\r\n\r\n echo -e \"\\tCopying files to ${destdir}\"\r\n\r\n mkdir -p \"$destdir\"\r\n cp -ar \"$@\" -t \"$destdir\" -- \"${files[@]}\"\r\n rm -rf \"$tmpdir\"\r\n)\r\n\r\nfunction unpack_zip {\r\n echo -e \"Unpacking server files...\"\r\n unzip-strip server.zip \"${SERVER_DIR}\"\r\n rm -rf server.zip\r\n}\r\n\r\nfunction json_download_mods {\r\n echo \"Downloading mods...\"\r\n\r\n local MANIFEST=\"${SERVER_DIR}\/manifest.json\"\r\n jq -c '.files[]? | select(.required == true) | {project: .projectID, file: .fileID}' \"${MANIFEST}\" | while read -r mod; do\r\n local MOD_PROJECT_ID=$(echo \"${mod}\" | jq -r '.project \/\/ empty')\r\n local MOD_FILE_ID=$(echo \"${mod}\" | jq -r '.file \/\/ empty')\r\n\r\n if [[ -z \"${MOD_PROJECT_ID}\" || -z \"${MOD_FILE_ID}\" ]]; then\r\n echo -e \"\\tERROR: Failed to parse project id or file id for mod '${mod}'\"\r\n exit 1\r\n fi\r\n\r\n local FILE_URL=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${MOD_PROJECT_ID}\/files\/${MOD_FILE_ID}\/download-url\" -O - | jq -r '.data \/\/ empty')\r\n\r\n if [[ -z \"${FILE_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for mod ${MOD_PROJECT_ID} ${MOD_FILE_ID}\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tDownloading ${FILE_URL}\"\r\n\r\n if ! wget -q \"${FILE_URL}\" -P \"${SERVER_DIR}\/mods\"; then\r\n echo -e \"\\tERROR: Failed to download mod ${MOD_PROJECT_ID} ${MOD_FILE_ID}\"\r\n exit 1\r\n fi\r\n done\r\n}\r\n\r\nfunction json_download_overrides {\r\n echo \"Copying overrides...\"\r\n if [[ -d \"${SERVER_DIR}\/overrides\" ]]; then\r\n cp -r \"${SERVER_DIR}\/overrides\/\"* \"${SERVER_DIR}\"\r\n rm -r \"${SERVER_DIR}\/overrides\"\r\n fi\r\n}\r\n\r\nFORGE_INSTALLER_URL=\"https:\/\/maven.minecraftforge.net\/net\/minecraftforge\/forge\/\"\r\n\r\nfunction json_download_forge {\r\n echo \"Downloading Forge...\"\r\n\r\n local MC_VERSION=$MINECRAFT_VERSION\r\n local FORGE_VERSION=$LOADER_VERSION\r\n\r\n FORGE_VERSION=\"${MC_VERSION}-${FORGE_VERSION}\"\r\n if [[ \"${MC_VERSION}\" == \"1.7.10\" || \"${MC_VERSION}\" == \"1.8.9\" ]]; then\r\n FORGE_VERSION=\"${FORGE_VERSION}-${MC_VERSION}\"\r\n fi\r\n\r\n local FORGE_JAR=\"forge-${FORGE_VERSION}.jar\"\r\n if [[ \"${MC_VERSION}\" == \"1.7.10\" ]]; then\r\n FORGE_JAR=\"forge-${FORGE_VERSION}-universal.jar\"\r\n fi\r\n\r\n local FORGE_URL=\"${FORGE_INSTALLER_URL}${FORGE_VERSION}\/forge-${FORGE_VERSION}\"\r\n\r\n echo -e \"\\tUsing Forge ${FORGE_VERSION} from ${FORGE_URL}\"\r\n\r\n local FORGE_INSTALLER=\"${FORGE_URL}-installer.jar\"\r\n echo -e \"\\tDownloading Forge Installer ${FORGE_VERSION} from ${FORGE_INSTALLER}\"\r\n\r\n if ! wget -q -O forge-installer.jar \"${FORGE_INSTALLER}\"; then\r\n echo -e \"\\tERROR: Failed to download Forge Installer ${FORGE_VERSION}\"\r\n exit 1\r\n fi\r\n\r\n # Remove old Forge files so we can safely update\r\n rm -rf libraries\/net\/minecraftforge\/forge\/\r\n rm -f unix_args.txt\r\n\r\n echo -e \"\\tInstalling Forge Server ${FORGE_VERSION}\"\r\n if ! java -jar forge-installer.jar --installServer > \/dev\/null 2>&1; then\r\n echo -e \"\\tERROR: Failed to install Forge Server ${FORGE_VERSION}\"\r\n exit 1\r\n fi\r\n\r\n if [[ $MC_VERSION =~ ^1\\.(17|18|19|20|21|22|23) || $FORGE_VERSION =~ ^1\\.(17|18|19|20|21|22|23) ]]; then\r\n echo -e \"\\tDetected Forge 1.17 or newer version. Setting up Forge Unix arguments\"\r\n ln -sf libraries\/net\/minecraftforge\/forge\/*\/unix_args.txt unix_args.txt\r\n else\r\n mv \"$FORGE_JAR\" forge-server-launch.jar\r\n echo \"forge-server-launch.jar\" > \".serverjar\"\r\n fi\r\n\r\n rm -f forge-installer.jar\r\n}\r\n\r\nFABRIC_INSTALLER_URL=\"https:\/\/meta.fabricmc.net\/v2\/versions\/installer\"\r\n\r\nfunction json_download_fabric {\r\n echo \"Downloading Fabric...\"\r\n\r\n local MC_VERSION=$MINECRAFT_VERSION\r\n local FABRIC_VERSION=$LOADER_VERSION\r\n\r\n local INSTALLER_JSON=$(wget -q -O - ${FABRIC_INSTALLER_URL} )\r\n local INSTALLER_VERSION=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].version \/\/ empty')\r\n local INSTALLER_URL=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].url \/\/ empty')\r\n\r\n if [[ -z \"${INSTALLER_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No Fabric installer version found\"\r\n exit 1\r\n fi\r\n\r\n if [[ -z \"${INSTALLER_URL}\" ]]; then\r\n echo -e \"\\tERROR: No Fabric installer url found\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tDownloading Fabric Installer ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION}) from ${INSTALLER_URL}\"\r\n\r\n if ! wget -q -O fabric-installer.jar \"${INSTALLER_URL}\"; then\r\n echo -e \"\\tERROR: Failed to download Fabric Installer ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tInstalling Fabric Server ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION})\"\r\n if ! java -jar fabric-installer.jar server -mcversion \"${MC_VERSION}\" -loader \"${FABRIC_VERSION}\" -downloadMinecraft; then\r\n echo -e \"\\tERROR: Failed to install Fabric Server ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo \"fabric-server-launch.jar\" > \".serverjar\"\r\n\r\n rm -f fabric-installer.jar\r\n}\r\n\r\nQUILT_INSTALLER_URL=\"https:\/\/meta.quiltmc.org\/v3\/versions\/installer\"\r\n\r\nfunction json_download_quilt {\r\n echo \"Downloading Quilt...\"\r\n\r\n local MC_VERSION=$MINECRAFT_VERSION\r\n local QUILT_VERSION=$LOADER_VERSION\r\n\r\n local INSTALLER_JSON=$(wget -q -O - ${QUILT_INSTALLER_URL} )\r\n local INSTALLER_VERSION=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].version \/\/ empty')\r\n local INSTALLER_URL=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].url \/\/ empty')\r\n\r\n if [[ -z \"${INSTALLER_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No Quilt installer version found\"\r\n exit 1\r\n fi\r\n\r\n if [[ -z \"${INSTALLER_URL}\" ]]; then\r\n echo -e \"\\tERROR: No Quilt installer URL found\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tDownloading Quilt Installer ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION}) from ${INSTALLER_URL}\"\r\n\r\n if ! wget -q -O quilt-installer.jar \"${INSTALLER_URL}\"; then\r\n echo -e \"\\tERROR: Failed to download Quilt Installer ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tInstalling Quilt Server ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION})\"\r\n if ! java -jar quilt-installer.jar install server \"${MC_VERSION}\" \"${QUILT_VERSION}\" --download-server --install-dir=.\/; then\r\n echo -e \"\\tERROR: Failed to install Quilt Server ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo \"quilt-server-launch.jar\" > \".serverjar\"\r\n\r\n rm quilt-installer.jar\r\n}\r\n\r\ninstall_required\r\n\r\nif [[ -z \"${PROJECT_ID}\" ]]; then\r\n echo \"ERROR: You must specify a PROJECT_ID environment variable!\"\r\n exit 1\r\nfi\r\n\r\nif [[ ! \"${PROJECT_ID}\" = \"zip\" ]]; then\r\n\tget_download\r\nfi\r\n\r\nget_loader\r\nunpack_zip\r\n\r\nif [[ -f \"${SERVER_DIR}\/manifest.json\" ]]; then\r\n echo \"Found manifest.json, installing mods\"\r\n json_download_mods\r\n json_download_overrides\r\nfi\r\n\r\nif [[ -f \"${SERVER_DIR}\/client.manifest.json\" ]]; then\r\n MANIFEST=\"${SERVER_DIR}\/client.manifest.json\"\r\n\r\n if [[ $LOADER_NAME == \"forge\" ]]; then\r\n json_download_forge\r\n fi\r\n\r\n if [[ $LOADER_NAME == \"fabric\" ]]; then\r\n json_download_fabric\r\n fi\r\n\r\n if [[ $LOADER_NAME == \"quilt\" ]]; then\r\n json_download_quilt\r\n fi\r\nfi\r\n\r\necho -e \"\\nInstall completed succesfully, enjoy!\"", + "container": "openjdk:8-jdk-slim", + "entrypoint": "bash" + } + }, + "variables": [ + { + "name": "Modpack Project ID", + "description": "The modpack project ID from the CurseForge site on the pack page, or 'zip' if installing from an uploaded server.zip file.\r\n\r\nFor example, the project Id of https:\/\/www.curseforge.com\/minecraft\/modpacks\/bofa-mods ID is 375152", + "env_variable": "PROJECT_ID", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "required|numeric", + "field_type": "text" + }, + { + "name": "Modpack File ID", + "description": "The file ID belonging to a specific version of a modpack. Can either be the main file or the file ID associated with the server pack.\r\n\r\nIf not provided the script will attempt to retrieve the latest server pack or client pack available.", + "env_variable": "VERSION_ID", + "default_value": "latest", + "user_viewable": true, + "user_editable": true, + "rules": "numeric", + "field_type": "text" + }, + { + "name": "CurseForge API Key", + "description": "A CurseForge API key is required to use this egg. You can learn how to get an API key here: https:\/\/support.curseforge.com\/en\/support\/solutions\/articles\/9000208346-about-the-curseforge-api-and-how-to-apply-for-a-key", + "env_variable": "API_KEY", + "default_value": "", + "user_viewable": true, + "user_editable": true, + "rules": "required|string|max:60", + "field_type": "text" + } + ] +} \ No newline at end of file From 9458128cf80e4723f572010cca0444430619916e Mon Sep 17 00:00:00 2001 From: David Katz Date: Fri, 5 May 2023 19:10:36 -0700 Subject: [PATCH 2/6] Update CurseForge in READMEs and remove old egg --- README.md | 1 + game_eggs/README.md | 1 + game_eggs/minecraft/README.md | 2 +- .../java/forge/curseforge-generic/README.md | 24 ------- .../egg-curseforge-generic.json | 69 ------------------- 5 files changed, 3 insertions(+), 94 deletions(-) delete mode 100644 game_eggs/minecraft/java/forge/curseforge-generic/README.md delete mode 100644 game_eggs/minecraft/java/forge/curseforge-generic/egg-curseforge-generic.json diff --git a/README.md b/README.md index 2b07e1aa..544354ec 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,7 @@ If you are reading this it looks like you are looking to add an egg to your serv * [PocketMine MP](game_eggs/minecraft/bedrock/pocketmine_mp) * [Java](game_eggs/minecraft/java) Servers for Java Minecraft + * [CurseForge](game_eggs/minecraft/java/curseforge) * [Cuberite](game_eggs/minecraft/java/cuberite) * [Fabric](game_eggs/minecraft/java/fabric) * [Feather](game_eggs/minecraft/java/feather) diff --git a/game_eggs/README.md b/game_eggs/README.md index f1a566b2..005058fd 100644 --- a/game_eggs/README.md +++ b/game_eggs/README.md @@ -58,6 +58,7 @@ * [PocketMine MP](minecraft/bedrock/pocketmine_mp) * [Java](minecraft/java) Servers for Java Minecraft + * [CurseForge](minecraft/java/curseforge) * [Cuberite](minecraft/java/cuberite) * [Fabric](minecraft/java/fabric) * [Feather](minecraft/java/feather) diff --git a/game_eggs/minecraft/README.md b/game_eggs/minecraft/README.md index d4661d98..3c7b68a2 100644 --- a/game_eggs/minecraft/README.md +++ b/game_eggs/minecraft/README.md @@ -15,11 +15,11 @@ It’s set in infinitely-generated worlds of wide open terrain - icy mountains, ## [Java](java) Servers for Java Minecraft * [Cuberite](java/cuberite) +* [CurseForge](java/curseforge) * [Fabric](java/fabric) * [Feather](java/feather) * [Forge](java/forge) * [Forge](java/forge/forge) - * [CurseForge Generic](java/forge/curseforge-generic) * [Feed The Beast](java/ftb) * [Glowstone](java/glowstone) * [Limbo](java/limbo) diff --git a/game_eggs/minecraft/java/forge/curseforge-generic/README.md b/game_eggs/minecraft/java/forge/curseforge-generic/README.md deleted file mode 100644 index 6dbb3c44..00000000 --- a/game_eggs/minecraft/java/forge/curseforge-generic/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# Forge Generic - -## This is a generic egg for curseforge modpacks - -You will need to give it a modpack ID. The ID for BOFA mods is `375152` for example. -This can be found on the modpack page in the `About Project` section in the upper right corner. - -This will grab the latest release when the version is set to latest. - -It "should" grab versions of the pack based on the modpack version numbers - -## API Keys - -You will need to get an API key to run the installer now. Make an account at https://console.curseforge.com/ - -https://console.curseforge.com/#/api-keys - -## Server Ports - -The minecraft server requires a single port for access (default 25565) but plugins may require extra ports to enabled for the server. - -| Port | default | -|-------|---------| -| Game | 25565 | 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 deleted file mode 100644 index f64e51eb..00000000 --- a/game_eggs/minecraft/java/forge/curseforge-generic/egg-curseforge-generic.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", - "meta": { - "version": "PTDL_v2", - "update_url": null - }, - "exported_at": "2022-10-18T22:00:46+02:00", - "name": "Curseforge Generic", - "author": "parker@parkervcp.com", - "description": "A generic egg for a forge modpack", - "features": [ - "eula", - "java_version", - "pid_limit" - ], - "docker_images": { - "Java 8": "ghcr.io\/pterodactyl\/yolks:java_8", - "Java 11": "ghcr.io\/pterodactyl\/yolks:java_11", - "Java 16": "ghcr.io\/pterodactyl\/yolks:java_16", - "Java 17": "ghcr.io\/pterodactyl\/yolks:java_17" - }, - "file_denylist": [], - "startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar server.jar", - "config": { - "files": "{\r\n \"server.properties\": {\r\n \"parser\": \"properties\",\r\n \"find\": {\r\n \"server-ip\": \"0.0.0.0\",\r\n \"server-port\": \"{{server.build.default.port}}\"\r\n }\r\n }\r\n}", - "startup": "{\r\n \"done\": \")! For help, type \"\r\n}", - "logs": "{}", - "stop": "stop" - }, - "scripts": { - "installation": { - "script": "#!\/bin\/bash\r\n# Forge Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\n\r\nmkdir -p \/mnt\/server\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 unpack_zip {\r\n cd \/mnt\/server\r\n unzip -o 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\t\tmv *installer.jar installer.jar\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\/forge*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 forge*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\nif [ ! -z ${MODPACK_ID} ] && [ ! \"${MODPACK_ID}\" = \"zip\" ]; then\r\n\tget_download\r\n\tunpack_zip\r\n rm -rf server.zip\r\nelse\r\n\tunpack_zip\r\nfi\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" - } - }, - "variables": [ - { - "name": "Modpack Project ID", - "description": "The modpack project ID from the curseforge site on the pack page.\r\nOr 'zip' if installing from an uploaded server.zip file.\r\n(Ex. https:\/\/www.curseforge.com\/minecraft\/modpacks\/bofa-mods ID is 375152)", - "env_variable": "MODPACK_ID", - "default_value": "", - "user_viewable": true, - "user_editable": true, - "rules": "required|string", - "field_type": "text" - }, - { - "name": "Modpack Version", - "description": "Version of the modpack to use.", - "env_variable": "MODPACK_VERSION", - "default_value": "latest", - "user_viewable": true, - "user_editable": true, - "rules": "required|string|max:20", - "field_type": "text" - }, - { - "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", - "field_type": "text" - } - ] -} From 3de410cdffb599b0c80fb23e4e881295b5d32e6e Mon Sep 17 00:00:00 2001 From: David Katz Date: Fri, 5 May 2023 19:10:51 -0700 Subject: [PATCH 3/6] Update minecraft/java README --- game_eggs/minecraft/java/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/game_eggs/minecraft/java/README.md b/game_eggs/minecraft/java/README.md index 2990a645..91e0aca3 100644 --- a/game_eggs/minecraft/java/README.md +++ b/game_eggs/minecraft/java/README.md @@ -32,7 +32,7 @@ This is a direct fork of the default forge service - Has a version detection fix for "latest" -### [CurseForge Generic](forge/curseforge-generic) +### [CurseForge Generic](curseforge) [CurseForge Generic Website](https://www.curseforge.com) A generic service to pull forge mod packs from the curseforge site. From 785adcd16ef608f82274dfcd6aa331806ce4caf6 Mon Sep 17 00:00:00 2001 From: David Katz Date: Fri, 5 May 2023 19:35:11 -0700 Subject: [PATCH 4/6] PROJECT_ID / VERSION_ID strings for convenience --- .../minecraft/java/curseforge/egg-curse-forge-generic.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json b/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json index 05b1b87b..e9726824 100644 --- a/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json +++ b/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json @@ -4,7 +4,7 @@ "version": "PTDL_v2", "update_url": null }, - "exported_at": "2023-05-05T19:03:39-07:00", + "exported_at": "2023-05-05T19:34:12-07:00", "name": "CurseForge Generic", "author": "contact@chromozone.dev", "description": "A generic egg for a CurseForge modpack.", @@ -42,7 +42,7 @@ "default_value": "", "user_viewable": true, "user_editable": true, - "rules": "required|numeric", + "rules": "required|string", "field_type": "text" }, { @@ -52,7 +52,7 @@ "default_value": "latest", "user_viewable": true, "user_editable": true, - "rules": "numeric", + "rules": "string", "field_type": "text" }, { From dfda23bcf8d88e372c157434929e9efe87f52d47 Mon Sep 17 00:00:00 2001 From: David Katz Date: Sat, 6 May 2023 12:15:13 -0700 Subject: [PATCH 5/6] Use '@user_jvm_args.txt' if available --- .../minecraft/java/curseforge/egg-curse-forge-generic.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json b/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json index e9726824..22cb0625 100644 --- a/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json +++ b/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json @@ -4,7 +4,7 @@ "version": "PTDL_v2", "update_url": null }, - "exported_at": "2023-05-05T19:34:12-07:00", + "exported_at": "2023-05-06T12:13:41-07:00", "name": "CurseForge Generic", "author": "contact@chromozone.dev", "description": "A generic egg for a CurseForge modpack.", @@ -20,7 +20,7 @@ "Java 17": "ghcr.io\/pterodactyl\/yolks:java_17" }, "file_denylist": [], - "startup": "java -Xms128M -Xmx{{SERVER_MEMORY}}M -Dterminal.jline=false -Dterminal.ansi=true $([[ ! -f unix_args.txt ]] && printf %s \"-jar `cat .serverjar`\" || printf %s \"@unix_args.txt\")", + "startup": "java $([[ -f user_jvm_args.txt ]] && printf %s \"@user_jvm_args.txt\") -Xms128M -Xmx{{SERVER_MEMORY}}M -Dterminal.jline=false -Dterminal.ansi=true $([[ ! -f unix_args.txt ]] && printf %s \"-jar `cat .serverjar`\" || printf %s \"@unix_args.txt\")", "config": { "files": "{\r\n \"server.properties\": {\r\n \"parser\": \"properties\",\r\n \"find\": {\r\n \"server-ip\": \"0.0.0.0\",\r\n \"server-port\": \"{{server.build.default.port}}\",\r\n \"query.port\": \"{{server.build.default.port}}\"\r\n }\r\n }\r\n}", "startup": "{\r\n \"done\": \")! For help, type \"\r\n}", From 516ee4778d279e107b65814d25c5c2ec38621c22 Mon Sep 17 00:00:00 2001 From: David Katz Date: Sat, 6 May 2023 14:06:30 -0700 Subject: [PATCH 6/6] Improve file detection when looking up older pack versions --- .../minecraft/java/curseforge/egg-curse-forge-generic.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json b/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json index 22cb0625..85d44a74 100644 --- a/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json +++ b/game_eggs/minecraft/java/curseforge/egg-curse-forge-generic.json @@ -4,7 +4,7 @@ "version": "PTDL_v2", "update_url": null }, - "exported_at": "2023-05-06T12:13:41-07:00", + "exported_at": "2023-05-06T14:04:53-07:00", "name": "CurseForge Generic", "author": "contact@chromozone.dev", "description": "A generic egg for a CurseForge modpack.", @@ -29,7 +29,7 @@ }, "scripts": { "installation": { - "script": "#!\/bin\/bash\r\n# shellcheck disable=SC2155\r\n#\r\n# CurseForge Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\n\r\n: \"${SERVER_DIR:=\/mnt\/server}\"\r\n: \"${PROJECT_ID:=}\"\r\n: \"${VERSION_ID:=}\"\r\n: \"${API_KEY:=}\"\r\n\r\nif [[ ! -d $SERVER_DIR ]]; then\r\n mkdir -p \"$SERVER_DIR\"\r\nfi\r\n\r\nif ! cd \"$SERVER_DIR\"; then\r\n echo -e \"Failed to change directory to ${SERVER_DIR}\"\r\n exit 1\r\nfi\r\n\r\nfunction install_required {\r\n echo -e \"Installing required packages...\"\r\n echo -e \"\\tRunning apt update\"\r\n apt update > \/dev\/null 2>&1 || { echo \"apt update failed!\"; exit 1; }\r\n echo -e \"\\tRunning apt install\"\r\n apt install -y wget jq unzip > \/dev\/null 2>&1 || { echo \"apt install failed!\"; exit 1; }\r\n}\r\n\r\nCURSEFORGE_API_URL=\"https:\/\/api.curseforge.com\/v1\/mods\/\"\r\nCURSEFORGE_API_HEADERS=(\"--header=Accept: application\/json\" \"--header=x-api-key: ${API_KEY}\")\r\n\r\nfunction get_download {\r\n echo -e \"Retrieving CurseForge project information...\"\r\n local PROJECT_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\" -O -)\r\n local PROJECT_TITLE=$(echo \"$PROJECT_DATA\" | jq -r '.data.name \/\/ empty')\r\n\r\n if [[ -z \"${PROJECT_DATA}\" ]]; then\r\n echo -e \"\\tERROR: Failed to retrieve project data for project id '${PROJECT_ID}'\"\r\n exit 1\r\n fi\r\n\r\n local IS_SERVER_PACK=false\r\n\r\n if [[ -z \"${VERSION_ID}\" || \"${VERSION_ID}\" == \"latest\" ]]; then\r\n echo -e \"\\tNo version ID specified, using latest version\"\r\n VERSION_ID=$(echo \"$PROJECT_DATA\" | jq -r '.data.mainFileId \/\/ empty')\r\n\r\n local VERSION_SERVER_PACK=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .isServerPack')\"\r\n local VERSION_SERVER_ID=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .serverPackFileId')\"\r\n\r\n if [[ \"${VERSION_SERVER_PACK}\" == \"false\" && -n \"${VERSION_SERVER_ID}\" ]]; then\r\n echo -e \"\\tFound server pack version id '${VERSION_SERVER_ID}'\"\r\n VERSION_ID=$VERSION_SERVER_ID\r\n IS_SERVER_PACK=true\r\n elif [[ \"${VERSION_SERVER_PACK}\" == \"true\" ]]; then\r\n IS_SERVER_PACK=true\r\n fi\r\n else\r\n echo -e \"\\tChecking if provided version id '${VERSION_ID}' exists\"\r\n\r\n local VERSION_SERVER_PACK=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[]? | select(.serverPackFileId|tostring==$VERSION_ID) | .serverPackFileId')\"\r\n local VERSION_SERVER_ID;\r\n if [[ -n \"${VERSION_SERVER_PACK}\" ]]; then\r\n VERSION_ID=$VERSION_SERVER_PACK\r\n IS_SERVER_PACK=true\r\n elif [[ $(echo \"$PROJECT_DATA\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[]? | select(.id|tostring == $VERSION_ID) | .id') == \"${VERSION_ID}\" ]]; then\r\n VERSION_SERVER_PACK=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .isServerPack')\"\r\n VERSION_SERVER_ID=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .serverPackFileId')\"\r\n\r\n if [[ \"${VERSION_SERVER_PACK}\" == \"false\" && -n \"${VERSION_SERVER_ID}\" ]]; then\r\n echo -e \"\\tFound server pack version id '${VERSION_SERVER_ID}'\"\r\n VERSION_ID=$VERSION_SERVER_ID\r\n IS_SERVER_PACK=true\r\n elif [[ \"${VERSION_SERVER_PACK}\" == \"true\" ]]; then\r\n IS_SERVER_PACK=true\r\n fi\r\n else\r\n echo -e \"\\tERROR: Version id '${VERSION_ID}' not found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n fi\r\n\r\n # Check if version id is unset or empty string\r\n if [[ -z \"${VERSION_ID}\" ]]; then\r\n echo -e \"\\tERROR: No version id found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n\r\n if [[ \"${IS_SERVER_PACK}\" == \"false\" ]]; then\r\n echo -e \"\\tWARNING: Version id '${VERSION_ID}' is not a server pack, attempting to use client files\"\r\n fi\r\n\r\n # get json data to work with\r\n echo -e \"\\tRetrieving version information for '${VERSION_ID}'\"\r\n local JSON_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\/files\/${VERSION_ID}\/download-url\" -O -)\r\n\r\n if [[ -z \"${JSON_DATA}\" ]]; then\r\n echo -e \"\\tERROR: Failed to retrieve version data for version id '${VERSION_ID}'\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tParsing CurseForge pack download url\"\r\n\r\n local DOWNLOAD_URL=$(echo -e \"$JSON_DATA\" | jq -r '.data \/\/ empty')\r\n if [[ -z \"${DOWNLOAD_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for version ${VERSION_ID}\"\r\n exit 1\r\n fi\r\n\r\n # download modpack files\r\n echo -e \"\\tDownloading ${DOWNLOAD_URL}\"\r\n if ! wget -q \"${DOWNLOAD_URL}\" -O server.zip; then\r\n echo -e \"Download failed!\"\r\n exit 1\r\n fi\r\n}\r\n\r\nfunction get_loader {\r\n echo -e \"Retrieving loader information...\"\r\n\r\n local PROJECT_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\" -O -)\r\n if [[ -z \"${PROJECT_DATA}\" ]]; then\r\n echo -e \"\\tERROR: Failed to retrieve project data for project id '${PROJECT_ID}'\"\r\n exit 1\r\n fi\r\n\r\n local CLIENT_VERSION_ID;\r\n if [[ $(echo \"$PROJECT_DATA\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[]? | select(.id|tostring == $VERSION_ID) | .id') != \"${VERSION_ID}\" ]]; then\r\n # Check if the provided version id is a server pack\r\n VERSION_CLIENT_PACK=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[]? | select(.serverPackFileId|tostring==$VERSION_ID) | .id')\"\r\n\r\n if [[ -n \"${VERSION_CLIENT_PACK}\" ]]; then\r\n CLIENT_VERSION_ID=$VERSION_CLIENT_PACK\r\n else\r\n echo -e \"\\tERROR: Version id '${VERSION_ID}' not found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n else\r\n CLIENT_VERSION_ID=$VERSION_ID\r\n fi\r\n\r\n echo -e \"\\tRetrieving version information for '${CLIENT_VERSION_ID}'\"\r\n local JSON_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\/files\/${CLIENT_VERSION_ID}\/download-url\" -O -)\r\n\r\n echo -e \"\\tParsing CurseForge pack download url\"\r\n\r\n local DOWNLOAD_URL=$(echo -e \"$JSON_DATA\" | jq -r '.data \/\/ empty')\r\n\r\n if [[ -z \"${DOWNLOAD_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for version ${CLIENT_VERSION_ID}\"\r\n exit 1\r\n fi\r\n\r\n # download modpack files\r\n echo -e \"\\tDownloading ${DOWNLOAD_URL}\"\r\n wget -q \"${DOWNLOAD_URL}\" -O client.zip\r\n\r\n echo -e \"\\tUnpacking client manifest\"\r\n unzip -jo client.zip manifest.json -d \"${SERVER_DIR}\"\r\n mv \"${SERVER_DIR}\/manifest.json\" \"${SERVER_DIR}\/client.manifest.json\" # rename to avoid conflicts with main manifest\r\n rm -rf client.zip\r\n\r\n echo -e \"\\tParsing client manifest\"\r\n local MANIFEST=\"${SERVER_DIR}\/client.manifest.json\"\r\n\r\n LOADER_ID=$(jq -r '.minecraft.modLoaders[]? | select(.primary == true) | .id' \"${MANIFEST}\")\r\n LOADER_NAME=$(echo \"${LOADER_ID}\" | cut -d'-' -f1)\r\n LOADER_VERSION=$(echo \"${LOADER_ID}\" | cut -d'-' -f2)\r\n\r\n if [[ -z \"${LOADER_NAME}\" || -z \"${LOADER_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No loader found in client manifest!\"\r\n exit 1\r\n fi\r\n\r\n MINECRAFT_VERSION=$(jq -r '.minecraft.version \/\/ empty' \"${MANIFEST}\")\r\n\r\n if [[ -z \"${MINECRAFT_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No minecraft version found in client manifest!\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tFound loader ${LOADER_NAME} ${LOADER_VERSION} for Minecraft ${MINECRAFT_VERSION}\"\r\n}\r\n\r\nfunction unzip-strip() (\r\n set -u\r\n\r\n local archive=$1\r\n local destdir=${2:-}\r\n shift; shift || :\r\n echo -e \"\\tUnpacking ${archive} to ${destdir}\"\r\n\r\n echo -e \"\\tCreating temporary directory\"\r\n local tmpdir=\/mnt\/server\/tmp\r\n if ! mkdir -p \"${tmpdir}\"; then\r\n echo -e \"\\tERROR: mkdir failed to create temporary directory\"\r\n return 1\r\n fi\r\n\r\n trap 'rm -rf -- \"$tmpdir\"' EXIT\r\n\r\n echo -e \"\\tUnpacking archive\"\r\n\r\n if ! unzip -q \"$archive\" -d \"$tmpdir\"; then\r\n echo -e \"\\tERROR: unzip failed to unpack archive\"\r\n return 1\r\n fi\r\n\r\n echo -e \"\\tSetting glob settings\"\r\n\r\n shopt -s dotglob\r\n\r\n echo -e \"\\tCleaning up directory structure\"\r\n\r\n local files=(\"$tmpdir\"\/*) name i=1\r\n\r\n if (( ${#files[@]} == 1 )) && [[ -d \"${files[0]}\" ]]; then\r\n name=$(basename \"${files[0]}\")\r\n files=(\"$tmpdir\"\/*\/*)\r\n else\r\n name=$(basename \"$archive\"); name=${archive%.*}\r\n files=(\"$tmpdir\"\/*)\r\n fi\r\n\r\n if [[ -z \"$destdir\" ]]; then\r\n destdir=.\/\"$name\"\r\n fi\r\n\r\n while [[ -f \"$destdir\" ]]; do\r\n destdir=${destdir}-$((i++));\r\n done\r\n\r\n echo -e \"\\tCopying files to ${destdir}\"\r\n\r\n mkdir -p \"$destdir\"\r\n cp -ar \"$@\" -t \"$destdir\" -- \"${files[@]}\"\r\n rm -rf \"$tmpdir\"\r\n)\r\n\r\nfunction unpack_zip {\r\n echo -e \"Unpacking server files...\"\r\n unzip-strip server.zip \"${SERVER_DIR}\"\r\n rm -rf server.zip\r\n}\r\n\r\nfunction json_download_mods {\r\n echo \"Downloading mods...\"\r\n\r\n local MANIFEST=\"${SERVER_DIR}\/manifest.json\"\r\n jq -c '.files[]? | select(.required == true) | {project: .projectID, file: .fileID}' \"${MANIFEST}\" | while read -r mod; do\r\n local MOD_PROJECT_ID=$(echo \"${mod}\" | jq -r '.project \/\/ empty')\r\n local MOD_FILE_ID=$(echo \"${mod}\" | jq -r '.file \/\/ empty')\r\n\r\n if [[ -z \"${MOD_PROJECT_ID}\" || -z \"${MOD_FILE_ID}\" ]]; then\r\n echo -e \"\\tERROR: Failed to parse project id or file id for mod '${mod}'\"\r\n exit 1\r\n fi\r\n\r\n local FILE_URL=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${MOD_PROJECT_ID}\/files\/${MOD_FILE_ID}\/download-url\" -O - | jq -r '.data \/\/ empty')\r\n\r\n if [[ -z \"${FILE_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for mod ${MOD_PROJECT_ID} ${MOD_FILE_ID}\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tDownloading ${FILE_URL}\"\r\n\r\n if ! wget -q \"${FILE_URL}\" -P \"${SERVER_DIR}\/mods\"; then\r\n echo -e \"\\tERROR: Failed to download mod ${MOD_PROJECT_ID} ${MOD_FILE_ID}\"\r\n exit 1\r\n fi\r\n done\r\n}\r\n\r\nfunction json_download_overrides {\r\n echo \"Copying overrides...\"\r\n if [[ -d \"${SERVER_DIR}\/overrides\" ]]; then\r\n cp -r \"${SERVER_DIR}\/overrides\/\"* \"${SERVER_DIR}\"\r\n rm -r \"${SERVER_DIR}\/overrides\"\r\n fi\r\n}\r\n\r\nFORGE_INSTALLER_URL=\"https:\/\/maven.minecraftforge.net\/net\/minecraftforge\/forge\/\"\r\n\r\nfunction json_download_forge {\r\n echo \"Downloading Forge...\"\r\n\r\n local MC_VERSION=$MINECRAFT_VERSION\r\n local FORGE_VERSION=$LOADER_VERSION\r\n\r\n FORGE_VERSION=\"${MC_VERSION}-${FORGE_VERSION}\"\r\n if [[ \"${MC_VERSION}\" == \"1.7.10\" || \"${MC_VERSION}\" == \"1.8.9\" ]]; then\r\n FORGE_VERSION=\"${FORGE_VERSION}-${MC_VERSION}\"\r\n fi\r\n\r\n local FORGE_JAR=\"forge-${FORGE_VERSION}.jar\"\r\n if [[ \"${MC_VERSION}\" == \"1.7.10\" ]]; then\r\n FORGE_JAR=\"forge-${FORGE_VERSION}-universal.jar\"\r\n fi\r\n\r\n local FORGE_URL=\"${FORGE_INSTALLER_URL}${FORGE_VERSION}\/forge-${FORGE_VERSION}\"\r\n\r\n echo -e \"\\tUsing Forge ${FORGE_VERSION} from ${FORGE_URL}\"\r\n\r\n local FORGE_INSTALLER=\"${FORGE_URL}-installer.jar\"\r\n echo -e \"\\tDownloading Forge Installer ${FORGE_VERSION} from ${FORGE_INSTALLER}\"\r\n\r\n if ! wget -q -O forge-installer.jar \"${FORGE_INSTALLER}\"; then\r\n echo -e \"\\tERROR: Failed to download Forge Installer ${FORGE_VERSION}\"\r\n exit 1\r\n fi\r\n\r\n # Remove old Forge files so we can safely update\r\n rm -rf libraries\/net\/minecraftforge\/forge\/\r\n rm -f unix_args.txt\r\n\r\n echo -e \"\\tInstalling Forge Server ${FORGE_VERSION}\"\r\n if ! java -jar forge-installer.jar --installServer > \/dev\/null 2>&1; then\r\n echo -e \"\\tERROR: Failed to install Forge Server ${FORGE_VERSION}\"\r\n exit 1\r\n fi\r\n\r\n if [[ $MC_VERSION =~ ^1\\.(17|18|19|20|21|22|23) || $FORGE_VERSION =~ ^1\\.(17|18|19|20|21|22|23) ]]; then\r\n echo -e \"\\tDetected Forge 1.17 or newer version. Setting up Forge Unix arguments\"\r\n ln -sf libraries\/net\/minecraftforge\/forge\/*\/unix_args.txt unix_args.txt\r\n else\r\n mv \"$FORGE_JAR\" forge-server-launch.jar\r\n echo \"forge-server-launch.jar\" > \".serverjar\"\r\n fi\r\n\r\n rm -f forge-installer.jar\r\n}\r\n\r\nFABRIC_INSTALLER_URL=\"https:\/\/meta.fabricmc.net\/v2\/versions\/installer\"\r\n\r\nfunction json_download_fabric {\r\n echo \"Downloading Fabric...\"\r\n\r\n local MC_VERSION=$MINECRAFT_VERSION\r\n local FABRIC_VERSION=$LOADER_VERSION\r\n\r\n local INSTALLER_JSON=$(wget -q -O - ${FABRIC_INSTALLER_URL} )\r\n local INSTALLER_VERSION=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].version \/\/ empty')\r\n local INSTALLER_URL=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].url \/\/ empty')\r\n\r\n if [[ -z \"${INSTALLER_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No Fabric installer version found\"\r\n exit 1\r\n fi\r\n\r\n if [[ -z \"${INSTALLER_URL}\" ]]; then\r\n echo -e \"\\tERROR: No Fabric installer url found\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tDownloading Fabric Installer ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION}) from ${INSTALLER_URL}\"\r\n\r\n if ! wget -q -O fabric-installer.jar \"${INSTALLER_URL}\"; then\r\n echo -e \"\\tERROR: Failed to download Fabric Installer ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tInstalling Fabric Server ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION})\"\r\n if ! java -jar fabric-installer.jar server -mcversion \"${MC_VERSION}\" -loader \"${FABRIC_VERSION}\" -downloadMinecraft; then\r\n echo -e \"\\tERROR: Failed to install Fabric Server ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo \"fabric-server-launch.jar\" > \".serverjar\"\r\n\r\n rm -f fabric-installer.jar\r\n}\r\n\r\nQUILT_INSTALLER_URL=\"https:\/\/meta.quiltmc.org\/v3\/versions\/installer\"\r\n\r\nfunction json_download_quilt {\r\n echo \"Downloading Quilt...\"\r\n\r\n local MC_VERSION=$MINECRAFT_VERSION\r\n local QUILT_VERSION=$LOADER_VERSION\r\n\r\n local INSTALLER_JSON=$(wget -q -O - ${QUILT_INSTALLER_URL} )\r\n local INSTALLER_VERSION=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].version \/\/ empty')\r\n local INSTALLER_URL=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].url \/\/ empty')\r\n\r\n if [[ -z \"${INSTALLER_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No Quilt installer version found\"\r\n exit 1\r\n fi\r\n\r\n if [[ -z \"${INSTALLER_URL}\" ]]; then\r\n echo -e \"\\tERROR: No Quilt installer URL found\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tDownloading Quilt Installer ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION}) from ${INSTALLER_URL}\"\r\n\r\n if ! wget -q -O quilt-installer.jar \"${INSTALLER_URL}\"; then\r\n echo -e \"\\tERROR: Failed to download Quilt Installer ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tInstalling Quilt Server ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION})\"\r\n if ! java -jar quilt-installer.jar install server \"${MC_VERSION}\" \"${QUILT_VERSION}\" --download-server --install-dir=.\/; then\r\n echo -e \"\\tERROR: Failed to install Quilt Server ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo \"quilt-server-launch.jar\" > \".serverjar\"\r\n\r\n rm quilt-installer.jar\r\n}\r\n\r\ninstall_required\r\n\r\nif [[ -z \"${PROJECT_ID}\" ]]; then\r\n echo \"ERROR: You must specify a PROJECT_ID environment variable!\"\r\n exit 1\r\nfi\r\n\r\nif [[ ! \"${PROJECT_ID}\" = \"zip\" ]]; then\r\n\tget_download\r\nfi\r\n\r\nget_loader\r\nunpack_zip\r\n\r\nif [[ -f \"${SERVER_DIR}\/manifest.json\" ]]; then\r\n echo \"Found manifest.json, installing mods\"\r\n json_download_mods\r\n json_download_overrides\r\nfi\r\n\r\nif [[ -f \"${SERVER_DIR}\/client.manifest.json\" ]]; then\r\n MANIFEST=\"${SERVER_DIR}\/client.manifest.json\"\r\n\r\n if [[ $LOADER_NAME == \"forge\" ]]; then\r\n json_download_forge\r\n fi\r\n\r\n if [[ $LOADER_NAME == \"fabric\" ]]; then\r\n json_download_fabric\r\n fi\r\n\r\n if [[ $LOADER_NAME == \"quilt\" ]]; then\r\n json_download_quilt\r\n fi\r\nfi\r\n\r\necho -e \"\\nInstall completed succesfully, enjoy!\"", + "script": "#!\/bin\/bash\r\n# shellcheck disable=SC2155\r\n#\r\n# CurseForge Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\n\r\n: \"${SERVER_DIR:=\/mnt\/server}\"\r\n: \"${PROJECT_ID:=}\"\r\n: \"${VERSION_ID:=}\"\r\n: \"${API_KEY:=}\"\r\n\r\nif [[ ! -d $SERVER_DIR ]]; then\r\n mkdir -p \"$SERVER_DIR\"\r\nfi\r\n\r\nif ! cd \"$SERVER_DIR\"; then\r\n echo -e \"Failed to change directory to ${SERVER_DIR}\"\r\n exit 1\r\nfi\r\n\r\nfunction install_required {\r\n echo -e \"Installing required packages...\"\r\n echo -e \"\\tRunning apt update\"\r\n apt update > \/dev\/null 2>&1 || { echo \"apt update failed!\"; exit 1; }\r\n echo -e \"\\tRunning apt install\"\r\n apt install -y wget jq unzip > \/dev\/null 2>&1 || { echo \"apt install failed!\"; exit 1; }\r\n}\r\n\r\nCURSEFORGE_API_URL=\"https:\/\/api.curseforge.com\/v1\/mods\/\"\r\nCURSEFORGE_API_HEADERS=(\"--header=Accept: application\/json\" \"--header=x-api-key: ${API_KEY}\")\r\n\r\nfunction get_download {\r\n echo -e \"Retrieving CurseForge project information...\"\r\n local PROJECT_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\" -O -)\r\n local PROJECT_TITLE=$(echo \"$PROJECT_DATA\" | jq -r '.data.name \/\/ empty')\r\n\r\n if [[ -z \"${PROJECT_DATA}\" ]]; then\r\n echo -e \"\\tERROR: Failed to retrieve project data for project id '${PROJECT_ID}'\"\r\n exit 1\r\n fi\r\n\r\n local IS_SERVER_PACK=false\r\n\r\n if [[ -z \"${VERSION_ID}\" || \"${VERSION_ID}\" == \"latest\" ]]; then\r\n echo -e \"\\tNo file ID specified, using latest file\"\r\n VERSION_ID=$(echo \"$PROJECT_DATA\" | jq -r '.data.mainFileId \/\/ empty')\r\n\r\n local VERSION_SERVER_PACK=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .isServerPack')\"\r\n local VERSION_SERVER_ID=\"$(echo -e \"${PROJECT_DATA}\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.data.latestFiles[] | select(.id|tostring==$VERSION_ID) | .serverPackFileId')\"\r\n\r\n if [[ \"${VERSION_SERVER_PACK}\" == \"false\" && -n \"${VERSION_SERVER_ID}\" ]]; then\r\n echo -e \"\\tFound server pack file id '${VERSION_SERVER_ID}'\"\r\n VERSION_ID=$VERSION_SERVER_ID\r\n IS_SERVER_PACK=true\r\n elif [[ \"${VERSION_SERVER_PACK}\" == \"true\" ]]; then\r\n IS_SERVER_PACK=true\r\n fi\r\n else\r\n echo -e \"\\tChecking if provided file id '${VERSION_ID}' exists\"\r\n\r\n local FILE_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\/files\/${VERSION_ID}\" -O -)\r\n\r\n if [[ -z \"${FILE_DATA}\" ]]; then\r\n echo -e \"\\tERROR: File id '${VERSION_ID}' not found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n\r\n IS_SERVER_PACK=$(echo -e \"${FILE_DATA}\" | jq -r '.data.isServerPack \/\/ \"false\"')\r\n\r\n if [[ \"${IS_SERVER_PACK}\" == \"false\" ]]; then\r\n local VERSION_SERVER_PACK=\"$(echo -e \"${FILE_DATA}\" | jq -r '.data.serverPackFileId \/\/ empty')\"\r\n if [[ -n \"${VERSION_SERVER_PACK}\" ]]; then\r\n echo -e \"\\tFound server pack file id '${VERSION_SERVER_PACK}'\"\r\n VERSION_ID=$VERSION_SERVER_PACK\r\n IS_SERVER_PACK=true\r\n fi\r\n else\r\n IS_SERVER_PACK=true\r\n fi\r\n fi\r\n\r\n # Check if version id is unset or empty string\r\n if [[ -z \"${VERSION_ID}\" ]]; then\r\n echo -e \"\\tERROR: No file id found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n\r\n if [[ \"${IS_SERVER_PACK}\" == \"false\" ]]; then\r\n echo -e \"\\tWARNING: File id '${VERSION_ID}' is not a server pack, attempting to use client files\"\r\n fi\r\n\r\n # get json data to work with\r\n echo -e \"\\tRetrieving version information for '${VERSION_ID}'\"\r\n local JSON_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\/files\/${VERSION_ID}\/download-url\" -O -)\r\n\r\n if [[ -z \"${JSON_DATA}\" ]]; then\r\n echo -e \"\\tERROR: Failed to retrieve file data for file id '${VERSION_ID}'\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tParsing CurseForge pack download url\"\r\n\r\n local DOWNLOAD_URL=$(echo -e \"$JSON_DATA\" | jq -r '.data \/\/ empty')\r\n if [[ -z \"${DOWNLOAD_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for file ${VERSION_ID}\"\r\n exit 1\r\n fi\r\n\r\n # download modpack files\r\n echo -e \"\\tDownloading ${DOWNLOAD_URL}\"\r\n if ! wget -q \"${DOWNLOAD_URL}\" -O server.zip; then\r\n echo -e \"Download failed!\"\r\n exit 1\r\n fi\r\n}\r\n\r\nfunction get_loader {\r\n echo -e \"Retrieving loader information...\"\r\n\r\n local PROJECT_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\" -O -)\r\n local PROJECT_TITLE=$(echo \"$PROJECT_DATA\" | jq -r '.data.name \/\/ empty')\r\n if [[ -z \"${PROJECT_DATA}\" ]]; then\r\n echo -e \"\\tERROR: Failed to retrieve project data for project id '${PROJECT_ID}'\"\r\n exit 1\r\n fi\r\n\r\n local FILE_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\/files\/${VERSION_ID}\" -O -)\r\n\r\n if [[ -z \"${FILE_DATA}\" ]]; then\r\n echo -e \"\\tERROR: File id '${VERSION_ID}' not found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n\r\n local IS_SERVER_PACK=$(echo -e \"${FILE_DATA}\" | jq -r '.data.isServerPack \/\/ \"false\"')\r\n local CLIENT_VERSION_ID;\r\n\r\n if [[ \"${IS_SERVER_PACK}\" == \"true\" ]]; then\r\n CLIENT_VERSION_ID=\"$(echo -e \"${FILE_DATA}\" | jq -r '.data.parentProjectFileId \/\/ empty')\"\r\n else\r\n CLIENT_VERSION_ID=$VERSION_ID\r\n fi\r\n\r\n if [[ -z \"${CLIENT_VERSION_ID}\" ]]; then\r\n echo -e \"\\tERROR: File id '${VERSION_ID}' not found for project '${PROJECT_TITLE}'\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tRetrieving file information for '${CLIENT_VERSION_ID}'\"\r\n local JSON_DATA=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${PROJECT_ID}\/files\/${CLIENT_VERSION_ID}\/download-url\" -O -)\r\n\r\n echo -e \"\\tParsing CurseForge pack download url\"\r\n\r\n local DOWNLOAD_URL=$(echo -e \"$JSON_DATA\" | jq -r '.data \/\/ empty')\r\n\r\n if [[ -z \"${DOWNLOAD_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for file id ${CLIENT_VERSION_ID}\"\r\n exit 1\r\n fi\r\n\r\n # download modpack files\r\n echo -e \"\\tDownloading ${DOWNLOAD_URL}\"\r\n wget -q \"${DOWNLOAD_URL}\" -O client.zip\r\n\r\n echo -e \"\\tUnpacking client manifest\"\r\n unzip -jo client.zip manifest.json -d \"${SERVER_DIR}\"\r\n mv \"${SERVER_DIR}\/manifest.json\" \"${SERVER_DIR}\/client.manifest.json\" # rename to avoid conflicts with main manifest\r\n rm -rf client.zip\r\n\r\n echo -e \"\\tParsing client manifest\"\r\n local MANIFEST=\"${SERVER_DIR}\/client.manifest.json\"\r\n\r\n LOADER_ID=$(jq -r '.minecraft.modLoaders[]? | select(.primary == true) | .id' \"${MANIFEST}\")\r\n LOADER_NAME=$(echo \"${LOADER_ID}\" | cut -d'-' -f1)\r\n LOADER_VERSION=$(echo \"${LOADER_ID}\" | cut -d'-' -f2)\r\n\r\n if [[ -z \"${LOADER_NAME}\" || -z \"${LOADER_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No loader found in client manifest!\"\r\n exit 1\r\n fi\r\n\r\n MINECRAFT_VERSION=$(jq -r '.minecraft.version \/\/ empty' \"${MANIFEST}\")\r\n\r\n if [[ -z \"${MINECRAFT_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No minecraft version found in client manifest!\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tFound loader ${LOADER_NAME} ${LOADER_VERSION} for Minecraft ${MINECRAFT_VERSION}\"\r\n}\r\n\r\nfunction unzip-strip() (\r\n set -u\r\n\r\n local archive=$1\r\n local destdir=${2:-}\r\n shift; shift || :\r\n echo -e \"\\tUnpacking ${archive} to ${destdir}\"\r\n\r\n echo -e \"\\tCreating temporary directory\"\r\n local tmpdir=\/mnt\/server\/tmp\r\n if ! mkdir -p \"${tmpdir}\"; then\r\n echo -e \"\\tERROR: mkdir failed to create temporary directory\"\r\n return 1\r\n fi\r\n\r\n trap 'rm -rf -- \"$tmpdir\"' EXIT\r\n\r\n echo -e \"\\tUnpacking archive\"\r\n\r\n if ! unzip -q \"$archive\" -d \"$tmpdir\"; then\r\n echo -e \"\\tERROR: unzip failed to unpack archive\"\r\n return 1\r\n fi\r\n\r\n echo -e \"\\tSetting glob settings\"\r\n\r\n shopt -s dotglob\r\n\r\n echo -e \"\\tCleaning up directory structure\"\r\n\r\n local files=(\"$tmpdir\"\/*) name i=1\r\n\r\n if (( ${#files[@]} == 1 )) && [[ -d \"${files[0]}\" ]]; then\r\n name=$(basename \"${files[0]}\")\r\n files=(\"$tmpdir\"\/*\/*)\r\n else\r\n name=$(basename \"$archive\"); name=${archive%.*}\r\n files=(\"$tmpdir\"\/*)\r\n fi\r\n\r\n if [[ -z \"$destdir\" ]]; then\r\n destdir=.\/\"$name\"\r\n fi\r\n\r\n while [[ -f \"$destdir\" ]]; do\r\n destdir=${destdir}-$((i++));\r\n done\r\n\r\n echo -e \"\\tCopying files to ${destdir}\"\r\n\r\n mkdir -p \"$destdir\"\r\n cp -ar \"$@\" -t \"$destdir\" -- \"${files[@]}\"\r\n rm -rf \"$tmpdir\"\r\n)\r\n\r\nfunction unpack_zip {\r\n echo -e \"Unpacking server files...\"\r\n unzip-strip server.zip \"${SERVER_DIR}\"\r\n rm -rf server.zip\r\n}\r\n\r\nfunction json_download_mods {\r\n echo \"Downloading mods...\"\r\n\r\n local MANIFEST=\"${SERVER_DIR}\/manifest.json\"\r\n jq -c '.files[]? | select(.required == true) | {project: .projectID, file: .fileID}' \"${MANIFEST}\" | while read -r mod; do\r\n local MOD_PROJECT_ID=$(echo \"${mod}\" | jq -r '.project \/\/ empty')\r\n local MOD_FILE_ID=$(echo \"${mod}\" | jq -r '.file \/\/ empty')\r\n\r\n if [[ -z \"${MOD_PROJECT_ID}\" || -z \"${MOD_FILE_ID}\" ]]; then\r\n echo -e \"\\tERROR: Failed to parse project id or file id for mod '${mod}'\"\r\n exit 1\r\n fi\r\n\r\n local FILE_URL=$(wget -q \"${CURSEFORGE_API_HEADERS[@]}\" \"${CURSEFORGE_API_URL}${MOD_PROJECT_ID}\/files\/${MOD_FILE_ID}\/download-url\" -O - | jq -r '.data \/\/ empty')\r\n\r\n if [[ -z \"${FILE_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for mod ${MOD_PROJECT_ID} ${MOD_FILE_ID}\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tDownloading ${FILE_URL}\"\r\n\r\n if ! wget -q \"${FILE_URL}\" -P \"${SERVER_DIR}\/mods\"; then\r\n echo -e \"\\tERROR: Failed to download mod ${MOD_PROJECT_ID} ${MOD_FILE_ID}\"\r\n exit 1\r\n fi\r\n done\r\n}\r\n\r\nfunction json_download_overrides {\r\n echo \"Copying overrides...\"\r\n if [[ -d \"${SERVER_DIR}\/overrides\" ]]; then\r\n cp -r \"${SERVER_DIR}\/overrides\/\"* \"${SERVER_DIR}\"\r\n rm -r \"${SERVER_DIR}\/overrides\"\r\n fi\r\n}\r\n\r\nFORGE_INSTALLER_URL=\"https:\/\/maven.minecraftforge.net\/net\/minecraftforge\/forge\/\"\r\n\r\nfunction json_download_forge {\r\n echo \"Downloading Forge...\"\r\n\r\n local MC_VERSION=$MINECRAFT_VERSION\r\n local FORGE_VERSION=$LOADER_VERSION\r\n\r\n FORGE_VERSION=\"${MC_VERSION}-${FORGE_VERSION}\"\r\n if [[ \"${MC_VERSION}\" == \"1.7.10\" || \"${MC_VERSION}\" == \"1.8.9\" ]]; then\r\n FORGE_VERSION=\"${FORGE_VERSION}-${MC_VERSION}\"\r\n fi\r\n\r\n local FORGE_JAR=\"forge-${FORGE_VERSION}.jar\"\r\n if [[ \"${MC_VERSION}\" == \"1.7.10\" ]]; then\r\n FORGE_JAR=\"forge-${FORGE_VERSION}-universal.jar\"\r\n fi\r\n\r\n local FORGE_URL=\"${FORGE_INSTALLER_URL}${FORGE_VERSION}\/forge-${FORGE_VERSION}\"\r\n\r\n echo -e \"\\tUsing Forge ${FORGE_VERSION} from ${FORGE_URL}\"\r\n\r\n local FORGE_INSTALLER=\"${FORGE_URL}-installer.jar\"\r\n echo -e \"\\tDownloading Forge Installer ${FORGE_VERSION} from ${FORGE_INSTALLER}\"\r\n\r\n if ! wget -q -O forge-installer.jar \"${FORGE_INSTALLER}\"; then\r\n echo -e \"\\tERROR: Failed to download Forge Installer ${FORGE_VERSION}\"\r\n exit 1\r\n fi\r\n\r\n # Remove old Forge files so we can safely update\r\n rm -rf libraries\/net\/minecraftforge\/forge\/\r\n rm -f unix_args.txt\r\n\r\n echo -e \"\\tInstalling Forge Server ${FORGE_VERSION}\"\r\n if ! java -jar forge-installer.jar --installServer > \/dev\/null 2>&1; then\r\n echo -e \"\\tERROR: Failed to install Forge Server ${FORGE_VERSION}\"\r\n exit 1\r\n fi\r\n\r\n if [[ $MC_VERSION =~ ^1\\.(17|18|19|20|21|22|23) || $FORGE_VERSION =~ ^1\\.(17|18|19|20|21|22|23) ]]; then\r\n echo -e \"\\tDetected Forge 1.17 or newer version. Setting up Forge Unix arguments\"\r\n ln -sf libraries\/net\/minecraftforge\/forge\/*\/unix_args.txt unix_args.txt\r\n else\r\n mv \"$FORGE_JAR\" forge-server-launch.jar\r\n echo \"forge-server-launch.jar\" > \".serverjar\"\r\n fi\r\n\r\n rm -f forge-installer.jar\r\n}\r\n\r\nFABRIC_INSTALLER_URL=\"https:\/\/meta.fabricmc.net\/v2\/versions\/installer\"\r\n\r\nfunction json_download_fabric {\r\n echo \"Downloading Fabric...\"\r\n\r\n local MC_VERSION=$MINECRAFT_VERSION\r\n local FABRIC_VERSION=$LOADER_VERSION\r\n\r\n local INSTALLER_JSON=$(wget -q -O - ${FABRIC_INSTALLER_URL} )\r\n local INSTALLER_VERSION=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].version \/\/ empty')\r\n local INSTALLER_URL=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].url \/\/ empty')\r\n\r\n if [[ -z \"${INSTALLER_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No Fabric installer version found\"\r\n exit 1\r\n fi\r\n\r\n if [[ -z \"${INSTALLER_URL}\" ]]; then\r\n echo -e \"\\tERROR: No Fabric installer url found\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tDownloading Fabric Installer ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION}) from ${INSTALLER_URL}\"\r\n\r\n if ! wget -q -O fabric-installer.jar \"${INSTALLER_URL}\"; then\r\n echo -e \"\\tERROR: Failed to download Fabric Installer ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tInstalling Fabric Server ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION})\"\r\n if ! java -jar fabric-installer.jar server -mcversion \"${MC_VERSION}\" -loader \"${FABRIC_VERSION}\" -downloadMinecraft; then\r\n echo -e \"\\tERROR: Failed to install Fabric Server ${MC_VERSION}-${FABRIC_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo \"fabric-server-launch.jar\" > \".serverjar\"\r\n\r\n rm -f fabric-installer.jar\r\n}\r\n\r\nQUILT_INSTALLER_URL=\"https:\/\/meta.quiltmc.org\/v3\/versions\/installer\"\r\n\r\nfunction json_download_quilt {\r\n echo \"Downloading Quilt...\"\r\n\r\n local MC_VERSION=$MINECRAFT_VERSION\r\n local QUILT_VERSION=$LOADER_VERSION\r\n\r\n local INSTALLER_JSON=$(wget -q -O - ${QUILT_INSTALLER_URL} )\r\n local INSTALLER_VERSION=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].version \/\/ empty')\r\n local INSTALLER_URL=$(echo \"$INSTALLER_JSON\" | jq -r '.[0].url \/\/ empty')\r\n\r\n if [[ -z \"${INSTALLER_VERSION}\" ]]; then\r\n echo -e \"\\tERROR: No Quilt installer version found\"\r\n exit 1\r\n fi\r\n\r\n if [[ -z \"${INSTALLER_URL}\" ]]; then\r\n echo -e \"\\tERROR: No Quilt installer URL found\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tDownloading Quilt Installer ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION}) from ${INSTALLER_URL}\"\r\n\r\n if ! wget -q -O quilt-installer.jar \"${INSTALLER_URL}\"; then\r\n echo -e \"\\tERROR: Failed to download Quilt Installer ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tInstalling Quilt Server ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION})\"\r\n if ! java -jar quilt-installer.jar install server \"${MC_VERSION}\" \"${QUILT_VERSION}\" --download-server --install-dir=.\/; then\r\n echo -e \"\\tERROR: Failed to install Quilt Server ${MC_VERSION}-${QUILT_VERSION} (${INSTALLER_VERSION})\"\r\n exit 1\r\n fi\r\n\r\n echo \"quilt-server-launch.jar\" > \".serverjar\"\r\n\r\n rm quilt-installer.jar\r\n}\r\n\r\ninstall_required\r\n\r\nif [[ -z \"${PROJECT_ID}\" ]]; then\r\n echo \"ERROR: You must specify a PROJECT_ID environment variable!\"\r\n exit 1\r\nfi\r\n\r\nif [[ ! \"${PROJECT_ID}\" = \"zip\" ]]; then\r\n\tget_download\r\nfi\r\n\r\nget_loader\r\nunpack_zip\r\n\r\nif [[ -f \"${SERVER_DIR}\/manifest.json\" ]]; then\r\n echo \"Found manifest.json, installing mods\"\r\n json_download_mods\r\n json_download_overrides\r\nfi\r\n\r\nif [[ -f \"${SERVER_DIR}\/client.manifest.json\" ]]; then\r\n MANIFEST=\"${SERVER_DIR}\/client.manifest.json\"\r\n\r\n if [[ $LOADER_NAME == \"forge\" ]]; then\r\n json_download_forge\r\n fi\r\n\r\n if [[ $LOADER_NAME == \"fabric\" ]]; then\r\n json_download_fabric\r\n fi\r\n\r\n if [[ $LOADER_NAME == \"quilt\" ]]; then\r\n json_download_quilt\r\n fi\r\nfi\r\n\r\necho -e \"\\nInstall completed succesfully, enjoy!\"", "container": "openjdk:8-jdk-slim", "entrypoint": "bash" }