Add support for acitvating/deactivating multiple mods at once.

This commit is contained in:
Daniel Ceregatti 2023-10-15 11:25:38 -07:00
parent b0596f5e11
commit a3f062799c

View file

@ -336,19 +336,25 @@ config(){
# Activate / Deactivate a mod # Activate / Deactivate a mod
activate(){ activate(){
# W(hich?) a or d
W=${1} W=${1}
# Pop that off so we can loop over the rest
shift shift
# Default values are when activating
WW="" WW=""
COLOR="${green}" COLOR="${green}"
if [[ ${W} = 0 ]] if [[ ${W} = 0 ]]
then then
# Deactivating instead
WW="de" WW="de"
COLOR="${red}" COLOR="${red}"
fi fi
ID=$(get_mod_id ${1} ${W}) # Loop over the rest of the argument(s)
for i in ${@}
do
# Get the mod id and name
ID=$(get_mod_id ${i} ${W})
MODNAME=$(get_mod_name ${ID}) MODNAME=$(get_mod_name ${ID})
# echo "ID: ${ID}, MODNAME: ${MODNAME}"
# exit 0
# Toggle state or report nothing burger # Toggle state or report nothing burger
pushd "${SERVER_PROFILE}" > /dev/null pushd "${SERVER_PROFILE}" > /dev/null
if [[ ${W} = 0 ]] && [ -L "${SERVER_PROFILE}/@${MODNAME}" ] if [[ ${W} = 0 ]] && [ -L "${SERVER_PROFILE}/@${MODNAME}" ]
@ -365,6 +371,7 @@ activate(){
copy_keys ${W} ${ID} copy_keys ${W} ${ID}
echo -e "Mod id ${ID} - ${COLOR}${MODNAME}${default} ${WW}activated" echo -e "Mod id ${ID} - ${COLOR}${MODNAME}${default} ${WW}activated"
popd > /dev/null popd > /dev/null
done
status status
} }
@ -469,6 +476,7 @@ backup(){
mkdir -p ${B} 1> /dev/null mkdir -p ${B} 1> /dev/null
cp -a "${i}" "${B}" cp -a "${i}" "${B}"
done done
cp -a /profiles ${B}
} }
MAP=$(get_map_name) MAP=$(get_map_name)