Просмотр исходного кода

Support forced updates, sometimes MTA releases versions lower than maintenance versions that cannot otherwise be detected.

Chaos 9 лет назад
Родитель
Сommit
7152d821c0
2 измененных файлов с 13 добавлено и 3 удалено
  1. 4 0
      lgsm/functions/core_getopt.sh
  2. 9 3
      lgsm/functions/update_mta.sh

+ 4 - 0
lgsm/functions/core_getopt.sh

@@ -352,6 +352,9 @@ case "${getopt}" in
 		command_restart.sh;;
 	u|update)
 		command_update.sh;;
+	fu|force-update|update-restart)
+		forceupdate=1;
+		command_update.sh;;
 	uf|update-functions)
 		command_update_functions.sh;;
 	m|monitor)
@@ -397,6 +400,7 @@ case "${getopt}" in
 		echo -e "${blue}stop\t${default}sp |Stop the server."
 		echo -e "${blue}restart\t${default}r  |Restart the server."
 		echo -e "${blue}update\t${default}u  |Checks and applies updates from linux.mtasa.com."
+		echo -e "${blue}force-update\t${default}fu |Bypasses the check and applies updates from linux.mtasa.com."
 		echo -e "${blue}update-functions\t${default}uf |Removes all functions so latest can be downloaded."
 		echo -e "${blue}monitor\t${default}m  |Checks that the server is running."
 		echo -e "${blue}test-alert\t${default}ta |Sends test alert."

+ 9 - 3
lgsm/functions/update_mta.sh

@@ -84,9 +84,15 @@ fn_update_mta_compare(){
 	# Removes dots so if can compare version numbers
 	currentbuilddigit=$(echo "${currentbuild}"|tr -cd '[:digit:]')
 
-	if [ "${currentbuilddigit}" -ne "${NUM_VERSION}" ]; then
+	if [ "${currentbuilddigit}" -ne "${NUM_VERSION}" ]||[ "${forceupdate}" == "1" ]; then
+		if [ "${forceupdate}" == "1" ]; then
+			# forceupdate bypasses checks, useful for small build changes
+			mta_update_string="forced"
+		else
+			mta_update_string="available"
+		fi
 		echo -e "\n"
-		echo -e "Update available:"
+		echo -e "Update ${mta_update_string}:"
 		sleep 1
 		echo -e "	Current build: ${red}${currentbuild} ${default}"
 		echo -e "	Available build: ${green}${FULL_VERSION} ${default}"
@@ -100,7 +106,7 @@ fn_update_mta_compare(){
 		echo -en "Applying update...\r"
 		sleep 1
 		echo -en "\n"
-		fn_script_log "Update available"
+		fn_script_log "Update ${mta_update_string}"
 		fn_script_log "Current build: ${currentbuild}"
 		fn_script_log "Available build: ${FULL_VERSION}"
 		fn_script_log "${currentbuild} > ${FULL_VERSION}"