From ac56f438f1363c5b372e50affca7b73171a2afc9 Mon Sep 17 00:00:00 2001 From: Ben Peddell Date: Thu, 1 Sep 2016 20:08:05 +1000 Subject: [PATCH] Allow multiple mods to be installed or uninstalled --- README.asciidoc | 13 ++++++++----- tools/arkmanager | 31 +++++++++++++++++-------------- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/README.asciidoc b/README.asciidoc index 94bcf59..df5559b 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -230,15 +230,18 @@ instances. Installs all mods specified in the instance config into the `ShooterGame/Content/Mods` directory -`installmod `:: - Installs the specified mod into the `ShooterGame/Content/Mods` +`installmod [,[,...]]`:: + Installs the specified mods into the `ShooterGame/Content/Mods` directory -`uninstallmod `:: - Deletes the specified mod from the `ShooterGame/Content/Mods` +`uninstallmod [,[,...]]`:: + Deletes the specified mods from the `ShooterGame/Content/Mods` directory -`reinstallmod `:: +`removemod [,[,...]]`:: + Deletes the specified mods from the SteamCMD workshop directory + +`reinstallmod [,[,...]]`:: Runs the `uninstallmod` command followed by the `installmod` command diff --git a/tools/arkmanager b/tools/arkmanager index cf7f0f0..6c438d7 100755 --- a/tools/arkmanager +++ b/tools/arkmanager @@ -1861,16 +1861,17 @@ doExtractMod(){ # Downloads mod and installs it into mods directory # doInstallMod(){ - local modid=$1 + local modid + for modid in "${1//,/ }"; do + if [ -f "$steamcmdroot/steamapps/workshop/appworkshop_${mod_appid}.acf" ]; then + sed -i "/^\\t\\t\"${modid}\"/,/^\\t\\t}/d" "$steamcmdroot/steamapps/workshop/appworkshop_${mod_appid}.acf" + fi - if [ -f "$steamcmdroot/steamapps/workshop/appworkshop_${mod_appid}.acf" ]; then - sed -i "/^\\t\\t\"${modid}\"/,/^\\t\\t}/d" "$steamcmdroot/steamapps/workshop/appworkshop_${mod_appid}.acf" - fi - - if doDownloadMod $modid; then - doExtractMod $modid - echo "Mod $modid installed" - fi + if doDownloadMod $modid; then + doExtractMod $modid + echo "Mod $modid installed" + fi + done } # @@ -1886,11 +1887,13 @@ doInstallAllMods(){ # Removes mod from mods directory # doUninstallMod(){ - local modid=$1 - local moddir="$arkserverroot/ShooterGame/Content/Mods/$modid" - if [ -d "${moddir}" ]; then - rm -rf "${moddir}" - fi + local modid + for modid in "${1//,/ }"; do + local moddir="$arkserverroot/ShooterGame/Content/Mods/$modid" + if [ -d "${moddir}" ]; then + rm -rf "${moddir}" + fi + done } #