From d52f49ba271a92144c13dbf37b1b9af455081756 Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Tue, 25 Feb 2020 23:25:19 +1000 Subject: [PATCH] Add options to overwrite GameUserSettings.ini and Game.ini --- README.asciidoc | 15 +++++++++++++++ tools/arkmanager | 20 ++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/README.asciidoc b/README.asciidoc index b98f98c..a1ec395 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -538,6 +538,21 @@ crash-restart loop if the cause of the crash is not resolved. `arkBackupPreUpdate`:: Set to `true` to enable automatic backups before updating +`arkPreStart`:: + Set to the path to a script to execute on startup if it exists ++ +default: /path/to/instance/config.start + +`arkGameUserSettingsIniFile`:: + Set to the path to an ini file to replace GameUserSettings.ini on startup if it exists ++ +default: /path/to/instance/config.GameUserSettings.ini + +`arkGameIniFile`:: + Set to the path to an ini file to replace Game.ini on startup if it exists ++ +default: /path/to/instance/config.Game.ini + `arkStagingDir`:: Sets the staging directory in order to download updates before shutting down the server diff --git a/tools/arkmanager b/tools/arkmanager index f057e1e..bf86dcc 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -1311,12 +1311,32 @@ doStart() { if [ -n "$serverpid" ] && kill -0 "$serverpid"; then logprint "Start aborted due to server already running - pid: $serverpid" else + local saverootdir="${arkserverroot}/${arkserverdir}/Saved" + local savedcfgdir="${saverootdir}/Config/LinuxServer" local prestart="${configfile%.cfg}.start" + local gusini="${configfile%.cfg}.GameUserSettings.ini" + local gameini="${configfile%.cfg}.Game.ini" + + if [ -n "${arkGameUserSettingsIniFile}" ]; then + gusini="${arkGameUserSettingsIniFile}" + fi + + if [ -n "${arkGameIniFile}" ]; then + gameini="${arkGameIniFile}" + fi if [ -n "${arkPreStart}" ]; then prestart="${arkPreStart}" fi + if [[ -n "${gusini}" && -f "${gusini}" ]]; then + cp "${gusini}" "${savedcfgdir}/GameUserSettings.ini" + fi + + if [[ -n "${gameini}" && -f "${gameini}" ]]; then + cp "${gameini}" "${savedcfgdir}/Game.ini" + fi + if [[ -n "${prestart}" && -f "${prestart}" ]]; then if [ -x "${prestart}" ]; then "${prestart}" "$@"