From 3ea100cc723a11797160f9743303862527e442c0 Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Thu, 26 Jan 2017 21:18:26 +0000 Subject: [PATCH] improvements to script log messages --- lgsm/functions/command_mods_remove.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/lgsm/functions/command_mods_remove.sh b/lgsm/functions/command_mods_remove.sh index adf30adea..7b96503ec 100644 --- a/lgsm/functions/command_mods_remove.sh +++ b/lgsm/functions/command_mods_remove.sh @@ -59,7 +59,7 @@ fn_mod_get_info fn_check_mod_files_list # Uninstall the mod -fn_script_log "Removing ${modsfilelistsize} files from ${modprettyname}" +fn_script_log_info "Removing ${modsfilelistsize} files from ${modprettyname}" echo -e "removing ${modprettyname}" echo -e "* ${modsfilelistsize} files to be removed" echo -e "* location: ${modinstalldir}" @@ -71,10 +71,16 @@ while [ "${modfileline}" -le "${modsfilelistsize}" ]; do # Current line defines current file to remove currentfileremove="$(sed "${modfileline}q;d" "${modsdir}/${modcommand}-files.txt")" # If file or directory exists, then remove it - fn_script_log "Removing: ${modinstalldir}/${currentfileremove}" + if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then rm -rf "${modinstalldir}/${currentfileremove}" ((exitcode=$?)) + if [ ${exitcode} -ne 0 ]; then + fn_script_log_fatal "Removing ${modinstalldir}/${currentfileremove}" + break + else + fn_script_log_pass "Removing ${modinstalldir}/${currentfileremove}" + fi fi tput rc; tput el printf "removing ${modprettyname} ${modfileline} / ${modsfilelistsize} : ${currentfileremove}..." @@ -90,26 +96,29 @@ sleep 0.5 # Remove file list echo -en "removing ${modcommand}-files.txt..." sleep 0.5 -fn_script_log "Removing: ${modsdir}/${modcommand}-files.txt" rm -rf "${modsdir}/${modcommand}-files.txt" local exitcode=$? if [ ${exitcode} -ne 0 ]; then + fn_script_log_fatal "Removing ${modsdir}/${modcommand}-files.txt" fn_print_fail_eol_nl core_exit.sh else + fn_script_log_pass "Removing ${modsdir}/${modcommand}-files.txt" fn_print_ok_eol_nl fi # Remove mods from installed mods list echo -en "removing ${modcommand} from ${modsinstalledlist}..." sleep 0.5 -fn_script_log "Removing: ${modcommand} from ${modsinstalledlist}" + sed -i "/^${modcommand}$/d" "${modsinstalledlistfullpath}" local exitcode=$? if [ ${exitcode} -ne 0 ]; then + fn_script_loga_fatal "Removing ${modcommand} from ${modsinstalledlist}" fn_print_fail_eol_nl core_exit.sh else + fn_script_loga_pass "Removing ${modcommand} from ${modsinstalledlist}" fn_print_ok_eol_nl fi