From eb32b1ff00878e7b01453450fcd04ecb9fcbba52 Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Mon, 18 May 2015 10:23:03 -0500 Subject: Mount system as read-only by default Mounting system as rw can prevent future OTA updates. The purpose of this patch set is to prevent TWRP from mounting sytem as rw on the first boot. Device maintainers should update their twrp.fstab files on these devices to include an additional line: /system_image emmc /dev/block/../system This line will allow TWRP to create a raw system image backup to ensure that the user can return to an original state for future OTA updates. Change-Id: I8929d85bc3a5b96cc564bc7f734b58d5612ec833 --- partitionmanager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'partitionmanager.cpp') diff --git a/partitionmanager.cpp b/partitionmanager.cpp index ffc17c3a4..055f73697 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -880,9 +880,13 @@ int TWPartitionManager::Run_Restore(string Restore_Name) { restore_path = Restore_List.substr(start_pos, end_pos - start_pos); restore_part = Find_Partition_By_Path(restore_path); if (restore_part != NULL) { - partition_count++; + if (restore_part->Mount_Read_Only) { + LOGERR("Cannot restore %s -- mounted read only.\n", restore_part->Backup_Display_Name.c_str()); + return false; + } if (check_md5 > 0 && !restore_part->Check_MD5(Restore_Name)) return false; + partition_count++; total_restore_size += restore_part->Get_Restore_Size(Restore_Name); if (restore_part->Has_SubPartition) { std::vector::iterator subpart; -- cgit v1.2.3