Skip to content

Commit c986496

Browse files
committed
feat: support for GTA V Enhanced and the new steam auth
1 parent 32962c4 commit c986496

4 files changed

Lines changed: 39 additions & 15 deletions

File tree

‎games/rockstar/fivem/entrypoint.sh‎

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ echo -e "${Text} Server Port: ${TXHOST_FXS_PORT}"
7474
echo -e "${Text} Max Slots: ${TXHOST_MAX_SLOTS:-unlimited}"
7575

7676
# Auto-update check and download
77-
if [ "${AUTO_UPDATE}" = "1" ]; then
77+
if [ "${AUTO_UPDATE}" = "1" ] && [ ! -f "$(pwd)/alpine/opt/cfx-server/cfx-server" ]; then
7878
echo -e "${Text} ${BLUE}Checking for updates...${NC}"
7979

8080
CFX_CHANGELOGS=$(curl -sSL https://changelogs-live.fivem.net/api/changelog/versions/linux/server 2>/dev/null)
@@ -104,8 +104,23 @@ fi
104104

105105
echo -e "${Text} ${BLUE}Starting FiveM Server...${NC}"
106106

107-
SERVER_BIN_PATH="$(pwd)/alpine/opt/cfx-server/FXServer"
108-
LD_PATH="$(pwd)/alpine/opt/cfx-server/ld-musl-x86_64.so.1"
107+
GAME_BUILD_ARGS=""
108+
STEAM_AUTH_ARGS=""
109+
if [ "${REQUIRE_STEAM_AUTH}" = "1" ]; then
110+
STEAM_AUTH_ARGS="+set sv_enforceSteamAuth true"
111+
fi
112+
if [ -f "$(pwd)/alpine/opt/cfx-server/cfx-server" ]; then
113+
SERVER_BIN_PATH="$(pwd)/alpine/opt/cfx-server/cfx-server"
114+
LD_PATH="$(pwd)/alpine/lib/ld-musl-x86_64.so.1"
115+
LIBRARY_PATH="$(pwd)/alpine/lib/:$(pwd)/alpine/usr/lib/"
116+
else
117+
SERVER_BIN_PATH="$(pwd)/alpine/opt/cfx-server/FXServer"
118+
LD_PATH="$(pwd)/alpine/opt/cfx-server/ld-musl-x86_64.so.1"
119+
LIBRARY_PATH="$(pwd)/alpine/usr/lib/v8/:$(pwd)/alpine/lib/:$(pwd)/alpine/usr/lib/:$(pwd)/alpine/opt/cfx-server/lib/"
120+
if [ -n "${SV_GAMEBUILD}" ]; then
121+
GAME_BUILD_ARGS="+set sv_enforceGameBuild ${SV_GAMEBUILD}"
122+
fi
123+
fi
109124

110125
# Validate binary paths
111126
if [ ! -f "$SERVER_BIN_PATH" ]; then
@@ -127,10 +142,11 @@ fi
127142

128143
# Execute FiveM server
129144
exec "$LD_PATH" \
130-
--library-path "$(pwd)/alpine/usr/lib/v8/:$(pwd)/alpine/lib/:$(pwd)/alpine/usr/lib/:$(pwd)/alpine/opt/cfx-server/lib/" \
145+
--library-path "$LIBRARY_PATH" \
131146
-- "$SERVER_BIN_PATH" \
132147
+set citizen_dir "$(pwd)/alpine/opt/cfx-server/citizen/" \
133148
+set sv_licenseKey ${FIVEM_LICENSE} \
134-
+set steam_webApiKey ${STEAM_WEBAPIKEY} \
135149
+set sv_maxplayers ${MAX_PLAYERS} \
150+
$GAME_BUILD_ARGS \
151+
$STEAM_AUTH_ARGS \
136152
$TXADMIN_ARGS

‎games/rockstar/fivem/recipe.json‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,29 @@
1515
"file_denylist": [],
1616
"startup": "/entrypoint.sh",
1717
"config": {
18-
"files": "{\r\n \"server.cfg\": {\r\n \"parser\": \"file\",\r\n \"find\": {\r\n \"endpoint_add_tcp\": \"endpoint_add_tcp \\\"0.0.0.0:{{server.build.env.TXHOST_FXS_PORT}}\\\"\",\r\n \"endpoint_add_udp\": \"endpoint_add_udp \\\"0.0.0.0:{{server.build.env.TXHOST_FXS_PORT}}\\\"\",\r\n \"sv_hostname\": \"sv_hostname \\\"{{server.build.env.SERVER_HOSTNAME}}\\\"\",\r\n \"set sv_licenseKey\": \"set sv_licenseKey {{server.build.env.FIVEM_LICENSE}}\",\r\n \"set steam_webApiKey\": \"set steam_webApiKey {{server.build.env.STEAM_WEBAPIKEY}}\",\r\n \"sv_maxclients\": \"sv_maxclients {{server.build.env.MAX_PLAYERS}}\",\r\n \"sets sv_projectName\": \"sets sv_projectName \\\"{{server.build.env.SERVER_PNAME}}\\\"\",\r\n \"sets sv_projectDesc\": \"sets sv_projectDesc \\\"{{server.build.env.SERVER_PDESC}}\\\"\"\r\n }\r\n }\r\n}",
18+
"files": "{\n \"server.cfg\": {\n \"parser\": \"file\",\n \"find\": {\n \"endpoint_add_tcp\": \"endpoint_add_tcp \\\"0.0.0.0:{{server.build.env.TXHOST_FXS_PORT}}\\\"\",\n \"endpoint_add_udp\": \"endpoint_add_udp \\\"0.0.0.0:{{server.build.env.TXHOST_FXS_PORT}}\\\"\",\n \"sv_hostname\": \"sv_hostname \\\"{{server.build.env.SERVER_HOSTNAME}}\\\"\",\n \"set sv_licenseKey\": \"set sv_licenseKey {{server.build.env.FIVEM_LICENSE}}\",\n \"sv_maxclients\": \"sv_maxclients {{server.build.env.MAX_PLAYERS}}\",\n \"sets sv_projectName\": \"sets sv_projectName \\\"{{server.build.env.SERVER_PNAME}}\\\"\",\n \"sets sv_projectDesc\": \"sets sv_projectDesc \\\"{{server.build.env.SERVER_PDESC}}\\\"\"\n }\n }\n}",
1919
"startup": "{\r\n \"done\": \"succeeded. Welcome!\"\r\n}",
2020
"logs": "{}",
2121
"stop": "^SIGTERM"
2222
},
2323
"scripts": {
2424
"installation": {
25-
"script": "#!/bin/bash\n# FiveM Installation Script - NodeByte Hosting\n# Server Files: /mnt/server\napt update -y\napt install -y tar xz-utils curl git file jq unzip\n\nmkdir -p /mnt/server\ncd /mnt/server\n\nRELEASE_PAGE=$(curl -sSL https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/)\nCHANGELOGS_PAGE=$(curl -sSL https://changelogs-live.fivem.net/api/changelog/versions/linux/server)\n\nif [ ! -d \"./alpine/\" ] && [ ! -d \"./resources/\" ]; then\n echo \"Beginning installation of new FiveM server.\"\n IS_UPDATE=0\nelse\n echo \"Beginning update of existing FiveM FXServer artifact.\"\n IS_UPDATE=1\n if [ -d \"./alpine/\" ]; then\n echo \"Deleting old FXServer artifact...\"\n rm -rf ./alpine/\n echo \"Deleted old FXServer artifact files successfully.\"\n fi\nfi\n\nif [[ \"${FIVEM_VERSION}\" == \"recommended\" ]] || [[ -z \"${FIVEM_VERSION}\" ]]; then\n DOWNLOAD_LINK=$(echo \"$CHANGELOGS_PAGE\" | jq -r '.recommended_download')\nelif [[ \"${FIVEM_VERSION}\" == \"latest\" ]]; then\n DOWNLOAD_LINK=$(echo \"$CHANGELOGS_PAGE\" | jq -r '.latest_download')\nelif [[ \"${FIVEM_VERSION}\" == http* ]]; then\n DOWNLOAD_LINK=\"${FIVEM_VERSION}\"\nelse\n VERSION_PATH=$(echo \"${RELEASE_PAGE}\" | grep -oE \"build_proot_linux/master/[0-9]+-[a-f0-9]+\\/\" | grep \"${FIVEM_VERSION}\" | head -n 1)\n if [ -n \"${VERSION_PATH}\" ]; then\n DOWNLOAD_LINK=\"https://runtime.fivem.net/artifacts/fivem/${VERSION_PATH}fx.tar.xz\"\n elif [[ \"${FIVEM_VERSION}\" == *\"-\"* ]]; then\n DOWNLOAD_LINK=\"https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/${FIVEM_VERSION}/fx.tar.xz\"\n else\n echo \"Could not resolve build ${FIVEM_VERSION}. Defaulting to recommended.\"\n DOWNLOAD_LINK=$(echo \"$CHANGELOGS_PAGE\" | jq -r '.recommended_download')\n fi\nfi\n\necho -e \"Downloading artifact from: ${DOWNLOAD_LINK}\"\ncurl -sSL \"${DOWNLOAD_LINK}\" -o fx.tar.xz\n\necho \"Extracting FiveM FXServer artifact files...\"\nFILETYPE=$(file -b --mime-type fx.tar.xz)\n\nif [[ \"$FILETYPE\" == *\"x-xz\"* ]] || [[ \"$FILETYPE\" == *\"octet-stream\"* ]]; then\n tar xvf fx.tar.xz\nelif [[ \"$FILETYPE\" == *\"gzip\"* ]]; then\n tar xzvf fx.tar.xz\nelif [[ \"$FILETYPE\" == *\"zip\"* ]]; then\n unzip fx.tar.xz\nelse\n echo -e \"Downloaded artifact of unknown filetype ($FILETYPE). Exiting.\"\n rm -f fx.tar.xz\n exit 2\nfi\n\nrm -f fx.tar.xz run.sh\n\nif [ \"$IS_UPDATE\" -eq 0 ]; then\n if [ -e server.cfg ]; then\n echo \"Server config file already exists. Skipping download of new one.\"\n else\n echo \"Downloading default FiveM server config...\"\n curl -sSL https://raw.githubusercontent.com/nodebytehosting/recipes/develop/games/rockstar/fivem/server.cfg >> server.cfg\n fi\n if [ \"${GIT_ENABLED}\" == \"1\" ] && [ ! -d \"/mnt/server/resources\" ]; then\n echo \"Preparing to clone resources repo from git.\"\n if [[ ${GIT_REPOURL} != *.git ]]; then GIT_REPOURL=${GIT_REPOURL}.git; fi\n if [ -n \"${GIT_USERNAME}\" ] && [ -n \"${GIT_TOKEN}\" ]; then\n GIT_REPOURL=\"https://${GIT_USERNAME}:${GIT_TOKEN}@$(echo ${GIT_REPOURL} | cut -d/ -f3-)\"\n fi\n if [ -z \"${GIT_BRANCH}\" ]; then\n git clone ${GIT_REPOURL} /mnt/server/resources\n else\n git clone --single-branch --branch ${GIT_BRANCH} ${GIT_REPOURL} /mnt/server/resources\n fi\n else\n mkdir -p /mnt/server/resources\n echo \"Preparing to clone default FiveM resources.\"\n git clone https://github.com/citizenfx/cfx-server-data.git /tmp/cfx-resources\n cp -Rf /tmp/cfx-resources/resources/* resources/\n rm -rf /tmp/cfx-resources\n fi\n mkdir -p logs/\n echo \"Installation complete.\"\nelse\n echo \"Update complete.\"\nfi",
25+
"script": "#!/bin/bash\n# FiveM Installation Script - NodeByte Hosting\n# Server Files: /mnt/server\napt update -y\napt install -y tar xz-utils curl git file jq unzip\n\nmkdir -p /mnt/server\ncd /mnt/server\n\nRELEASE_PAGE=$(curl -sSL https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/)\nCHANGELOGS_PAGE=$(curl -sSL https://changelogs-live.fivem.net/api/changelog/versions/linux/server)\n\nif [ ! -d \"./alpine/\" ] && [ ! -d \"./resources/\" ]; then\n echo \"Beginning installation of new FiveM server.\"\n IS_UPDATE=0\nelse\n echo \"Beginning update of existing FiveM FXServer artifact.\"\n IS_UPDATE=1\n if [ -d \"./alpine/\" ]; then\n echo \"Deleting old FXServer artifact...\"\n rm -rf ./alpine/\n echo \"Deleted old FXServer artifact files successfully.\"\n fi\nfi\n\nif [[ \"${GTA_EDITION}\" == \"enhanced\" ]]; then\n if [[ \"${FIVEM_VERSION}\" == http* ]]; then\n DOWNLOAD_LINK=\"${FIVEM_VERSION}\"\n else\n DOWNLOAD_LINK=$(curl -sSL https://docs.fivem.net/docs/server-download/ | grep -oE 'https://cfx-downloads\\.akamaized\\.net/prod/[a-f0-9-]+/cfx-server_linux_x64\\.tar\\.xz' | head -n 1)\n fi\n if [ -z \"${DOWNLOAD_LINK}\" ]; then\n echo \"Could not find the Cfx Server download for GTA V Enhanced. Set the server version to a direct download URL.\"\n exit 1\n fi\nelif [[ \"${FIVEM_VERSION}\" == \"recommended\" ]] || [[ -z \"${FIVEM_VERSION}\" ]]; then\n DOWNLOAD_LINK=$(echo \"$CHANGELOGS_PAGE\" | jq -r '.recommended_download')\nelif [[ \"${FIVEM_VERSION}\" == \"latest\" ]]; then\n DOWNLOAD_LINK=$(echo \"$CHANGELOGS_PAGE\" | jq -r '.latest_download')\nelif [[ \"${FIVEM_VERSION}\" == http* ]]; then\n DOWNLOAD_LINK=\"${FIVEM_VERSION}\"\nelse\n VERSION_PATH=$(echo \"${RELEASE_PAGE}\" | grep -oE \"build_proot_linux/master/[0-9]+-[a-f0-9]+\\/\" | grep \"${FIVEM_VERSION}\" | head -n 1)\n if [ -n \"${VERSION_PATH}\" ]; then\n DOWNLOAD_LINK=\"https://runtime.fivem.net/artifacts/fivem/${VERSION_PATH}fx.tar.xz\"\n elif [[ \"${FIVEM_VERSION}\" == *\"-\"* ]]; then\n DOWNLOAD_LINK=\"https://runtime.fivem.net/artifacts/fivem/build_proot_linux/master/${FIVEM_VERSION}/fx.tar.xz\"\n else\n echo \"Could not resolve build ${FIVEM_VERSION}. Defaulting to recommended.\"\n DOWNLOAD_LINK=$(echo \"$CHANGELOGS_PAGE\" | jq -r '.recommended_download')\n fi\nfi\n\necho -e \"Downloading artifact from: ${DOWNLOAD_LINK}\"\ncurl -sSL \"${DOWNLOAD_LINK}\" -o fx.tar.xz\n\necho \"Extracting FiveM FXServer artifact files...\"\nFILETYPE=$(file -b --mime-type fx.tar.xz)\n\nif [[ \"$FILETYPE\" == *\"x-xz\"* ]] || [[ \"$FILETYPE\" == *\"octet-stream\"* ]]; then\n tar xvf fx.tar.xz\nelif [[ \"$FILETYPE\" == *\"gzip\"* ]]; then\n tar xzvf fx.tar.xz\nelif [[ \"$FILETYPE\" == *\"zip\"* ]]; then\n unzip fx.tar.xz\nelse\n echo -e \"Downloaded artifact of unknown filetype ($FILETYPE). Exiting.\"\n rm -f fx.tar.xz\n exit 2\nfi\n\nrm -f fx.tar.xz run.sh\n\nif [ \"$IS_UPDATE\" -eq 0 ]; then\n if [ -e server.cfg ]; then\n echo \"Server config file already exists. Skipping download of new one.\"\n else\n echo \"Downloading default FiveM server config...\"\n curl -sSL https://raw.githubusercontent.com/nodebytehosting/recipes/develop/games/rockstar/fivem/server.cfg >> server.cfg\n fi\n if [ \"${GIT_ENABLED}\" == \"1\" ] && [ ! -d \"/mnt/server/resources\" ]; then\n echo \"Preparing to clone resources repo from git.\"\n if [[ ${GIT_REPOURL} != *.git ]]; then GIT_REPOURL=${GIT_REPOURL}.git; fi\n if [ -n \"${GIT_USERNAME}\" ] && [ -n \"${GIT_TOKEN}\" ]; then\n GIT_REPOURL=\"https://${GIT_USERNAME}:${GIT_TOKEN}@$(echo ${GIT_REPOURL} | cut -d/ -f3-)\"\n fi\n if [ -z \"${GIT_BRANCH}\" ]; then\n git clone ${GIT_REPOURL} /mnt/server/resources\n else\n git clone --single-branch --branch ${GIT_BRANCH} ${GIT_REPOURL} /mnt/server/resources\n fi\n else\n mkdir -p /mnt/server/resources\n echo \"Preparing to clone default FiveM resources.\"\n git clone https://github.com/citizenfx/cfx-server-data.git /tmp/cfx-resources\n cp -Rf /tmp/cfx-resources/resources/* resources/\n rm -rf /tmp/cfx-resources\n fi\n mkdir -p logs/\n echo \"Installation complete.\"\nelse\n echo \"Update complete.\"\nfi",
2626
"container": "ghcr.io/nodebytehosting/installers:debian",
2727
"entrypoint": "bash"
2828
}
2929
},
3030
"variables": [
31+
{
32+
"name": "GTA V Edition",
33+
"description": "Which version of GTA V this server runs. Players need the matching client: FiveM for Legacy, or FiveM for GTAV Enhanced for Enhanced, and they can't play together. Enhanced is in early access and Legacy assets need converting. Reinstall the server to apply a change.",
34+
"env_variable": "GTA_EDITION",
35+
"default_value": "legacy",
36+
"user_viewable": true,
37+
"user_editable": true,
38+
"rules": "required|in:legacy,enhanced",
39+
"field_type": "text"
40+
},
3141
{
3242
"name": "CFX License Key",
3343
"description": "Required to start the service. Get your keys at https://portal.cfx.re/",
@@ -39,13 +49,13 @@
3949
"field_type": "text"
4050
},
4151
{
42-
"name": "Steam Web Api Key",
43-
"description": "Use your Steam WebApiKey or set to 'none'. Get your key at https://steamcommunity.com/dev/apikey/.",
44-
"env_variable": "STEAM_WEBAPIKEY",
45-
"default_value": "none",
52+
"name": "Require Steam Login",
53+
"description": "Only let players join if their Steam account is linked to their Cfx.re account. Needs server version 38004 or newer.",
54+
"env_variable": "REQUIRE_STEAM_AUTH",
55+
"default_value": "0",
4656
"user_viewable": true,
4757
"user_editable": true,
48-
"rules": "required|string",
58+
"rules": "required|in:1,0",
4959
"field_type": "text"
5060
},
5161
{
@@ -130,7 +140,7 @@
130140
},
131141
{
132142
"name": "FiveM Game Build",
133-
"description": "Sets the sv_enforceGameBuild convar. This specifies the client GTA build the server should be on.\nRead docs for possible values: https://docs.fivem.net/docs/server-manual/server-commands/#sv_enforcegamebuild-build",
143+
"description": "Sets sv_enforceGameBuild on Legacy. Enhanced only supports the latest game build, so this is ignored there.",
134144
"env_variable": "SV_GAMEBUILD",
135145
"default_value": "2944",
136146
"user_viewable": true,

‎games/rockstar/fivem/server.cfg‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ sv_maxclients 48
77

88
# Steam Web API key, if you want to use Steam authentication (https://steamcommunity.com/dev/apikey)
99
# -> replace "" with the key
10-
set steam_webApiKey ""
1110

1211
# License key for your server (https://keymaster.fivem.net)
1312
set sv_licenseKey

‎games/rockstar/redm/server.cfg‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ sv_licenseKey "${TXHOST_DEFAULT_CFXKEY:-${REDM_LICENSE}}"
1515

1616
## Server settings
1717
sv_maxclients ${MAX_PLAYERS:-32}
18-
set steam_webApiKey "none"
1918

2019
## Metadata
2120
sets tags "default, redm"

0 commit comments

Comments
 (0)