UltimateByte 9 лет назад
Родитель
Сommit
1f6c9c9078
1 измененных файлов с 36 добавлено и 25 удалено
  1. 36 25
      lgsm/functions/command_mods_update.sh

+ 36 - 25
lgsm/functions/command_mods_update.sh

@@ -50,33 +50,44 @@ fn_mods_update_loop(){
 		if [ -n "${currentmod}" ]; then
 			# Get mod info
 			fn_mod_get_info_from_command
-			fn_print_dots_nl "Updating ${modprettyname}"
-			fn_script_log "Updating ${modprettyname}."
-			# Check and create required directories
-			fn_mods_dir
-			# Clear lgsm/tmp/mods dir if exists then recreate it
-			fn_clear_tmp_mods
-			fn_mods_tmpdir
-			# Download mod
-			fn_mod_dl
-			# Extract the mod
-			fn_mod_extract
-			# Remove files that should not be erased
-			# fn_remove_cfg_files
-			# Convert to lowercase if needed
-			fn_mod_lowercase
-			# Build a file list
-			fn_mod_fileslist
-			# Copying to destination
-			fn_mod_copy_destination
-			# Ending with installation routines
-			fn_mod_add_list
-			fn_clear_tmp_mods
-			fn_print_ok_nl "${modprettyname} installed."
-			fn_script_log "${modprettyname} installed."
-			let installedmodsline=installedmodsline+1		
+			# Don't update the mod if it's policy is to "NOUPDATE"
+			if [ "${modkeepfiles}" == "NOUPDATE" ]; then
+				fn_print_warning "${modprettyname} update has been disabled by LGSM."
+				echo " * Usual reason is to prevent erasing custom files."
+				echo " * If you still wish to update this mod:
+				echo " *  1) Backup your critical mod files
+				echo " *  2) Uninstall the mod with ./${selfname} mods-uninstall (optionnal)
+				echo " *  3) Re-install the mod with ./${selfname} mods-install"
+			else
+				fn_print_dots_nl "Updating ${modprettyname}"
+				fn_script_log "Updating ${modprettyname}."
+				# Check and create required directories
+				fn_mods_dir
+				# Clear lgsm/tmp/mods dir if exists then recreate it
+				fn_clear_tmp_mods
+				fn_mods_tmpdir
+				# Download mod
+				fn_mod_dl
+				# Extract the mod
+				fn_mod_extract
+				# Remove files that should not be erased
+				# fn_remove_cfg_files
+				# Convert to lowercase if needed
+				fn_mod_lowercase
+				# Build a file list
+				fn_mod_fileslist
+				# Copying to destination
+				fn_mod_copy_destination
+				# Ending with installation routines
+				fn_mod_add_list
+				fn_clear_tmp_mods
+				fn_print_ok_nl "${modprettyname} installed."
+				fn_script_log "${modprettyname} installed."
+				let installedmodsline=installedmodsline+1
+			fi
 		else
 			fn_print_fail "No mod was selected."
+			fn_script_log_fail "No mod was selected."
 			core_exit.sh
 		fi
 	done