GameServerManagers / LinuxGSM

The command-line tool for quick, simple deployment and management of Linux dedicated game servers.
https://linuxgsm.com
MIT License
4.18k stars 801 forks source link

[Feature]: DayZ Workshop Auto-Update #4535

Open Sou-ei opened 3 months ago

Sou-ei commented 3 months ago

User story

would be cool if the dayz server gets support for workshop mods with autoupdates

Game

DayZ

Linux distro

Ubuntu 22.04

Command

command: mods-install, command: mods-update, command: mods-remove

Further information

Mods are currently not supported

whytf commented 2 months ago

+1

whytf commented 2 months ago

For the time being i have scripted a simple version of this feature, at this time it only handles downloading, copying files & keys, however it could help in future development:

MOD_LIST="$HOME/serverfiles/modlist.txt" KEYS_DEST="$HOME/serverfiles" STEAMCMD_EXE="$HOME/.steam/steamcmd/steamcmd.sh" WORKSHOP_PATH="$HOME/.local/share/Steam/steamapps/workshop/content/221100" steamuser=$(grep "steamuser" $HOME/lgsm/config-lgsm/dayzserver/common.cfg | cut -d'"' -f2) steampass=$(grep "steampass" $HOME/lgsm/config-lgsm/dayzserver/common.cfg | cut -d'"' -f2)

if [ ! -f "${MOD_LIST}" ]; then echo "Error: modlist.txt not found." fi

while IFS= read -r line || [[ -n "$line" ]]; do ID=$(echo "$line" | cut -d',' -f1) ${STEAMCMD_EXE} +login "${steamuser}" "${steampass}" +workshop_download_item 221100 "${ID}" +quit done < "${MOD_LIST}"

while IFS= read -r line || [[ -n "$line" ]]; do ID=$(echo "$line" | cut -d',' -f1) ModName=$(echo "$line" | cut -d',' -f2)

if [ -d "$HOME/serverfiles/${ModName}" ]; then
    rm -rf "$HOME/serverfiles/${ModName}"
fi

cp -r "${WORKSHOP_PATH}/${ID}" "$HOME/serverfiles/${ModName}"

if [ -d "$HOME/serverfiles/${ModName}/keys" ]; then
    cp -r "$HOME/serverfiles/${ModName}/keys" "${KEYS_DEST}"
fi

done < "${MOD_LIST}"

echo "Mod folders copied and renamed successfully."