Merge pull request #1513 from IConnC/factorio-enhanced-start

Modified Factorio Egg for better start script
This commit is contained in:
Michael (Parker) Parker 2022-01-09 12:03:28 -05:00 committed by GitHub
commit 033cfd54c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,24 +1,29 @@
{ {
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO", "_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": { "meta": {
"version": "PTDL_v1" "version": "PTDL_v1",
"update_url": null
}, },
"exported_at": "2020-06-26T12:55:32-04:00", "exported_at": "2022-01-02T22:43:37-05:00",
"name": "Factorio", "name": "Factorio",
"author": "parker@parkervcp.com", "author": "parker@parkervcp.com",
"description": "The vanilla Factorio server.\r\n\r\nhttps:\/\/www.factorio.com\/", "description": "The vanilla Factorio server.\r\n\r\nhttps:\/\/www.factorio.com\/",
"image": "quay.io\/parkervcp\/pterodactyl-images:base_debian", "features": null,
"startup": ".\/bin\/x64\/factorio --port {{SERVER_PORT}} --server-settings data\/server-settings.json --start-server {{SAVE_NAME}}.zip", "images": [
"ghcr.io\/parkervcp\/yolks:debian"
],
"file_denylist": [],
"startup": "if [ ! -f \".\/saves\/{{SAVE_NAME}}.zip\" ]; then .\/bin\/x64\/factorio --create .\/saves\/{{SAVE_NAME}}.zip --map-gen-settings data\/map-gen-settings.json --map-settings data\/map-settings.json; fi;\r\n .\/bin\/x64\/factorio --port {{SERVER_PORT}} --server-settings data\/server-settings.json --start-server saves\/{{SAVE_NAME}}.zip",
"config": { "config": {
"files": "{\r\n \"data\/server-settings.json\": {\r\n \"parser\": \"json\",\r\n \"find\": {\r\n \"name\": \"{{server.build.env.SERVER_NAME}}\",\r\n \"description\": \"{{server.build.env.SERVER_DESC}}\",\r\n \"max_players\": \"{{server.build.env.MAX_SLOTS}}\",\r\n \"username\": \"{{server.build.env.SERVER_USERNAME}}\",\r\n \"token\": \"{{server.build.env.SERVER_TOKEN}}\",\r\n \"autosave_interval\": \"{{server.build.env.SAVE_INTERVAL}}\",\r\n \"autosave_slots\": \"{{server.build.env.SAVE_SLOTS}}\",\r\n \"afk_autokick_interval\": \"{{server.build.env.AFK_KICK}}\"\r\n }\r\n }\r\n}", "files": "{\r\n \"data\/server-settings.json\": {\r\n \"parser\": \"json\",\r\n \"find\": {\r\n \"name\": \"{{server.build.env.SERVER_NAME}}\",\r\n \"description\": \"{{server.build.env.SERVER_DESC}}\",\r\n \"max_players\": \"{{server.build.env.MAX_SLOTS}}\",\r\n \"username\": \"{{server.build.env.SERVER_USERNAME}}\",\r\n \"token\": \"{{server.build.env.SERVER_TOKEN}}\",\r\n \"autosave_interval\": \"{{server.build.env.SAVE_INTERVAL}}\",\r\n \"autosave_slots\": \"{{server.build.env.SAVE_SLOTS}}\",\r\n \"afk_autokick_interval\": \"{{server.build.env.AFK_KICK}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \"Hosting game at\",\r\n \"userInteraction\": []\r\n}", "startup": "{\r\n \"done\": \"Hosting game at\"\r\n}",
"logs": "{\r\n \"custom\": false,\r\n \"location\": \"factorio-current.log\"\r\n}", "logs": "{\r\n \"custom\": false,\r\n \"location\": \"factorio-current.log\"\r\n}",
"stop": "\/quit" "stop": "\/quit"
}, },
"scripts": { "scripts": {
"installation": { "installation": {
"script": "#!\/bin\/bash\r\n# Factorio Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update \r\napt install -y curl tar xz-utils jq\r\n\r\nVERSION_JSON=$(curl -sSL https:\/\/factorio.com\/api\/latest-releases)\r\n\r\nlatest_stable=$(echo $VERSION_JSON | jq -r '.stable.headless')\r\nlatest_experimental=$(echo $VERSION_JSON | jq -r '.experimental.headless')\r\n\r\nif [ -z \"${FACTORIO_VERSION}\" ] || [ \"${FACTORIO_VERSION}\" == \"latest\" ]; then\r\n DL_VERSION=$latest_stable\r\nelif [ \"${FACTORIO_VERSION}\" == \"experimental\" ]; then\r\n DL_VERSION=$latest_experimental\r\nelse\r\n DL_VERSION=${FACTORIO_VERSION}\r\nfi\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\necho -e \"\\n running 'curl -sL https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}' \\n\"\r\n\r\ncurl -sL https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}\r\n\r\ntar -xf factorio-${DL_VERSION} --strip-components=1 -C \/mnt\/server\r\n\r\nrm factorio-${DL_VERSION}\r\n\r\nif [ -e data\/map-gen-settings.json ]; then\r\n echo \"map-gen exists\"\r\nelse\r\n echo \"copying map-gen default settings\"\r\n mv data\/map-gen-settings.example.json data\/map-gen-settings.json\r\nfi\r\n\r\nif [ -e data\/server-settings.json ]; then\r\n echo \"server settings exists\"\r\nelse\r\n echo \"copying server default settings\"\r\n mv data\/server-settings.example.json data\/server-settings.json\r\nfi\r\n\r\nif [ -e map-settings.json ]; then\r\n echo \"map settings exists\"\r\nelse\r\n echo \"copying map default settings\"\r\n mv data\/map-settings.example.json data\/map-settings.json\r\nfi\r\n\r\nif [ -e ${SAVE_NAME}.zip ]; then\r\n echo \"save file exists\"\r\nelse\r\n .\/bin\/x64\/factorio --create ${SAVE_NAME}\r\n chmod o+w ${SAVE_NAME}.zip\r\nfi", "script": "#!\/bin\/bash\r\n# Factorio Installation Script\r\n#\r\n# Server Files: \/mnt\/server\r\napt update \r\napt install -y curl tar xz-utils jq\r\n\r\nVERSION_JSON=$(curl -sSL https:\/\/factorio.com\/api\/latest-releases)\r\n\r\nlatest_stable=$(echo $VERSION_JSON | jq -r '.stable.headless')\r\nlatest_experimental=$(echo $VERSION_JSON | jq -r '.experimental.headless')\r\n\r\nif [ -z \"${FACTORIO_VERSION}\" ] || [ \"${FACTORIO_VERSION}\" == \"latest\" ]; then\r\n DL_VERSION=$latest_stable\r\nelif [ \"${FACTORIO_VERSION}\" == \"experimental\" ]; then\r\n DL_VERSION=$latest_experimental\r\nelse\r\n DL_VERSION=${FACTORIO_VERSION}\r\nfi\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\necho -e \"\\n running 'curl -sL https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}' \\n\"\r\n\r\ncurl -sL https:\/\/www.factorio.com\/get-download\/${DL_VERSION}\/headless\/linux64 -o factorio-${DL_VERSION}\r\n\r\ntar -xf factorio-${DL_VERSION} --strip-components=1 -C \/mnt\/server\r\n\r\nrm factorio-${DL_VERSION}\r\n\r\nif [ -e data\/map-gen-settings.json ]; then\r\n echo \"map-gen exists\"\r\nelse\r\n echo \"copying map-gen default settings\"\r\n mv data\/map-gen-settings.example.json data\/map-gen-settings.json\r\nfi\r\n\r\nif [ -e data\/server-settings.json ]; then\r\n echo \"server settings exists\"\r\nelse\r\n echo \"copying server default settings\"\r\n mv data\/server-settings.example.json data\/server-settings.json\r\nfi\r\n\r\nif [ -e map-settings.json ]; then\r\n echo \"map settings exists\"\r\nelse\r\n echo \"copying map default settings\"\r\n mv data\/map-settings.example.json data\/map-settings.json\r\nfi\r\n\r\nif [ -e .\/saves\/${SAVE_NAME}.zip ]; then\r\n echo \"save file exists\"\r\nelse\r\n .\/bin\/x64\/factorio --create .\/saves\/${SAVE_NAME} --map-gen-settings data\/map-gen-settings.json --map-settings data\/map-settings.json\r\n chmod o+w .\/saves\/${SAVE_NAME}.zip\r\nfi",
"container": "debian:buster-slim", "container": "ghcr.io\/parkervcp\/installers:debian",
"entrypoint": "bash" "entrypoint": "bash"
} }
}, },
@ -28,8 +33,8 @@
"description": "Which version of Factorio to install and use.", "description": "Which version of Factorio to install and use.",
"env_variable": "FACTORIO_VERSION", "env_variable": "FACTORIO_VERSION",
"default_value": "latest", "default_value": "latest",
"user_viewable": 1, "user_viewable": true,
"user_editable": 1, "user_editable": true,
"rules": "required|string|between:3,12" "rules": "required|string|between:3,12"
}, },
{ {
@ -37,8 +42,8 @@
"description": "Total number of slots to allow on the server.", "description": "Total number of slots to allow on the server.",
"env_variable": "MAX_SLOTS", "env_variable": "MAX_SLOTS",
"default_value": "20", "default_value": "20",
"user_viewable": 1, "user_viewable": true,
"user_editable": 0, "user_editable": false,
"rules": "required|numeric|digits_between:1,3" "rules": "required|numeric|digits_between:1,3"
}, },
{ {
@ -46,8 +51,8 @@
"description": "The save name for the server.", "description": "The save name for the server.",
"env_variable": "SAVE_NAME", "env_variable": "SAVE_NAME",
"default_value": "gamesave", "default_value": "gamesave",
"user_viewable": 1, "user_viewable": true,
"user_editable": 1, "user_editable": true,
"rules": "alpha_dash|between:1,100" "rules": "alpha_dash|between:1,100"
}, },
{ {
@ -55,8 +60,8 @@
"description": "Your factorio.com token, it is required for your server to be visible in the public server list.", "description": "Your factorio.com token, it is required for your server to be visible in the public server list.",
"env_variable": "SERVER_TOKEN", "env_variable": "SERVER_TOKEN",
"default_value": "undefined", "default_value": "undefined",
"user_viewable": 1, "user_viewable": true,
"user_editable": 1, "user_editable": true,
"rules": "alpha_num|max:100" "rules": "alpha_num|max:100"
}, },
{ {
@ -64,8 +69,8 @@
"description": "Name of the game as it will appear in the game listing", "description": "Name of the game as it will appear in the game listing",
"env_variable": "SERVER_NAME", "env_variable": "SERVER_NAME",
"default_value": "Factorio Server", "default_value": "Factorio Server",
"user_viewable": 1, "user_viewable": true,
"user_editable": 1, "user_editable": true,
"rules": "required|string|max:100" "rules": "required|string|max:100"
}, },
{ {
@ -73,8 +78,8 @@
"description": "Description of the game that will appear in the listing.", "description": "Description of the game that will appear in the listing.",
"env_variable": "SERVER_DESC", "env_variable": "SERVER_DESC",
"default_value": "Description", "default_value": "Description",
"user_viewable": 1, "user_viewable": true,
"user_editable": 1, "user_editable": true,
"rules": "required|string|max:200" "rules": "required|string|max:200"
}, },
{ {
@ -82,8 +87,8 @@
"description": "Username used for the server", "description": "Username used for the server",
"env_variable": "SERVER_USERNAME", "env_variable": "SERVER_USERNAME",
"default_value": "unnamed", "default_value": "unnamed",
"user_viewable": 1, "user_viewable": true,
"user_editable": 1, "user_editable": true,
"rules": "required|string|max:40" "rules": "required|string|max:40"
}, },
{ {
@ -91,8 +96,8 @@
"description": "Time between auto saves specified in minutes", "description": "Time between auto saves specified in minutes",
"env_variable": "SAVE_INTERVAL", "env_variable": "SAVE_INTERVAL",
"default_value": "10", "default_value": "10",
"user_viewable": 1, "user_viewable": true,
"user_editable": 1, "user_editable": true,
"rules": "required|numeric|digits_between:1,3" "rules": "required|numeric|digits_between:1,3"
}, },
{ {
@ -100,8 +105,8 @@
"description": "The number of auto saves to keep.", "description": "The number of auto saves to keep.",
"env_variable": "SAVE_SLOTS", "env_variable": "SAVE_SLOTS",
"default_value": "5", "default_value": "5",
"user_viewable": 1, "user_viewable": true,
"user_editable": 1, "user_editable": true,
"rules": "required|numeric|digits_between:1,3" "rules": "required|numeric|digits_between:1,3"
}, },
{ {
@ -109,8 +114,8 @@
"description": "Time specified in minutes to kick AFK players.\r\n0 is off", "description": "Time specified in minutes to kick AFK players.\r\n0 is off",
"env_variable": "AFK_KICK", "env_variable": "AFK_KICK",
"default_value": "0", "default_value": "0",
"user_viewable": 1, "user_viewable": true,
"user_editable": 1, "user_editable": true,
"rules": "required|numeric|digits_between:1,3" "rules": "required|numeric|digits_between:1,3"
} }
] ]