|
@@ -19,7 +19,6 @@ fn_mods_remove_init(){
|
|
|
# A simple function to exit if no mods were installed
|
|
# A simple function to exit if no mods were installed
|
|
|
# Also returns ${installedmodscount} if mods were found
|
|
# Also returns ${installedmodscount} if mods were found
|
|
|
fn_mods_exit_if_not_installed
|
|
fn_mods_exit_if_not_installed
|
|
|
- echo ""
|
|
|
|
|
# Displays installed addons to the user
|
|
# Displays installed addons to the user
|
|
|
fn_installed_mods_medium_list
|
|
fn_installed_mods_medium_list
|
|
|
echo ""
|
|
echo ""
|
|
@@ -30,12 +29,12 @@ fn_mods_remove_init(){
|
|
|
# Exit if user says exit or abort
|
|
# Exit if user says exit or abort
|
|
|
if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
|
|
if [ "${usermodselect}" == "exit" ]||[ "${usermodselect}" == "abort" ]; then
|
|
|
core_exit.sh
|
|
core_exit.sh
|
|
|
- # Supplementary output upon invalid user input
|
|
|
|
|
|
|
+ # Supplementary output upon invalid user input
|
|
|
elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
|
|
elif [[ ! " ${availablemodscommands[@]} " =~ " ${usermodselect} " ]]; then
|
|
|
fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
|
|
fn_print_error2_nl "${usermodselect} is not a valid addon/mod."
|
|
|
fi
|
|
fi
|
|
|
done
|
|
done
|
|
|
- fn_print_warning_nl "You are about to remove ${usermodselect}."
|
|
|
|
|
|
|
+ fn_print_warning_nl "You are about to remove ${cyan}${usermodselect}${default}."
|
|
|
echo " * Any custom files/configuration will be removed."
|
|
echo " * Any custom files/configuration will be removed."
|
|
|
while true; do
|
|
while true; do
|
|
|
read -e -i "y" -p "Continue? [Y/n]" yn
|
|
read -e -i "y" -p "Continue? [Y/n]" yn
|
|
@@ -44,40 +43,77 @@ fn_mods_remove_init(){
|
|
|
[Nn]* ) echo Exiting; exit;;
|
|
[Nn]* ) echo Exiting; exit;;
|
|
|
* ) echo "Please answer yes or no.";;
|
|
* ) echo "Please answer yes or no.";;
|
|
|
esac
|
|
esac
|
|
|
- done
|
|
|
|
|
|
|
+ done
|
|
|
# Gives a pretty name to the user and get all mod info
|
|
# Gives a pretty name to the user and get all mod info
|
|
|
currentmod="${usermodselect}"
|
|
currentmod="${usermodselect}"
|
|
|
fn_mod_get_info_from_command
|
|
fn_mod_get_info_from_command
|
|
|
# Check file list in order to make sure we're able to remove the mod (returns ${modsfilelistsize})
|
|
# Check file list in order to make sure we're able to remove the mod (returns ${modsfilelistsize})
|
|
|
fn_check_files_list
|
|
fn_check_files_list
|
|
|
- fn_script_log "Removing ${modsfilelistsize} files from ${modprettyname}"
|
|
|
|
|
- fn_print_dots "Removing ${modsfilelistsize} files from ${modprettyname}"
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
# Uninstall the mod
|
|
# Uninstall the mod
|
|
|
fn_mod_remove_process(){
|
|
fn_mod_remove_process(){
|
|
|
|
|
+ fn_script_log "Removing ${modsfilelistsize} files from ${modprettyname}"
|
|
|
|
|
+ echo -e "removing ${modprettyname}"
|
|
|
|
|
+ echo -e "* ${modsfilelistsize} files to be removed"
|
|
|
|
|
+ echo -e "* location: ${modinstalldir}"
|
|
|
|
|
+ sleep 1
|
|
|
# Go through every file and remove it
|
|
# Go through every file and remove it
|
|
|
modfileline="1"
|
|
modfileline="1"
|
|
|
|
|
+ tput sc
|
|
|
while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
|
|
while [ "${modfileline}" -le "${modsfilelistsize}" ]; do
|
|
|
# Current line defines current file to remove
|
|
# Current line defines current file to remove
|
|
|
currentfileremove="$(sed "${modfileline}q;d" "${modsdatadir}/${modcommand}-files.txt")"
|
|
currentfileremove="$(sed "${modfileline}q;d" "${modsdatadir}/${modcommand}-files.txt")"
|
|
|
# If file or directory exists, then remove it
|
|
# If file or directory exists, then remove it
|
|
|
|
|
+ fn_script_log "Removing: ${modinstalldir}/${currentfileremove}"
|
|
|
if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then
|
|
if [ -f "${modinstalldir}/${currentfileremove}" ]||[ -d "${modinstalldir}/${currentfileremove}" ]; then
|
|
|
- fn_script_log "Removing: ${modinstalldir}/${currentfileremove}"
|
|
|
|
|
rm -rf "${modinstalldir}/${currentfileremove}"
|
|
rm -rf "${modinstalldir}/${currentfileremove}"
|
|
|
|
|
+ local exitcode=$?
|
|
|
fi
|
|
fi
|
|
|
|
|
+ tput rc; tput el
|
|
|
|
|
+ printf "removing ${modprettyname} ${totalfileswc} / ${modsfilelistsize} : ${currentfileremove}..."
|
|
|
|
|
+
|
|
|
|
|
+ ((totalfileswc++))
|
|
|
let modfileline=modfileline+1
|
|
let modfileline=modfileline+1
|
|
|
done
|
|
done
|
|
|
|
|
+ tput rc; tput ed;
|
|
|
|
|
+ echo -ne "removing ${modprettyname} ${totalfileswc} / ${modsfilelistsize}..."
|
|
|
|
|
+ if [ ${exitcode} -ne 0 ]; then
|
|
|
|
|
+ fn_print_fail_eol_nl
|
|
|
|
|
+ core_exit.sh
|
|
|
|
|
+ else
|
|
|
|
|
+ fn_print_ok_eol_nl
|
|
|
|
|
+ fi
|
|
|
|
|
+ sleep 0.5
|
|
|
# Remove file list
|
|
# Remove file list
|
|
|
|
|
+ echo -en "removing ${modcommand}-files.txt..."
|
|
|
|
|
+ sleep 0.5
|
|
|
fn_script_log "Removing: ${modsdatadir}/${modcommand}-files.txt"
|
|
fn_script_log "Removing: ${modsdatadir}/${modcommand}-files.txt"
|
|
|
rm -rf "${modsdatadir}/${modcommand}-files.txt"
|
|
rm -rf "${modsdatadir}/${modcommand}-files.txt"
|
|
|
|
|
+ local exitcode=$?
|
|
|
|
|
+ if [ ${exitcode} -ne 0 ]; then
|
|
|
|
|
+ fn_print_fail_eol_nl
|
|
|
|
|
+ core_exit.sh
|
|
|
|
|
+ else
|
|
|
|
|
+ fn_print_ok_eol_nl
|
|
|
|
|
+ fi
|
|
|
# Remove from installed mods list
|
|
# Remove from installed mods list
|
|
|
|
|
+ echo -en "removing ${modcommand} from ${modslockfile}..."
|
|
|
|
|
+ sleep 0.5
|
|
|
fn_script_log "Removing: ${modcommand} from ${modslockfilefullpath}"
|
|
fn_script_log "Removing: ${modcommand} from ${modslockfilefullpath}"
|
|
|
sed -i "/^${modcommand}$/d" "${modslockfilefullpath}"
|
|
sed -i "/^${modcommand}$/d" "${modslockfilefullpath}"
|
|
|
# Post install tasks to solve potential issues
|
|
# Post install tasks to solve potential issues
|
|
|
|
|
+ local exitcode=$?
|
|
|
|
|
+ if [ ${exitcode} -ne 0 ]; then
|
|
|
|
|
+ fn_print_fail_eol_nl
|
|
|
|
|
+ core_exit.sh
|
|
|
|
|
+ else
|
|
|
|
|
+ fn_print_ok_eol_nl
|
|
|
|
|
+ fi
|
|
|
fn_postuninstall_tasks
|
|
fn_postuninstall_tasks
|
|
|
- fn_print_ok_nl "Removed ${modprettyname}"
|
|
|
|
|
- fn_script_log "Removed ${modprettyname}"
|
|
|
|
|
|
|
+ echo "${modprettyname} removed"
|
|
|
|
|
+ fn_script_log "${modprettyname} removed"
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
fn_mods_remove_init
|
|
fn_mods_remove_init
|