Browse Source

Testing for multiple installations

UltimateByte 9 năm trước cách đây
mục cha
commit
8ca7bca3ca
1 tập tin đã thay đổi với 38 bổ sung6 xóa
  1. 38 6
      lgsm/functions/command_mods_update.sh

+ 38 - 6
lgsm/functions/command_mods_update.sh

@@ -27,12 +27,44 @@ fn_mods_update_init(){
 		echo -e " * \e[36m$(sed "${installedmodsline}q;d" "${modslockfilefullpath}")\e[0m"
 		let installedmodsline=installedmodsline+1
 	done
-	exit
-	#currentmod="${usermodselect}"
-	#fn_mod_get_info_from_command
-	#fn_print_dots_nl "Updating ${modprettyname}"
-	#sleep 1
-	#fn_script_log "Updating ${modprettyname}."
+	sleep 2
+}
+
+fn_mods_update_loop(){
+	while [ $installedmodsline -le $installedmodscount ]; do
+		currentmod="$(sed "${installedmodsline}q;d" "${modslockfilefullpath}")"
+		fn_mod_get_info_from_command
+		if [ -n "${currentmod}" ]; then
+			fn_print_dots_nl "Updating ${modprettyname}"
+			sleep 0.5
+			fn_script_log "Updating ${modprettyname}."
+			# Get mod info
+			fn_mod_get_info_from_command
+			# Check if mod is already installed
+			fn_mod_already_installed
+			# 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
+			# 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."
+		else
+			fn_print_fail "No mod was selected."
+			core_exit.sh
+		fi
+	done
 }
 
 fn_mods_update_init