From 216c29d0e5a68b6de87965571ebf645201faa22b Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Wed, 29 Apr 2020 22:35:11 +0100 Subject: [PATCH] fix(arkserver): remove all appworkshop_346110.acf if multiple exist (#2852) --- lgsm/functions/command_validate.sh | 2 + lgsm/functions/fix_ark.sh | 78 ++++++++++++++++-------------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/lgsm/functions/command_validate.sh b/lgsm/functions/command_validate.sh index 410d1eb4d..09b7f23b7 100644 --- a/lgsm/functions/command_validate.sh +++ b/lgsm/functions/command_validate.sh @@ -90,3 +90,5 @@ if [ "${status}" != "0" ]; then else fn_validate fi + +core_exit.sh diff --git a/lgsm/functions/fix_ark.sh b/lgsm/functions/fix_ark.sh index b9cc17e9a..67e20d495 100644 --- a/lgsm/functions/fix_ark.sh +++ b/lgsm/functions/fix_ark.sh @@ -4,44 +4,52 @@ # Website: https://linuxgsm.com # Description: Resolves various issues with ARK: Survival Evolved. -# Steam mods directory selecter -# This allows LinxuGSM to select either ~/.steam or ~/Steam. depending on what is being used - -steamappsfile=$(find ${HOME} -name appworkshop_346110.acf) -steamappsdir=$(dirname "${steamappsfile}") -steamappspath=$(cd ${steamappsdir};cd ../;pwd) - -# removes the symlink if exists. -# fixes issue with older versions of LinuxGSM linking to /home/arkserver/steamcmd -if [ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]; then - fixname="broken SteamCMD symlink" +# removes mulitple appworkshop_346110.acf if found. +steamappsfilewc=$(find ${HOME} -name appworkshop_346110.acf | wc -l) +if [ "${steamappsfilewc}" -gt "1" ]; then + fixname="multiple appworkshop acf files" fn_fix_msg_start - unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux" + find ${HOME} -name appworkshop_346110.acf -exec rm -f {} \; fn_fix_msg_end - check_steamcmd.sh -fi +elif [ "${steamappsfilewc}" -eq "1" ]; then + # Steam mods directory selecter + # This allows LinxuGSM to select either ~/.steam or ~/Steam. depending on what is being used + steamappsfile=$(find ${HOME} -name appworkshop_346110.acf) + steamappsdir=$(dirname "${steamappsfile}") + steamappspath=$(cd "${steamappsdir}"|| return; cd ../;pwd) -# removed ARK steamcmd directory if steamcmd is missing. -if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then - fixname="remove invalid ARK SteamCMD directory" - fn_fix_msg_start - rm -rf "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux" - fn_fix_msg_end - check_steamcmd.sh -fi + # removes the symlink if exists. + # fixes issue with older versions of LinuxGSM linking to /home/arkserver/steamcmd + if [ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]; then + fixname="broken SteamCMD symlink" + fn_fix_msg_start + unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux" + fn_fix_msg_end + check_steamcmd.sh + fi -# if the steamapps symlink is incorrect unlink it. -if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]&&[ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]&&[ "$(readlink ${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps)" != "${steamappspath}" ]; then - fixname="incorrect steamapps symlink" - fn_fix_msg_start - unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" - fn_fix_msg_end -fi + # removed ARK steamcmd directory if steamcmd is missing. + if [ ! -f "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamcmd.sh" ]; then + fixname="remove invalid ARK SteamCMD directory" + fn_fix_msg_start + rm -rf "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux" + fn_fix_msg_end + check_steamcmd.sh + fi -# Put symlink to steamapps directory into the ARK SteamCMD directory to link the downloaded mods to the correct location. -if [ ! -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]; then - fixname="steamapps symlink" - fn_fix_msg_start - ln -s "${steamappspath}" "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" - fn_fix_msg_end + # if the steamapps symlink is incorrect unlink it. + if [ -d "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux" ]&&[ -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]&&[ "$(readlink ${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps)" != "${steamappspath}" ]; then + fixname="incorrect steamapps symlink" + fn_fix_msg_start + unlink "${serverfiles:?}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" + fn_fix_msg_end + fi + + # Put symlink to steamapps directory into the ARK SteamCMD directory to link the downloaded mods to the correct location. + if [ ! -L "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" ]; then + fixname="steamapps symlink" + fn_fix_msg_start + ln -s "${steamappspath}" "${serverfiles}/Engine/Binaries/ThirdParty/SteamCMD/Linux/steamapps" + fn_fix_msg_end + fi fi