Browse Source

Various fixes

pull/1255/head
UltimateByte 8 years ago
committed by GitHub
parent
commit
47e8886d0b
  1. 33
      lgsm/functions/command_mods_update.sh

33
lgsm/functions/command_mods_update.sh

@ -3,13 +3,14 @@
# Author: Daniel Gibbs # Author: Daniel Gibbs
# Contributor: UltimateByte # Contributor: UltimateByte
# Website: https://gameservermanagers.com # Website: https://gameservermanagers.com
# Description: Updates installed mods along with mods_list.sh. # Description: Updates installed mods along with mods_list.sh and mods_core.sh.
local commandname="MODS" local commandname="MODS"
local commandaction="Mods Update" local commandaction="Mods Update"
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))" local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
check.sh check.sh
mods_core.sh
mods_list.sh mods_list.sh
fn_mods_update_init(){ fn_mods_update_init(){
@ -19,18 +20,27 @@ fn_mods_update_init(){
echo "" echo ""
# Installed mod dir is "${modslockfilefullpath}" # Installed mod dir is "${modslockfilefullpath}"
# How many mods will be updated # How many mods will be updated
installedmodscount="$(cat "${modslockfilefullpath}" | wc -l)" if [ -f "${modslockfilefullpath}" ]; then
echo "${installedmodscount} addons will be updated:" installedmodscount="$(cat "${modslockfilefullpath}" | wc -l)"
# Loop showing mods to update if
installedmodsline=1 echo "${installedmodscount} addons will be updated:"
while [ $installedmodsline -le $installedmodscount ]; do # Loop showing mods to update
echo -e " * \e[36m$(sed "${installedmodsline}q;d" "${modslockfilefullpath}")\e[0m" installedmodsline=1
let installedmodsline=installedmodsline+1 while [ $installedmodsline -le $installedmodscount ]; do
done echo -e " * \e[36m$(sed "${installedmodsline}q;d" "${modslockfilefullpath}")\e[0m"
sleep 2 let installedmodsline=installedmodsline+1
done
sleep 2
else
fn_print_info_nl "No mods to be updated!"
echo " * Did you install any mod using LGSM?"
fn_print_log "No mods to be updated"
core_exit.sh
fi
} }
fn_mods_update_loop(){ fn_mods_update_loop(){
installedmodline="1"
while [ $installedmodsline -le $installedmodscount ]; do while [ $installedmodsline -le $installedmodscount ]; do
currentmod="$(sed "${installedmodsline}q;d" "${modslockfilefullpath}")" currentmod="$(sed "${installedmodsline}q;d" "${modslockfilefullpath}")"
fn_mod_get_info_from_command fn_mod_get_info_from_command
@ -60,6 +70,8 @@ fn_mods_update_loop(){
fn_clear_tmp_mods fn_clear_tmp_mods
fn_print_ok_nl "${modprettyname} installed." fn_print_ok_nl "${modprettyname} installed."
fn_script_log "${modprettyname} installed." fn_script_log "${modprettyname} installed."
let installedmodsline=installedmodsline+1
else else
fn_print_fail "No mod was selected." fn_print_fail "No mod was selected."
core_exit.sh core_exit.sh
@ -68,3 +80,4 @@ fn_mods_update_loop(){
} }
fn_mods_update_init fn_mods_update_init
fn_mods_update_loop

Loading…
Cancel
Save