Add and improve OpenRecoveryScript support

Improve zip finding in ORS engine
Add support for restoring with just a backup name
diff --git a/recovery.cpp b/recovery.cpp
index 2d89014..8cf3106 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -56,6 +56,7 @@
 }
 #include "partitions.hpp"
 #include "variables.h"
+#include "openrecoveryscript.hpp"
 
 TWPartitionManager PartitionManager;
 
@@ -924,8 +925,19 @@
 
     //if (status != INSTALL_SUCCESS) ui->SetBackground(RecoveryUI::ERROR);
     if (status != INSTALL_SUCCESS /*|| ui->IsTextVisible()*/) {
+		finish_recovery(NULL);
 		DataManager_ReadSettingsFile();
-        gui_start();
+		if (DataManager_GetIntValue(TW_IS_ENCRYPTED) == 0 && OpenRecoveryScript::check_for_script_file()) {
+			gui_console_only();
+			OpenRecoveryScript::run_script_file();
+			if (1 || OpenRecoveryScript::run_script_file() != 0) {
+				// There was an error, boot the recovery
+				gui_start();
+			} else {
+				usleep(2000000); // Sleep for 2 seconds before rebooting
+			}
+		} else
+			gui_start();
 		//prompt_and_wait(device);
     }