mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-19 21:48:29 +00:00
Move steamcmd execution to a helper function
This commit is contained in:
parent
388b8b180d
commit
ffdeafec0c
@ -285,6 +285,13 @@ doBroadcastWithEcho(){
|
|||||||
doBroadcast "$1"
|
doBroadcast "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# SteamCMD helper function
|
||||||
|
#
|
||||||
|
function runSteamCMD(){
|
||||||
|
"$steamcmdroot/$steamcmdexec" +@NoPromptForPassword 1 +login ${steamlogin:-anonymous} "$@" +quit
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check if a new version is available but not apply it
|
# Check if a new version is available but not apply it
|
||||||
#
|
#
|
||||||
@ -364,7 +371,7 @@ function getCurrentVersion(){
|
|||||||
#
|
#
|
||||||
function getAvailableVersion(){
|
function getAvailableVersion(){
|
||||||
rm -f "$steamcmd_appinfocache"
|
rm -f "$steamcmd_appinfocache"
|
||||||
bnumber=`$steamcmdroot/$steamcmdexec +@NoPromptForPassword 1 +login ${steamlogin:-anonymous} +app_info_update 1 +app_info_print "$appid" +quit | while read name val; do if [ "${name}" == "{" ]; then parseSteamACF ".depots.branches.public" "buildid"; break; fi; done`
|
bnumber=`runSteamCMD +app_info_update 1 +app_info_print "$appid" +quit | while read name val; do if [ "${name}" == "{" ]; then parseSteamACF ".depots.branches.public" "buildid"; break; fi; done`
|
||||||
if [ -z "$bnumber" ]; then
|
if [ -z "$bnumber" ]; then
|
||||||
bnumber="Unknown"
|
bnumber="Unknown"
|
||||||
fi
|
fi
|
||||||
@ -659,6 +666,13 @@ doStopAll(){
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# install / update / download update
|
||||||
|
#
|
||||||
|
runSteamCMDAppUpdate(){
|
||||||
|
runSteamCMD +force_install_dir "$1" +app_update $appid $2
|
||||||
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# install of ARK server
|
# install of ARK server
|
||||||
#
|
#
|
||||||
@ -676,7 +690,7 @@ doInstall() {
|
|||||||
|
|
||||||
cd "$steamcmdroot"
|
cd "$steamcmdroot"
|
||||||
# install the server
|
# install the server
|
||||||
./$steamcmdexec +@NoPromptForPassword 1 +login ${steamlogin:-anonymous} +force_install_dir "$arkserverroot" +app_update $appid validate +quit
|
runSteamCMDAppUpdate "$arkserverroot" validate
|
||||||
# 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
|
||||||
}
|
}
|
||||||
@ -812,7 +826,7 @@ doUpdate() {
|
|||||||
|
|
||||||
echo "Downloading ARK update"
|
echo "Downloading ARK update"
|
||||||
cd "$steamcmdroot"
|
cd "$steamcmdroot"
|
||||||
./$steamcmdexec +@NoPromptForPassword 1 +login ${steamlogin:-anonymous} +force_install_dir "$arkStagingDir" +app_update $appid $validate +quit
|
runSteamCMDAppUpdate "$arkStagingDir" $validate
|
||||||
if [ -d "${arkStagingDir}/steamapps/downloading/${appid}" ]; then
|
if [ -d "${arkStagingDir}/steamapps/downloading/${appid}" ]; then
|
||||||
echo "Update download interrupted"
|
echo "Update download interrupted"
|
||||||
return 1
|
return 1
|
||||||
@ -878,7 +892,7 @@ doUpdate() {
|
|||||||
else
|
else
|
||||||
echo "Performing ARK update"
|
echo "Performing ARK update"
|
||||||
cd "$steamcmdroot"
|
cd "$steamcmdroot"
|
||||||
./$steamcmdexec +@NoPromptForPassword 1 +login ${steamlogin:-anonymous} +force_install_dir "$arkserverroot" +app_update $appid $validate +quit
|
runSteamCMDAppUpdate "$arkserverroot" $validate
|
||||||
fi
|
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
|
||||||
@ -928,7 +942,7 @@ doDownloadMod(){
|
|||||||
cd "$steamcmdroot"
|
cd "$steamcmdroot"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
./$steamcmdexec +@NoPromptForPassword 1 +login ${steamlogin:-anonymous} +workshop_download_item $mod_appid $modid +quit
|
runSteamCMD +workshop_download_item $mod_appid $modid
|
||||||
if [ ! -d "$moddldir" ]; then break; fi
|
if [ ! -d "$moddldir" ]; then break; fi
|
||||||
local newsize="`du -s "$moddldir" | cut -f1`"
|
local newsize="`du -s "$moddldir" | cut -f1`"
|
||||||
if [ $newsize -eq $dlsize ]; then break; fi
|
if [ $newsize -eq $dlsize ]; then break; fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user