diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2019-05-15 22:17:36 +0200 |
---|---|---|
committer | Dees Troy <dees_troy@teamw.in> | 2019-05-16 19:06:49 +0200 |
commit | 9f5dd3139e7a4bcd503c5bcc0cc195f5ed932a10 (patch) | |
tree | 97abaea1d9b16091e1e3d8315a0dc5621d9d2e25 | |
parent | Resolve e2fsdroid failure in certain cases (diff) | |
download | android_bootable_recovery-9f5dd3139e7a4bcd503c5bcc0cc195f5ed932a10.tar android_bootable_recovery-9f5dd3139e7a4bcd503c5bcc0cc195f5ed932a10.tar.gz android_bootable_recovery-9f5dd3139e7a4bcd503c5bcc0cc195f5ed932a10.tar.bz2 android_bootable_recovery-9f5dd3139e7a4bcd503c5bcc0cc195f5ed932a10.tar.lz android_bootable_recovery-9f5dd3139e7a4bcd503c5bcc0cc195f5ed932a10.tar.xz android_bootable_recovery-9f5dd3139e7a4bcd503c5bcc0cc195f5ed932a10.tar.zst android_bootable_recovery-9f5dd3139e7a4bcd503c5bcc0cc195f5ed932a10.zip |
Diffstat (limited to '')
-rwxr-xr-x | partitionmanager.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/partitionmanager.cpp b/partitionmanager.cpp index 31e909878..f0573890d 100755 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -3154,6 +3154,37 @@ bool TWPartitionManager::Repack_Images(const std::string& Target_Image, const st } DataManager::SetProgress(1); TWFunc::removeDir(REPACK_ORIG_DIR, false); + if (part->SlotSelect && Repack_Options.Type == REPLACE_RAMDISK) { + LOGINFO("Switching slots to flash ramdisk to both partitions\n"); + string Current_Slot = Get_Active_Slot_Display(); + if (Current_Slot == "A") + Set_Active_Slot("B"); + else + Set_Active_Slot("A"); + DataManager::SetProgress(.25); + if (!PartitionManager.Prepare_Repack(part, REPACK_ORIG_DIR, Repack_Options.Backup_First, gui_lookup("repack", "Repack"))) + return false; + if (TWFunc::copy_file(REPACK_NEW_DIR "ramdisk.cpio", REPACK_ORIG_DIR "ramdisk.cpio", 0644)) { + LOGERR("Failed to copy ramdisk\n"); + return false; + } + path = REPACK_ORIG_DIR; + command = "cd " + path + " && /sbin/magiskboot --repack " + path + "boot.img"; + if (TWFunc::Exec_Cmd(command) != 0) { + gui_msg(Msg(msg::kError, "repack_error=Error repacking image.")); + return false; + } + DataManager::SetProgress(.75); + std::string file = "new-boot.img"; + DataManager::SetValue("tw_flash_partition", "/boot;"); + if (!PartitionManager.Flash_Image(path, file)) { + LOGINFO("Error flashing new image\n"); + return false; + } + DataManager::SetProgress(1); + TWFunc::removeDir(REPACK_ORIG_DIR, false); + Set_Active_Slot(Current_Slot); + } TWFunc::removeDir(REPACK_NEW_DIR, false); return true; } |