Skip to content

Commit

Permalink
Add support for OpenMoHAA
Browse files Browse the repository at this point in the history
  • Loading branch information
ysdragon committed Dec 9, 2024
1 parent d27a750 commit d9eab29
Show file tree
Hide file tree
Showing 5 changed files with 369 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64,linux/riscv64
platforms: linux/amd64
push: true
tags: quay.io/ydrag0n/mohaa:latest,quay.io/ydrag0n/mohaa:${{ github.ref_name }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
4 changes: 2 additions & 2 deletions mohaa_vanilla.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2024-12-10T00:22:02+02:00",
"exported_at": "2024-12-10T01:10:52+02:00",
"name": "mohaa",
"author": "[email protected]",
"description": "Medal of Honor: Allied Assault Server (Reborn Patch)",
Expand All @@ -13,7 +13,7 @@
"quay.io\/ydrag0n\/mohaa": "quay.io\/ydrag0n\/mohaa"
},
"file_denylist": [],
"startup": ".\/mohaa_lnxded +set sv_punkbuster 0 +set fs_basepath {{BASE_PATH}} +set fs_outputpath {{LOG_DIR}} +set dedicated 2 +set sv_maxclients {{SERVER_MAXCLIENTS}} +set net_ip 0.0.0.0 +set net_port {{SERVER_PORT}} +set net_qport {{SERVER_QUERY_PORT}} +exec server.cfg",
"startup": ".\/mohaa_lnxded +set sv_punkbuster 0 +set fs_basepath {{BASE_PATH}} +set fs_outputpath {{LOG_DIR}} +set dedicated 2 +set sv_maxclients {{SERVER_MAXCLIENTS}} +set net_ip 0.0.0.0 +set net_port {{SERVER_PORT}} +set net_qport {{SERVER_QUERY_PORT}} +set net_gamespy_port {{SERVER_QUERY_PORT}} +exec server.cfg",
"config": {
"files": "{\r\n \"main\/server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"seta sv_hostname\": \"seta sv_hostname \\\"{{env.SERVER_NAME}}\\\"\",\r\n \"seta sv_maxClients\": \"seta sv_maxClients \\\"{{env.SERVER_MAXCLIENTS}}\\\"\",\r\n \"seta rconPassword\": \"seta rconPassword \\\"{{env.RCON_PASSWORD}}\\\"\",\r\n \"seta g_password\": \"seta g_password \\\"{{env.SERVER_PASSWORD}}\\\"\",\r\n \"map\": \"map {{env.SERVER_MAP}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \"------ Server Initialization Complete ------\"\r\n}",
Expand Down
122 changes: 122 additions & 0 deletions openmohaa_mohaa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2024-12-10T01:09:37+02:00",
"name": "mohaa",
"author": "[email protected]",
"description": "Medal of Honor: Allied Assault (OpenMoHAA)",
"features": null,
"docker_images": {
"quay.io\/ydrag0n\/mohaa": "quay.io\/ydrag0n\/mohaa"
},
"file_denylist": [],
"startup": ".\/omohaaded.x86_64 +set sv_punkbuster 0 +set fs_basepath {{BASE_PATH}} +set fs_outputpath {{LOG_DIR}} +set dedicated 2 +set sv_maxclients {{SERVER_MAXCLIENTS}} +set net_ip 0.0.0.0 +set net_port {{SERVER_PORT}} +set net_qport {{SERVER_QUERY_PORT}} +set net_gamespy_port {{SERVER_QUERY_PORT}} +exec server.cfg",
"config": {
"files": "{\r\n \"main\/server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"seta sv_hostname\": \"seta sv_hostname \\\"{{env.SERVER_NAME}}\\\"\",\r\n \"seta sv_maxClients\": \"seta sv_maxClients \\\"{{env.SERVER_MAXCLIENTS}}\\\"\",\r\n \"seta rconPassword\": \"seta rconPassword \\\"{{env.RCON_PASSWORD}}\\\"\",\r\n \"seta g_password\": \"seta g_password \\\"{{env.SERVER_PASSWORD}}\\\"\",\r\n \"map\": \"map {{env.SERVER_MAP}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \"------ Server Initialization Complete ------\"\r\n}",
"logs": "{}",
"stop": "quit"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\r\n\r\n# Define constants\r\nSERVER_DIR=\"\/mnt\/server\"\r\nMOHAA_URL=\"https:\/\/moh.ftp.sh\/data\/MOHAA_MINI_LINUX.zip\"\r\nOPENMOHAA_URL=\"https:\/\/github.com\/openmoh\/openmohaa\/releases\/latest\/download\/openmohaa-v0.80.0-linux-amd64.zip\"\r\nDOWNLOAD_FILE=\"mohaaserver.zip\"\r\nOPENMOHAA_FILE=\"openmohaa.zip\"\r\nSERVER_EXE=\".\/omohaaded.x86_64\"\r\n\r\n# Function to log messages with timestamps\r\nlog_message() {\r\n echo -e \"[$(date +'%Y-%m-%d %H:%M:%S')] $1\"\r\n}\r\n\r\n# Function to check if a URL is valid\r\ncheck_url() {\r\n if curl --output \/dev\/null --silent --head --fail \"$1\"; then\r\n return 0\r\n else\r\n return 1\r\n fi\r\n}\r\n\r\n# Function to download a file from a URL\r\ndownload_file() {\r\n local url=\"$1\"\r\n local output=\"$2\"\r\n if curl -sSL \"$url\" -o \"$output\"; then\r\n log_message \"Successfully downloaded $output\"\r\n return 0\r\n else\r\n log_message \"Failed to download $output\"\r\n return 1\r\n fi\r\n}\r\n\r\n# Create server directory\r\nif ! mkdir -p \"$SERVER_DIR\"; then\r\n log_message \"Failed to create server directory\"\r\n exit 1\r\nfi\r\n\r\n# Change to the server directory\r\ncd \"$SERVER_DIR\" || { log_message \"Failed to change directory to $SERVER_DIR\"; exit 1; }\r\n\r\n# Validate and download MOHAA server files\r\nif [[ -n \"$MOHAA_URL\" ]]; then\r\n if check_url \"$MOHAA_URL\"; then\r\n if ! download_file \"$MOHAA_URL\" \"$DOWNLOAD_FILE\"; then\r\n exit 4\r\n fi\r\n else\r\n log_message \"Invalid MOHAA download URL. Exiting.\"\r\n exit 2\r\n fi\r\nelse\r\n log_message \"MOHAA_URL is not set. Exiting.\"\r\n exit 3\r\nfi\r\n\r\n# Unpack MOHAA server files\r\nlog_message \"Unpacking MOHAA server files\"\r\nif ! unzip \"$DOWNLOAD_FILE\"; then\r\n log_message \"Failed to unzip MOHAA server files\"\r\n exit 5\r\nfi\r\n\r\n# Clean up downloaded MOHAA zip file\r\nrm \"$DOWNLOAD_FILE\"\r\n\r\n# Check for and download server configuration if not present\r\nif [[ ! -f main\/server.cfg ]]; then\r\n log_message \"Downloading default server configuration\"\r\n if ! download_file \"$CONFIG_URL\" \"main\/server.cfg\"; then\r\n log_message \"Failed to download server configuration\"\r\n fi\r\nfi\r\n\r\n# Download openmohaa files\r\nlog_message \"Downloading openmohaa files\"\r\nif ! download_file \"$OPENMOHAA_URL\" \"$OPENMOHAA_FILE\"; then\r\n exit 7\r\nfi\r\n\r\n# Unpack openmohaa files\r\nlog_message \"Unpacking openmohaa files\"\r\nif ! unzip \"$OPENMOHAA_FILE\"; then\r\n log_message \"Failed to unzip openmohaa files\"\r\n exit 8\r\nfi\r\n\r\n# Clean up downloaded openmohaa zip file\r\nrm \"$OPENMOHAA_FILE\"\r\n\r\n# Make the server executable\r\nlog_message \"Making $SERVER_EXE executable\"\r\nif ! chmod +x \"$SERVER_EXE\"; then\r\n log_message \"Failed to make $SERVER_EXE executable\"\r\n exit 6\r\nfi\r\n\r\n# Installation complete message\r\nlog_message \"Installation completed successfully\"",
"container": "quay.io\/ydrag0n\/mohaa",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Server Query Port",
"description": "Server query port (required to make your server listed on the game master server list).\r\n(SERVER_PORT+97)",
"env_variable": "SERVER_QUERY_PORT",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string|max:5",
"field_type": "text"
},
{
"name": "Max clients",
"description": "",
"env_variable": "SERVER_MAXCLIENTS",
"default_value": "14",
"user_viewable": true,
"user_editable": true,
"rules": "required|integer",
"field_type": "text"
},
{
"name": "Config URL",
"description": "URL from where to get the initial server.cfg",
"env_variable": "CONFIG_URL",
"default_value": "https:\/\/raw.githubusercontent.com\/ysdragon\/MOHAA-Pterodactyl-Egg\/refs\/heads\/main\/server.cfg",
"user_viewable": false,
"user_editable": false,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Server name",
"description": "The name of the server",
"env_variable": "SERVER_NAME",
"default_value": "MOHAA Server running on Pterodactyl",
"user_viewable": true,
"user_editable": true,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Rcon password",
"description": "Admin password for rcon",
"env_variable": "RCON_PASSWORD",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Server map",
"description": "Select the map",
"env_variable": "SERVER_MAP",
"default_value": "obj\/obj_team2",
"user_viewable": true,
"user_editable": true,
"rules": "required|string|in:obj\/obj_team2,dm\/mohdm7,dm\/mohdm1,dm\/mohdm3,dm\/mohdm2,dm\/mohdm6",
"field_type": "text"
},
{
"name": "Logs dir",
"description": "",
"env_variable": "LOG_DIR",
"default_value": "\/home\/container\/Logs",
"user_viewable": true,
"user_editable": false,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Base PATH",
"description": "",
"env_variable": "BASE_PATH",
"default_value": "\/home\/container",
"user_viewable": true,
"user_editable": false,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Server password",
"description": "",
"env_variable": "SERVER_PASSWORD",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string",
"field_type": "text"
}
]
}
122 changes: 122 additions & 0 deletions openmohaa_mohbt.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"_comment": "DO NOT EDIT: FILE GENERATED AUTOMATICALLY BY PTERODACTYL PANEL - PTERODACTYL.IO",
"meta": {
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2024-12-10T01:05:40+02:00",
"name": "mohbt",
"author": "[email protected]",
"description": "Medal of Honor: BreakThrough (OpenMoHAA)",
"features": null,
"docker_images": {
"quay.io\/ydrag0n\/mohaa": "quay.io\/ydrag0n\/mohaa"
},
"file_denylist": [],
"startup": ".\/omohaaded.x86_64 +set sv_punkbuster 0 +set fs_basepath {{BASE_PATH}} +set fs_outputpath {{LOG_DIR}} +set dedicated 2 +set sv_maxclients {{SERVER_MAXCLIENTS}} +set net_ip 0.0.0.0 +set net_port {{SERVER_PORT}} +set net_qport {{SERVER_QUERY_PORT}} +set net_gamespy_port {{SERVER_QUERY_PORT}} +set com_target_game 2 +exec server.cfg",
"config": {
"files": "{\r\n \"maintt\/server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"seta sv_hostname\": \"seta sv_hostname \\\"{{env.SERVER_NAME}}\\\"\",\r\n \"seta sv_maxClients\": \"seta sv_maxClients \\\"{{env.SERVER_MAXCLIENTS}}\\\"\",\r\n \"seta rconPassword\": \"seta rconPassword \\\"{{env.RCON_PASSWORD}}\\\"\",\r\n \"seta g_password\": \"seta g_password \\\"{{env.SERVER_PASSWORD}}\\\"\",\r\n \"map\": \"map {{env.SERVER_MAP}}\"\r\n }\r\n }\r\n}",
"startup": "{\r\n \"done\": \"------ Server Initialization Complete ------\"\r\n}",
"logs": "{}",
"stop": "quit"
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\r\n\r\n# Define constants\r\nSERVER_DIR=\"\/mnt\/server\"\r\nMOHAA_URL=\"https:\/\/moh.ftp.sh\/data\/MOH_MINI_LINUX.zip\"\r\nOPENMOHAA_URL=\"https:\/\/github.com\/openmoh\/openmohaa\/releases\/latest\/download\/openmohaa-v0.80.0-linux-amd64.zip\"\r\nDOWNLOAD_FILE=\"mohaaserver.zip\"\r\nOPENMOHAA_FILE=\"openmohaa.zip\"\r\nSERVER_EXE=\".\/omohaaded.x86_64\"\r\n\r\n# Function to log messages with timestamps\r\nlog_message() {\r\n echo -e \"[$(date +'%Y-%m-%d %H:%M:%S')] $1\"\r\n}\r\n\r\n# Function to check if a URL is valid\r\ncheck_url() {\r\n if curl --output \/dev\/null --silent --head --fail \"$1\"; then\r\n return 0\r\n else\r\n return 1\r\n fi\r\n}\r\n\r\n# Function to download a file from a URL\r\ndownload_file() {\r\n local url=\"$1\"\r\n local output=\"$2\"\r\n if curl -sSL \"$url\" -o \"$output\"; then\r\n log_message \"Successfully downloaded $output\"\r\n return 0\r\n else\r\n log_message \"Failed to download $output\"\r\n return 1\r\n fi\r\n}\r\n\r\n# Create server directory\r\nif ! mkdir -p \"$SERVER_DIR\"; then\r\n log_message \"Failed to create server directory\"\r\n exit 1\r\nfi\r\n\r\n# Change to the server directory\r\ncd \"$SERVER_DIR\" || { log_message \"Failed to change directory to $SERVER_DIR\"; exit 1; }\r\n\r\n# Validate and download MOHAA server files\r\nif [[ -n \"$MOHAA_URL\" ]]; then\r\n if check_url \"$MOHAA_URL\"; then\r\n if ! download_file \"$MOHAA_URL\" \"$DOWNLOAD_FILE\"; then\r\n exit 4\r\n fi\r\n else\r\n log_message \"Invalid MOHAA download URL. Exiting.\"\r\n exit 2\r\n fi\r\nelse\r\n log_message \"MOHAA_URL is not set. Exiting.\"\r\n exit 3\r\nfi\r\n\r\n# Unpack MOHAA server files\r\nlog_message \"Unpacking MOHAA server files\"\r\nif ! unzip \"$DOWNLOAD_FILE\"; then\r\n log_message \"Failed to unzip MOHAA server files\"\r\n exit 5\r\nfi\r\n\r\n# Clean up downloaded MOHAA zip file\r\nrm \"$DOWNLOAD_FILE\"\r\n\r\n# Check for and download server configuration if not present\r\nif [[ ! -f maintt\/server.cfg ]]; then\r\n log_message \"Downloading default server configuration\"\r\n if ! download_file \"$CONFIG_URL\" \"maintt\/server.cfg\"; then\r\n log_message \"Failed to download server configuration\"\r\n fi\r\nfi\r\n\r\n# Download OpenMoHAA files\r\nlog_message \"Downloading OpenMoHAA files\"\r\nif ! download_file \"$OPENMOHAA_URL\" \"$OPENMOHAA_FILE\"; then\r\n exit 7\r\nfi\r\n\r\n# Unpack OpenMoHAA files\r\nlog_message \"Unpacking OpenMoHAA files\"\r\nif ! unzip \"$OPENMOHAA_FILE\"; then\r\n log_message \"Failed to unzip OpenMoHAA files\"\r\n exit 8\r\nfi\r\n\r\n# Clean up downloaded OpenMoHAA zip file\r\nrm \"$OPENMOHAA_FILE\"\r\n\r\n# Make the server executable\r\nlog_message \"Making $SERVER_EXE executable\"\r\nif ! chmod +x \"$SERVER_EXE\"; then\r\n log_message \"Failed to make $SERVER_EXE executable\"\r\n exit 6\r\nfi\r\n\r\n# Installation complete message\r\nlog_message \"Installation completed successfully\"",
"container": "quay.io\/ydrag0n\/mohaa",
"entrypoint": "bash"
}
},
"variables": [
{
"name": "Server Query Port",
"description": "Server query port (required to make your server listed on the game master server list).\r\n(SERVER_PORT+97)",
"env_variable": "SERVER_QUERY_PORT",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string|max:5",
"field_type": "text"
},
{
"name": "Max clients",
"description": "",
"env_variable": "SERVER_MAXCLIENTS",
"default_value": "14",
"user_viewable": true,
"user_editable": true,
"rules": "required|integer",
"field_type": "text"
},
{
"name": "Config URL",
"description": "URL from where to get the initial server.cfg",
"env_variable": "CONFIG_URL",
"default_value": "https:\/\/raw.githubusercontent.com\/ysdragon\/MOHAA-Pterodactyl-Egg\/refs\/heads\/main\/server.cfg",
"user_viewable": false,
"user_editable": false,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Server name",
"description": "The name of the server",
"env_variable": "SERVER_NAME",
"default_value": "MOHAA Server running on Pterodactyl",
"user_viewable": true,
"user_editable": true,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Rcon password",
"description": "Admin password for rcon",
"env_variable": "RCON_PASSWORD",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Server map",
"description": "Select the map",
"env_variable": "SERVER_MAP",
"default_value": "obj\/obj_team2",
"user_viewable": true,
"user_editable": true,
"rules": "required|string|in:obj\/obj_team2,dm\/mohdm7,dm\/mohdm1,dm\/mohdm3,dm\/mohdm2,dm\/mohdm6",
"field_type": "text"
},
{
"name": "Logs dir",
"description": "",
"env_variable": "LOG_DIR",
"default_value": "\/home\/container\/Logs",
"user_viewable": true,
"user_editable": false,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Base PATH",
"description": "",
"env_variable": "BASE_PATH",
"default_value": "\/home\/container",
"user_viewable": true,
"user_editable": false,
"rules": "required|string",
"field_type": "text"
},
{
"name": "Server password",
"description": "",
"env_variable": "SERVER_PASSWORD",
"default_value": "",
"user_viewable": true,
"user_editable": true,
"rules": "nullable|string",
"field_type": "text"
}
]
}
Loading

0 comments on commit d9eab29

Please sign in to comment.