mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-17 04:48:26 +00:00
Add script to migrate main instance
This commit is contained in:
parent
61446ab88c
commit
b2ae770b99
@ -182,6 +182,7 @@ if [ "$userinstall" == "yes" ]; then
|
||||
# Copy arkmanager.cfg to ~/.arkmanager.cfg if it doesn't already exist
|
||||
if [ -f "${INSTALL_ROOT}${CONFIGFILE}" ]; then
|
||||
bash ./migrate-config.sh "${INSTALL_ROOT}${CONFIGFILE}"
|
||||
bash ./migrate-main-instance.sh "${INSTALL_ROOT}${CONFIGFILE}" "${INSTALL_ROOT}${INSTANCEDIR}/main.cfg"
|
||||
|
||||
echo "A previous version of ARK Server Tools was detected in your system, your old configuration was not overwritten. You may need to manually update it."
|
||||
echo "A copy of the new configuration file was included in '${CONFIGFILE}.NEW'. Make sure to review any changes and update your config accordingly!"
|
||||
@ -306,6 +307,7 @@ else
|
||||
|
||||
if [ -f "${INSTALL_ROOT}${CONFIGFILE}" ]; then
|
||||
bash ./migrate-config.sh "${INSTALL_ROOT}${CONFIGFILE}"
|
||||
bash ./migrate-main-instance.sh "${INSTALL_ROOT}${CONFIGFILE}" "${INSTALL_ROOT}${INSTANCEDIR}/main.cfg"
|
||||
|
||||
echo "A previous version of ARK Server Tools was detected in your system, your old configuration was not overwritten. You may need to manually update it."
|
||||
echo "A copy of the new configuration file was included in /etc/arkmanager. Make sure to review any changes and update your config accordingly!"
|
||||
|
||||
10
tools/migrate-main-instance.sh
Executable file
10
tools/migrate-main-instance.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
configfile="$1"
|
||||
instancefile="$2"
|
||||
|
||||
if grep "^arkserverroot=" <"$configfile" >/dev/null 2>&1 && [ ! -f "$instancefile" ]; then
|
||||
sed -n '/^#*\(ark\(\|flag\|opt\)_[^=]*\|arkserverroot\|serverMap\(\|ModId\)\)=/p' <"$configfile" >"$instancefile"
|
||||
sed -i '/^ark\(serverroot\|_\(RCONPort\|Port\|QueryPort\)\)=/d' "$configfile"
|
||||
echo 'defaultinstance="main"' >>"$configfile"
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user