mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-23 06:58:28 +00:00
Add support for downloading updates before applying
This commit is contained in:
parent
cac3f38aab
commit
130d665f1a
@ -749,6 +749,7 @@ doUpdate() {
|
|||||||
local validate=
|
local validate=
|
||||||
local modupdate=
|
local modupdate=
|
||||||
local saveworld=
|
local saveworld=
|
||||||
|
local downloadonly=
|
||||||
|
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
if [ "$arg" == "--force" ]; then
|
if [ "$arg" == "--force" ]; then
|
||||||
@ -766,6 +767,10 @@ doUpdate() {
|
|||||||
modupdate=1
|
modupdate=1
|
||||||
elif [ "$arg" == "--backup" ]; then
|
elif [ "$arg" == "--backup" ]; then
|
||||||
arkBackupPreUpdate=true
|
arkBackupPreUpdate=true
|
||||||
|
elif [ "$arg" =~ "^--stagingdir=" ]; then
|
||||||
|
arkStagingDir="${ark#--stagingdir=}"
|
||||||
|
elif [ "$arg" == "--downloadonly" ]; then
|
||||||
|
downloadonly=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -782,9 +787,37 @@ doUpdate() {
|
|||||||
|
|
||||||
if isUpdateNeeded; then
|
if isUpdateNeeded; then
|
||||||
appupdate=1
|
appupdate=1
|
||||||
|
|
||||||
|
if [ -n "${arkStagingDir}" -a "${arkStagingDir}" != "${arkserverroot}" ]; then
|
||||||
|
if [ ! -d "$arkStagingDir/ShooterGame" ]; then
|
||||||
|
cp -al "$arkserverroot/ShooterGame/." "$arkStagingDir/ShooterGame"
|
||||||
|
cp -al "$arkserverroot/Engine/." "$arkStagingDir/Engine"
|
||||||
|
cp -al "$arkserverroot/linux64/." "$arkStagingDir/linux64"
|
||||||
|
cp -al "$arkserverroot/PackageInfo.bin" "$arkStagingDir/PackageInfo.bin"
|
||||||
|
cp -al "$arkserverroot/steamclient.so" "$arkStagingDir/steamclient.so"
|
||||||
|
cp -a "$arkserverroot/steamapps/." "$arkStagingDir/steamapps"
|
||||||
|
rm -rf "$arkStagingDir/ShooterGame/Content/Mods/"*
|
||||||
|
rm -rf "$arkStagingDir/ShooterGame/Saved/"*
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "$steamcmdroot"
|
||||||
|
./$steamcmdexec +@NoPromptForPassword 1 +login ${steamlogin:-anonymous} +force_install_dir "$arkStagingDir" +app_update $appid $validate +quit
|
||||||
|
if [ -d "${arkStagingDir}/steamapps/downloading/${appid}" ]; then
|
||||||
|
echo "Update download interrupted"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$appupdate" -o -n "$modupdate" ]; then
|
if [ -n "$downloadonly" ]; then
|
||||||
|
if [ -n "$appupdate" -a -n "$arkStagingDir" -a "$arkStagingDir" != "$arkserverroot" ]; then
|
||||||
|
echo "Server update downloaded"
|
||||||
|
fi
|
||||||
|
if [ -n "$modupdate" ]; then
|
||||||
|
echo "Mod update downloaded"
|
||||||
|
fi
|
||||||
|
echo "Not applying update - download-only enabled"
|
||||||
|
elif [ -n "$appupdate" -o -n "$modupdate" ]; then
|
||||||
if isTheServerRunning; then
|
if isTheServerRunning; then
|
||||||
if [ "$updatetype" == "safe" ]; then
|
if [ "$updatetype" == "safe" ]; then
|
||||||
while [ ! `find $arkserverroot/ShooterGame/Saved/SavedArks -mmin -1 -name ${serverMap##*/}.ark` ]; do
|
while [ ! `find $arkserverroot/ShooterGame/Saved/SavedArks -mmin -1 -name ${serverMap##*/}.ark` ]; do
|
||||||
@ -819,8 +852,17 @@ doUpdate() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$appupdate" ]; then
|
if [ -n "$appupdate" ]; then
|
||||||
cd "$steamcmdroot"
|
if [ -d "${arkStagingDir}" -a "${arkStagingDir}" != "${arkserverroot}" ]; then
|
||||||
./$steamcmdexec +@NoPromptForPassword 1 +login ${steamlogin:-anonymous} +force_install_dir "$arkserverroot" +app_update $appid $validate +quit
|
cp -alu --remove-destination "$arkStagingDir/ShooterGame/." "$arkserverroot/ShooterGame"
|
||||||
|
cp -alu --remove-destination "$arkStagingDir/Engine/." "$arkserverroot/Engine"
|
||||||
|
cp -alu --remove-destination "$arkStagingDir/linux64/." "$arkserverroot/linux64"
|
||||||
|
cp -alu --remove-destination "$arkStagingDir/PackageInfo.bin" "$arkserverroot/PackageInfo.bin"
|
||||||
|
cp -alu --remove-destination "$arkStagingDir/steamclient.so" "$arkserverroot/steamclient.so"
|
||||||
|
cp -au --remove-destination "$arkStagingDir/steamapps/." "$arkserverroot/steamapps"
|
||||||
|
else
|
||||||
|
cd "$steamcmdroot"
|
||||||
|
./$steamcmdexec +@NoPromptForPassword 1 +login ${steamlogin:-anonymous} +force_install_dir "$arkserverroot" +app_update $appid $validate +quit
|
||||||
|
fi
|
||||||
# the current version should be the last version. We set our version
|
# the current version should be the last version. We set our version
|
||||||
getCurrentVersion
|
getCurrentVersion
|
||||||
echo "`timestamp`: update to $instver complete" >> "$logdir/update.log"
|
echo "`timestamp`: update to $instver complete" >> "$logdir/update.log"
|
||||||
@ -1365,13 +1407,15 @@ while true; do
|
|||||||
echo "useconfig <name> Use the configuration overrides in the specified config name or file"
|
echo "useconfig <name> Use the configuration overrides in the specified config name or file"
|
||||||
echo
|
echo
|
||||||
echo "Update command takes the below options:"
|
echo "Update command takes the below options:"
|
||||||
echo " --force Apply update without checking the current version"
|
echo " --force Apply update without checking the current version"
|
||||||
echo " --safe Wait for server to perform world save and update."
|
echo " --safe Wait for server to perform world save and update."
|
||||||
echo " --warn Warn players before updating server"
|
echo " --warn Warn players before updating server"
|
||||||
echo " --validate Validates all ARK server files"
|
echo " --validate Validates all ARK server files"
|
||||||
echo " --saveworld Saves world before update"
|
echo " --saveworld Saves world before update"
|
||||||
echo " --update-mods Updates installed and requested mods"
|
echo " --update-mods Updates installed and requested mods"
|
||||||
echo " --backup Takes a backup of the save files before updating"
|
echo " --backup Takes a backup of the save files before updating"
|
||||||
|
echo " --downloadonly Download the mod and/or server update without applying it"
|
||||||
|
echo " Requires arkStagingDir be set to a staging directory on the same filesystem as the server"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@ -18,6 +18,7 @@ arkwarnminutes="60" # number of
|
|||||||
arkautorestartfile="ShooterGame/Saved/.autorestart" # path to autorestart file
|
arkautorestartfile="ShooterGame/Saved/.autorestart" # path to autorestart file
|
||||||
arkBackupPreUpdate="false" # set this to true if you want to perform a backup before updating
|
arkBackupPreUpdate="false" # set this to true if you want to perform a backup before updating
|
||||||
arkTimeToKeepBackupFiles="10" #Set to Automatically Remove backups older than n days
|
arkTimeToKeepBackupFiles="10" #Set to Automatically Remove backups older than n days
|
||||||
|
#arkStagingDir="/home/steam/ARK-Staging" # Uncomment to enable downloading updates before restarting the server
|
||||||
|
|
||||||
# Update warning messages
|
# Update warning messages
|
||||||
# Modify as desired, putting the %d replacement operator where the number belongs
|
# Modify as desired, putting the %d replacement operator where the number belongs
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user