mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-25 07:48:28 +00:00
Move config file migration to separate install-time script
This commit is contained in:
parent
33b94c63a1
commit
80fd25a33d
@ -168,25 +168,7 @@ if [ "$userinstall" == "yes" ]; then
|
|||||||
|
|
||||||
# Copy arkmanager.cfg to ~/.arkmanager.cfg if it doesn't already exist
|
# Copy arkmanager.cfg to ~/.arkmanager.cfg if it doesn't already exist
|
||||||
if [ -f "${INSTALL_ROOT}${PREFIX}/.arkmanager.cfg" ]; then
|
if [ -f "${INSTALL_ROOT}${PREFIX}/.arkmanager.cfg" ]; then
|
||||||
newopts=( arkbackupdir arkautorestartfile install_bindir install_libexecdir install_datadir mod_appid )
|
bash ./migrate-config.sh "${INSTALL_ROOT}${PREFIX}/.arkmanager.cfg"
|
||||||
newopt_steamcmd_appinfocache="${PREFIX}/Steam/appcache/appinfo.vdf"
|
|
||||||
newopt_arkbackupdir="${PREFIX}/ARK-Backups"
|
|
||||||
newopt_arkautorestartfile="ShooterGame/Saved/.autorestart"
|
|
||||||
newopt_install_bindir="${BINDIR}"
|
|
||||||
newopt_install_libexecdir="${LIBEXECDIR}"
|
|
||||||
newopt_install_datadir="${DATADIR}"
|
|
||||||
newopt_mod_appid=346110
|
|
||||||
|
|
||||||
if grep '^\(servermail\|arkstVersion\)=' "${INSTALL_ROOT}${PREFIX}/.arkmanager.cfg" >/dev/null 2>&1; then
|
|
||||||
sed -i '/^\(servermail\|arkstVersion\)=/d' "${INSTALL_ROOT}${PREFIX}/.arkmanager.cfg"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for optname in "${newopts[@]}"; do
|
|
||||||
if ! grep "^${optname}=" "${INSTALL_ROOT}${PREFIX}/.arkmanager.cfg" >/dev/null 2>&1; then
|
|
||||||
noptname="newopt_${optname}"
|
|
||||||
echo "${optname}='${!noptname}'" >>"${INSTALL_ROOT}${PREFIX}/.arkmanager.cfg"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
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 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 '${INSTALL_ROOT}${PREFIX}/.arkmanager.cfg.NEW'. Make sure to review any changes and update your config accordingly!"
|
echo "A copy of the new configuration file was included in '${INSTALL_ROOT}${PREFIX}/.arkmanager.cfg.NEW'. Make sure to review any changes and update your config accordingly!"
|
||||||
@ -303,25 +285,7 @@ else
|
|||||||
"${INSTALL_ROOT}/etc/arkmanager/arkmanager.cfg.NEW"
|
"${INSTALL_ROOT}/etc/arkmanager/arkmanager.cfg.NEW"
|
||||||
|
|
||||||
if [ -f "${INSTALL_ROOT}/etc/arkmanager/arkmanager.cfg" ]; then
|
if [ -f "${INSTALL_ROOT}/etc/arkmanager/arkmanager.cfg" ]; then
|
||||||
newopts=( arkbackupdir arkautorestartfile install_bindir install_libexecdir install_datadir mod_appid )
|
bash ./migrate-config.sh "${INSTALL_ROOT}/etc/arkmanager/arkmanager.cfg"
|
||||||
newopt_steamcmd_appinfocache="/home/${steamcmd_user}/Steam/appcache/appinfo.vdf"
|
|
||||||
newopt_arkbackupdir="/home/${steamcmd_user}/ARK-Backups"
|
|
||||||
newopt_arkautorestartfile="ShooterGame/Saved/.autorestart"
|
|
||||||
newopt_install_bindir="${BINDIR}"
|
|
||||||
newopt_install_libexecdir="${LIBEXECDIR}"
|
|
||||||
newopt_install_datadir="${DATADIR}"
|
|
||||||
newopt_mod_appid=346110
|
|
||||||
|
|
||||||
if grep '^\(servermail\|arkstVersion\)=' "${INSTALL_ROOT}/etc/arkmanager/arkmanager.cfg" >/dev/null 2>&1; then
|
|
||||||
sed -i '/^\(servermail\|arkstVersion\)=/d' "${INSTALL_ROOT}/etc/arkmanager/arkmanager.cfg"
|
|
||||||
fi
|
|
||||||
|
|
||||||
for optname in "${newopts[@]}"; do
|
|
||||||
if ! grep "^${optname}=" "${INSTALL_ROOT}/etc/arkmanager/arkmanager.cfg" >/dev/null 2>&1; then
|
|
||||||
noptname="newopt_${optname}"
|
|
||||||
echo "${optname}='${!noptname}'" >>"${INSTALL_ROOT}/etc/arkmanager/arkmanager.cfg"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
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 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!"
|
echo "A copy of the new configuration file was included in /etc/arkmanager. Make sure to review any changes and update your config accordingly!"
|
||||||
|
|||||||
23
tools/migrate-config.sh
Executable file
23
tools/migrate-config.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
configfile="$1"
|
||||||
|
newopts=( arkbackupdir arkautorestartfile install_bindir install_libexecdir install_datadir mod_appid )
|
||||||
|
newopt_steamcmd_appinfocache="${PREFIX}/Steam/appcache/appinfo.vdf"
|
||||||
|
newopt_arkbackupdir="${PREFIX}/ARK-Backups"
|
||||||
|
newopt_arkautorestartfile="ShooterGame/Saved/.autorestart"
|
||||||
|
newopt_install_bindir="${BINDIR}"
|
||||||
|
newopt_install_libexecdir="${LIBEXECDIR}"
|
||||||
|
newopt_install_datadir="${DATADIR}"
|
||||||
|
newopt_mod_appid=346110
|
||||||
|
|
||||||
|
if grep '^\(servermail\|arkstVersion\)=' "${configfile}" >/dev/null 2>&1; then
|
||||||
|
sed -i '/^\(servermail\|arkstVersion\)=/d' "${configfile}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
for optname in "${newopts[@]}"; do
|
||||||
|
if ! grep "^${optname}=" "${configfile}" >/dev/null 2>&1; then
|
||||||
|
noptname="newopt_${optname}"
|
||||||
|
echo "${optname}='${!noptname}'" >>"${configfile}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user