Allow multiple mods to be installed or uninstalled

This commit is contained in:
Ben Peddell 2016-09-01 20:08:05 +10:00
parent a46ef5ad23
commit ac56f438f1
2 changed files with 25 additions and 19 deletions

View File

@ -230,15 +230,18 @@ instances.
Installs all mods specified in the instance config into the
`ShooterGame/Content/Mods` directory
`installmod <modnum>`::
Installs the specified mod into the `ShooterGame/Content/Mods`
`installmod <modnum>[,<modnum>[,...]]`::
Installs the specified mods into the `ShooterGame/Content/Mods`
directory
`uninstallmod <modnum>`::
Deletes the specified mod from the `ShooterGame/Content/Mods`
`uninstallmod <modnum>[,<modnum>[,...]]`::
Deletes the specified mods from the `ShooterGame/Content/Mods`
directory
`reinstallmod <modnum>`::
`removemod <modnum>[,<modnum>[,...]]`::
Deletes the specified mods from the SteamCMD workshop directory
`reinstallmod <modnum>[,<modnum>[,...]]`::
Runs the `uninstallmod` command followed by the `installmod`
command

View File

@ -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
}
#