mirror of
https://github.com/eliasstepanik/ark-ac-server-tools.git
synced 2026-01-24 07:28:27 +00:00
Add steamworkshopdir setting
Some steamcmd installs use `SteamApps` instead of `steamapps` in its data directory.
This commit is contained in:
parent
2ca25c6ea6
commit
d0d89f631d
@ -1942,10 +1942,11 @@ checkForModUpdate(){
|
|||||||
local availmft=
|
local availmft=
|
||||||
local modname=
|
local modname=
|
||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop"
|
||||||
local cancheckmodavail=1
|
local cancheckmodavail=1
|
||||||
|
|
||||||
if [ ! -f "$steamdataroot/steamapps/workshop/appworkshop_${mod_appid}.acf" ]; then
|
if [ ! -f "${steamworkshopdir}/appworkshop_${mod_appid}.acf" ]; then
|
||||||
echo "Error: appworkshop_${mod_appid}.acf not found at $steamdataroot/steamapps/workshop"
|
echo "Error: appworkshop_${mod_appid}.acf not found at ${steamworkshopdir}"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -2001,8 +2002,9 @@ getModIds(){
|
|||||||
getLocalModManifest(){
|
getLocalModManifest(){
|
||||||
local modid="$1"
|
local modid="$1"
|
||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
if [ ! -f "$steamdataroot/steamapps/workshop/appworkshop_${mod_appid}.acf" ]; then return 0; fi
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop"
|
||||||
local instmft="$(sed -n '/^\t"WorkshopItemsInstalled"$/,/^\t[}]$/{/^\t\t"'"${modid}"'"$/,/^\t\t[}]$/{s|^\t\t\t"manifest"\t\t"\(.*\)"$|\1|p}}' <"$steamdataroot/steamapps/workshop/appworkshop_${mod_appid}.acf")"}
|
if [ ! -f "${steamworkshopdir}/appworkshop_${mod_appid}.acf" ]; then return 0; fi
|
||||||
|
local instmft="$(sed -n '/^\t"WorkshopItemsInstalled"$/,/^\t[}]$/{/^\t\t"'"${modid}"'"$/,/^\t\t[}]$/{s|^\t\t\t"manifest"\t\t"\(.*\)"$|\1|p}}' <"${steamworkshopdir}/appworkshop_${mod_appid}.acf")"}
|
||||||
echo "$instmft"
|
echo "$instmft"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2022,7 +2024,8 @@ isModUpdateAvailable(){
|
|||||||
local instmft="$(getLocalModManifest "$modid")"
|
local instmft="$(getLocalModManifest "$modid")"
|
||||||
local remmft="$(getAvailModManifest "$modid")"
|
local remmft="$(getAvailModManifest "$modid")"
|
||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
if [ ! -f "$steamdataroot/steamapps/workshop/appworkshop_${mod_appid}.acf" ]; then return 0; fi
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop"
|
||||||
|
if [ ! -f "${steamworkshopdir}/appworkshop_${mod_appid}.acf" ]; then return 0; fi
|
||||||
if [[ -n "${remmft}" && "${instmft}" != "${remmft}" ]]; then
|
if [[ -n "${remmft}" && "${instmft}" != "${remmft}" ]]; then
|
||||||
return 0 # true
|
return 0 # true
|
||||||
fi
|
fi
|
||||||
@ -2040,8 +2043,9 @@ doDownloadMod(){
|
|||||||
fi
|
fi
|
||||||
doDownloadSteamCMD
|
doDownloadSteamCMD
|
||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
local modsrcdir="$steamdataroot/steamapps/workshop/content/$mod_appid/$modid"
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop"
|
||||||
local moddldir="$steamdataroot/steamapps/workshop/downloads/$mod_appid"
|
local modsrcdir="${steamworkshopdir}/content/$mod_appid/$modid"
|
||||||
|
local moddldir="${steamworkshopdir}/downloads/$mod_appid"
|
||||||
cd "$steamcmdroot"
|
cd "$steamcmdroot"
|
||||||
retries=10
|
retries=10
|
||||||
|
|
||||||
@ -2113,7 +2117,8 @@ doDownloadAllMods(){
|
|||||||
isModUpdateNeeded(){
|
isModUpdateNeeded(){
|
||||||
local modid=$1
|
local modid=$1
|
||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
local modsrcdir="$steamdataroot/steamapps/workshop/content/$mod_appid/$modid"
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop"
|
||||||
|
local modsrcdir="${steamworkshopdir}/content/$mod_appid/$modid"
|
||||||
local moddestdir="$arkserverroot/ShooterGame/Content/Mods/$modid"
|
local moddestdir="$arkserverroot/ShooterGame/Content/Mods/$modid"
|
||||||
local modbranch="${mod_branch:-Windows}"
|
local modbranch="${mod_branch:-Windows}"
|
||||||
|
|
||||||
@ -2161,7 +2166,8 @@ isModUpdateNeeded(){
|
|||||||
getModName(){
|
getModName(){
|
||||||
local modid=$1
|
local modid=$1
|
||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
local modsrcdir="$steamdataroot/steamapps/workshop/content/$mod_appid/$modid"
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop"
|
||||||
|
local modsrcdir="${steamworkshopdir}/content/$mod_appid/$modid"
|
||||||
|
|
||||||
if [ -n "${modsrcdirs[$modid]}" ]; then
|
if [ -n "${modsrcdirs[$modid]}" ]; then
|
||||||
modsrcdir="${modsrcdirs[$modid]}"
|
modsrcdir="${modsrcdirs[$modid]}"
|
||||||
@ -2207,7 +2213,8 @@ isAnyModUpdateNeeded(){
|
|||||||
doExtractMod(){
|
doExtractMod(){
|
||||||
local modid=$1
|
local modid=$1
|
||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
local modsrcdir="$steamdataroot/steamapps/workshop/content/$mod_appid/$modid"
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop"
|
||||||
|
local modsrcdir="${steamworkshopdir}/content/$mod_appid/$modid"
|
||||||
local moddestdir="$arkserverroot/ShooterGame/Content/Mods/$modid"
|
local moddestdir="$arkserverroot/ShooterGame/Content/Mods/$modid"
|
||||||
local modextractdir="$moddestdir"
|
local modextractdir="$moddestdir"
|
||||||
local modbranch="${mod_branch:-Windows}"
|
local modbranch="${mod_branch:-Windows}"
|
||||||
@ -2389,10 +2396,11 @@ doExtractMod(){
|
|||||||
doInstallMod(){
|
doInstallMod(){
|
||||||
local modid
|
local modid
|
||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop"
|
||||||
for modid in "${1//,/ }"; do
|
for modid in "${1//,/ }"; do
|
||||||
if [[ " $* " =~ *" --validate " ]]; then
|
if [[ " $* " =~ *" --validate " ]]; then
|
||||||
if [ -f "$steamdataroot/steamapps/workshop/appworkshop_${mod_appid}.acf" ]; then
|
if [ -f "${steamworkshopdir}/appworkshop_${mod_appid}.acf" ]; then
|
||||||
sed -i "/^\\t\\t\"${modid}\"/,/^\\t\\t}/d" "$steamdataroot/steamapps/workshop/appworkshop_${mod_appid}.acf"
|
sed -i "/^\\t\\t\"${modid}\"/,/^\\t\\t}/d" "${steamworkshopdir}/appworkshop_${mod_appid}.acf"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -2477,17 +2485,18 @@ doDisableMod(){
|
|||||||
doRemoveMods(){
|
doRemoveMods(){
|
||||||
local modid
|
local modid
|
||||||
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
local steamdataroot="${steamdataroot:-${steamcmdroot}}"
|
||||||
|
local steamworkshopdir="${steamworkshopdir:-${steamdataroot}/steamapps/workshop"
|
||||||
for modid in ${1//,/ }; do
|
for modid in ${1//,/ }; do
|
||||||
if [ -f "$steamdataroot/steamapps/workshop/appworkshop_${mod_appid}.acf" ]; then
|
if [ -f "${steamworkshopdir}/appworkshop_${mod_appid}.acf" ]; then
|
||||||
sed -i "/^\\t\\t\"${modid}\"/,/^\\t\\t}/d" "$steamdataroot/steamapps/workshop/appworkshop_${mod_appid}.acf"
|
sed -i "/^\\t\\t\"${modid}\"/,/^\\t\\t}/d" "${steamworkshopdir}/appworkshop_${mod_appid}.acf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$steamdataroot/steamapps/workshop/content/${mod_appid}/${modid}" ]; then
|
if [ -d "${steamworkshopdir}/content/${mod_appid}/${modid}" ]; then
|
||||||
rm -rf "$steamdataroot/steamapps/workshop/content/${mod_appid}/${modid}"
|
rm -rf "${steamworkshopdir}/content/${mod_appid}/${modid}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d "$steamdataroot/steamapps/workshop/downloads/${mod_appid}/${modid}" ]; then
|
if [ -d "${steamworkshopdir}/downloads/${mod_appid}/${modid}" ]; then
|
||||||
rm -rf "$steamdataroot/steamapps/workshop/downloads/${mod_appid}/${modid}"
|
rm -rf "${steamworkshopdir}/downloads/${mod_appid}/${modid}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user