2023-04-19 13:46:44 +08:00
{
"_comment" : "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO" ,
"meta" : {
"version" : "PTDL_v2" ,
"update_url" : null
} ,
2023-08-02 02:58:38 +08:00
"exported_at" : "2023-08-01T20:54:48+02:00" ,
2023-04-19 13:46:44 +08:00
"name" : "Modrinth Generic" ,
"author" : "contact@chromozone.dev" ,
"description" : "A generic egg for a Modrinth 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" : [ ] ,
2023-05-07 03:31:30 +08:00
"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\")" ,
2023-04-19 13:46:44 +08:00
"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" : {
2023-05-06 09:14:31 +08:00
"script" : "#!\/bin\/bash\r\n# shellcheck disable=SC2155\r\n#\r\n# Modrinth 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\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\r\n echo -e \"\\tRunning apt update\"\r\n if ! apt update > \/dev\/null 2>&1; then\r\n echo -e \"\\tERROR: apt update failed!\"\r\n exit 1\r\n fi\r\n\r\n echo -e \"\\tRunning apt install\"\r\n if ! apt install -y wget jq unzip dos2unix > \/dev\/null 2>&1; then\r\n echo -e \"\\tERROR: apt install failed!\"\r\n exit 1\r\n fi\r\n}\r\n\r\nMODRINTH_API_URL=\"https:\/\/api.modrinth.com\/v2\"\r\n\r\nfunction get_download {\r\n echo -e \"Retrieving Modrinth project information...\"\r\n local PROJECT_DATA=$(wget -q \"${MODRINTH_API_URL}\/project\/${PROJECT_ID}\" -O -)\r\n local PROJECT_TITLE=$(echo \"$PROJECT_DATA\" | jq -r '.title \/\/ empty')\r\n local PROJECT_SUPPORTED=$(echo \"$PROJECT_DATA\" | jq -r '.\"server_side\" \/\/ 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 if [[ \"${PROJECT_SUPPORTED}\" == \"unsupported\" ]]; then\r\n echo -e \"\\tWARNING: The project '${PROJECT_TITLE}' is listed as unsupported for server use. Continuing anyway...\"\r\n fi\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 '.versions[-1] \/\/ empty')\r\n else\r\n echo -e \"\\tChecking if provided version id '${VERSION_ID}' exists\"\r\n if [[ $(echo \"$PROJECT_DATA\" | jq -r --arg VERSION_ID \"$VERSION_ID\" '.versions[]? | select(. == $VERSION_ID)') != \"${VERSION_ID}\" ]]; then\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 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 # get json data to work with\r\n echo -e \"\\tRetrieving version information for '${VERSION_ID}'\"\r\n local JSON_DATA=$(wget -q \"${MODRINTH_API_URL}\/version\/${VERSION_ID}\" -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 Modrinth pack download url\"\r\n\r\n local DOWNLOAD_URL=$(echo \"$JSON_DATA\" | jq -r '.files[]? | select(.primary == true) | .url')\r\n\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 \"\\tERROR: Failed to download modpack files!\"\r\n exit 1\r\n fi\r\n}\r\n\r\nfunction unpack_zip {\r\n unzip -o server.zip\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}\/modrinth.index.json\"\r\n jq -c '.files[]? | select(.env.server == \"required\") | {name: .path, url: .downloads[0]}' \"${MANIFEST}\" | while read -r mod; do\r\n local FILE_URL=$(echo \"${mod}\" | jq -r '.url \/\/ empty')\r\n local FILE_NAME=$(echo \"${mod}\" | jq -r '.name \/\/ empty')\r\n\r\n if [[ -z \"${FILE_URL}\" ]]; then\r\n echo -e \"\\tERROR: No download url found for mod '${mod}'\" \ r \ n e x i t 1 \ r \ n
2023-08-02 02:58:38 +08:00
"container" : "eclipse-temurin:17-jdk" ,
2023-04-19 13:46:44 +08:00
"entrypoint" : "bash"
}
} ,
"variables" : [
{
2023-04-21 10:36:30 +08:00
"name" : "Modpack Project ID" ,
"description" : "This is the modpack project ID from the Modrinth site.\r\n\r\nFor example, the project ID of 'https:\/\/modrinth.com\/modpack\/fabulously-optimized\/' is 1KVo5zza" ,
"env_variable" : "PROJECT_ID" ,
"default_value" : "" ,
2023-04-19 13:46:44 +08:00
"user_viewable" : true ,
"user_editable" : true ,
"rules" : "required|string|max:8" ,
"field_type" : "text"
2023-05-06 09:14:31 +08:00
} ,
{
"name" : "Modpack Version ID" ,
"description" : "This is the modpack version ID from the Modrinth site.\r\n\r\nFor example, the version ID of 'https:\/\/modrinth.com\/modpack\/fabulously-optimized\/version\/4.7.4' is P9wA6exe" ,
"env_variable" : "VERSION_ID" ,
"default_value" : "latest" ,
"user_viewable" : true ,
"user_editable" : true ,
"rules" : "string|max:8" ,
"field_type" : "text"
2023-04-19 13:46:44 +08:00
}
]
2023-04-21 10:36:30 +08:00
}