Browse Source

fixes and comments

pull/1255/head
UltimateByte 9 years ago
committed by GitHub
parent
commit
d368cdb2a8
  1. 29
      lgsm/functions/command_mods_update.sh

29
lgsm/functions/command_mods_update.sh

@ -20,10 +20,16 @@ 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 # If no mods to be updated
echo "${installedmodscount} addons will be updated:" if [ ! -f "${modslockfilefullpath}" ]||[ $installedmodscount -eq 0 ]; then
fn_print_information_nl "No mods or addons to be updated"
echo " * Did you install any mod using LGSM?"
fn_log_info "No mods or addons to be updated"
core_exit.sh
else
fn_print_information_nl "${installedmodscount} mods or addons will be updated:"
fn_log_info "${installedmodscount} mods or addons will be updated"
# Loop showing mods to update # Loop showing mods to update
installedmodsline=1 installedmodsline=1
while [ $installedmodsline -le $installedmodscount ]; do while [ $installedmodsline -le $installedmodscount ]; do
@ -31,27 +37,21 @@ 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 fi
} }
# Recursively list all installed mods and apply update
fn_mods_update_loop(){ fn_mods_update_loop(){
# Reset line value
installedmodline="1" installedmodline="1"
while [ $installedmodsline -le $installedmodscount ]; do while [ $installedmodsline -le $installedmodscount ]; do
# Current line defines current mod command
currentmod="$(sed "${installedmodsline}q;d" "${modslockfilefullpath}")" currentmod="$(sed "${installedmodsline}q;d" "${modslockfilefullpath}")"
fn_mod_get_info_from_command
if [ -n "${currentmod}" ]; then if [ -n "${currentmod}" ]; then
fn_print_dots_nl "Updating ${modprettyname}"
sleep 0.5
fn_script_log "Updating ${modprettyname}."
# Get mod info # Get mod info
fn_mod_get_info_from_command fn_mod_get_info_from_command
# Check if mod is already installed fn_print_dots_nl "Updating ${modprettyname}"
fn_mod_already_installed fn_script_log "Updating ${modprettyname}."
# Check and create required directories # Check and create required directories
fn_mods_dir fn_mods_dir
# Clear lgsm/tmp/mods dir if exists then recreate it # Clear lgsm/tmp/mods dir if exists then recreate it
@ -71,7 +71,6 @@ fn_mods_update_loop(){
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 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

Loading…
Cancel
Save