Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e2c657c authored by Ethan Yonker's avatar Ethan Yonker Committed by Dees Troy
Browse files

Fix system read only behavior during boot

Change-Id: I90dbdd06465e2ddaaade86b930beff91991432eb
parent 0eb2aab0
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -333,16 +333,22 @@ int main(int argc, char **argv) {
#endif

	// Check if system has never been changed
	if (DataManager::GetIntValue("tw_mount_system_ro") != 0 && DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) {
	TWPartition* sys = PartitionManager.Find_Partition_By_Path("/system");
		if (sys && sys->Check_Lifetime_Writes() == 0) {
			LOGINFO("System writes is 0, show system_readonly page\n");
	if (sys) {
		if (DataManager::GetIntValue("tw_mount_system_ro") != 0) {
			if (sys->Check_Lifetime_Writes() == 0) {
				if (DataManager::GetIntValue("tw_never_show_system_ro_page") == 0) {
					DataManager::SetValue("tw_back", "main");
					if (gui_startPage("system_readonly", 1, 1) != 0) {
						LOGERR("Failed to start system_readonly GUI page.\n");
					}
				}
			} else {
				DataManager::SetValue("tw_mount_system_ro", 0);
				sys->Change_Mount_Read_Only(false);
			}
		} else {
			sys->Change_Mount_Read_Only(false);
		}
	}