Browse Source

Various fixes

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

15
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,7 +20,9 @@ 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
if [ -f "${modslockfilefullpath}" ]; then
installedmodscount="$(cat "${modslockfilefullpath}" | wc -l)" installedmodscount="$(cat "${modslockfilefullpath}" | wc -l)"
if
echo "${installedmodscount} addons will be updated:" echo "${installedmodscount} addons will be updated:"
# Loop showing mods to update # Loop showing mods to update
installedmodsline=1 installedmodsline=1
@ -28,9 +31,16 @@ fn_mods_update_init(){
let installedmodsline=installedmodsline+1 let installedmodsline=installedmodsline+1
done done
sleep 2 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