mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-24 15:38:26 +00:00
Add --revstatus option to checkmodupdate
Use --revstatus to reverse the return status, and provide extra codes for errors: * 0 = no updates available * 1 = an update is available * 2 = one or more mods don't exist on the workshop * 3 = appworkshop_xxx.acf is missing * 4 = SteamCMD workshop dir doesn't exist
This commit is contained in:
parent
3975d3b6c4
commit
dc0838dc97
@ -1944,26 +1944,41 @@ checkForModUpdate(){
|
|||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop}"
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop}"
|
||||||
local cancheckmodavail=1
|
local cancheckmodavail=1
|
||||||
|
local modmissing=
|
||||||
|
local revstatcode=
|
||||||
|
|
||||||
|
if [[ " $* " =~ " --revstatus " ]]; then
|
||||||
|
revstatcode=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d "${steamworkshopdir}" ]; then
|
||||||
|
echo "Error: ${steamworkshopdir} does not exist"
|
||||||
|
if [ -n "$revstatcode" ]; then return 4; else return 0; fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f "${steamworkshopdir}/appworkshop_${mod_appid}.acf" ]; then
|
if [ ! -f "${steamworkshopdir}/appworkshop_${mod_appid}.acf" ]; then
|
||||||
echo "Error: appworkshop_${mod_appid}.acf not found at ${steamworkshopdir}"
|
echo "Error: appworkshop_${mod_appid}.acf not found at ${steamworkshopdir}"
|
||||||
return 1
|
cancheckmodavail=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for modid in $(getModIds); do
|
for modid in $(getModIds); do
|
||||||
instmft="$(getLocalModManifest "$modid")"
|
|
||||||
availmft="$(getAvailModManifest "$modid")"
|
availmft="$(getAvailModManifest "$modid")"
|
||||||
modname="$(getModName $modid)"
|
modname="$(getModName $modid)"
|
||||||
if [ -z "$availmft" ]; then
|
if [ -z "$availmft" ]; then
|
||||||
printf "Mod %d doesn't exist in the steam workshop\n" "$modid"
|
printf "Mod %d doesn't exist in the steam workshop\n" "$modid"
|
||||||
elif [ -z "$instmft" ]; then
|
modmissing=1
|
||||||
printf "Mod %d [%s] has not been downloaded\n" "$modid" "$modname"
|
elif [ -n "$cancheckmodavail" ]; then
|
||||||
updateavail=1
|
instmft="$(getLocalModManifest "$modid")"
|
||||||
elif [ "$availmft" != "$instmft" ]; then
|
if [ -z "$instmft" ]; then
|
||||||
printf "Mod %d [%s] has been updated on the Steam workshop\n" "$modid" "$modname"
|
printf "Mod %d [%s] has not been downloaded\n" "$modid" "$modname"
|
||||||
printf "Local manifest: %s\nSteam manifest: %s\n" "$instmft" "$availmft"
|
updateavail=1
|
||||||
updateavail=1
|
elif [ "$availmft" != "$instmft" ]; then
|
||||||
elif [ ! -d "$arkserverroot/ShooterGame/Content/Mods/$modid" ]; then
|
printf "Mod %d [%s] has been updated on the Steam workshop\n" "$modid" "$modname"
|
||||||
|
printf "Local manifest: %s\nSteam manifest: %s\n" "$instmft" "$availmft"
|
||||||
|
updateavail=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ! -d "$arkserverroot/ShooterGame/Content/Mods/$modid" ]; then
|
||||||
printf "Mod %d [%s] is not installed\n" "$modid" "$modname"
|
printf "Mod %d [%s] is not installed\n" "$modid" "$modname"
|
||||||
updateavail=1
|
updateavail=1
|
||||||
elif isModUpdateNeeded $modid; then
|
elif isModUpdateNeeded $modid; then
|
||||||
@ -1973,9 +1988,13 @@ checkForModUpdate(){
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [ -n "$updateavail" ]; then
|
if [ -n "$updateavail" ]; then
|
||||||
return 0
|
if [ -n "$revstatcode" ]; then return 1; else return 0; fi
|
||||||
|
elif [ -z "$cancheckmodavail" ]; then
|
||||||
|
if [ -n "$revstatcode" ]; then return 3; else return 0; fi
|
||||||
|
elif [ -n "$modmissing" ]; then
|
||||||
|
return 2
|
||||||
else
|
else
|
||||||
return 1
|
if [ -n "$revstatcode" ]; then return 0; else return 1; fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3243,7 +3262,7 @@ main(){
|
|||||||
checkForUpdate
|
checkForUpdate
|
||||||
;;
|
;;
|
||||||
checkmodupdate)
|
checkmodupdate)
|
||||||
checkForModUpdate
|
checkForModUpdate "${options[@]}"
|
||||||
;;
|
;;
|
||||||
installmod)
|
installmod)
|
||||||
doInstallMod "${args[@]}"
|
doInstallMod "${args[@]}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user