summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recovery.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 2459650f3..de6e10019 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -946,6 +946,10 @@ main(int argc, char **argv) {
if (status != INSTALL_SUCCESS /*|| ui->IsTextVisible()*/) {
finish_recovery(NULL);
DataManager_ReadSettingsFile();
+ if (PartitionManager.Mount_By_Path("/system", false) && TWFunc::Path_Exists("/system/recovery-from-boot.p")) {
+ system("mv /system/recovery-from-boot.p /system/recovery-from-boot.bak");
+ ui_print("Renamed stock recovery file in /system to prevent\nthe stock ROM from replacing TWRP.\n");
+ }
if (DataManager_GetIntValue(TW_IS_ENCRYPTED) == 0 && OpenRecoveryScript::check_for_script_file()) {
gui_console_only();
OpenRecoveryScript::run_script_file();