Add option to automatically unmount system before installing ZIP

This adds the option to automatically unmount the system partition
before installing a ZIP-file.
This option is enabled by default, This is usefull on SAR-devices
where system is mounted as system_root and ZIPs (i.e. Magisk)
try to unmount system instead of system_root and fail to install.

Change-Id: Id94ae658964679e23aa7fa137e07edf74ee073df
This commit is contained in:
Chaosmaster
2020-01-26 15:38:11 +01:00
committed by bigbiff
parent 3b3b634365
commit ff4f958182
7 changed files with 25 additions and 1 deletions
+11 -1
View File
@@ -339,7 +339,7 @@ static int Run_Update_Binary(const char *path, ZipWrap *Zip, int* wipe_cache, zi
}
int TWinstall_zip(const char* path, int* wipe_cache) {
int ret_val, zip_verify = 1;
int ret_val, zip_verify = 1, unmount_system = 1;
if (strcmp(path, "error") == 0) {
LOGERR("Failed to get adb sideload file: '%s'\n", path);
@@ -359,6 +359,8 @@ int TWinstall_zip(const char* path, int* wipe_cache) {
}
}
DataManager::GetValue(TW_UNMOUNT_SYSTEM, unmount_system);
#ifndef TW_OEM_BUILD
DataManager::GetValue(TW_SIGNED_ZIP_VERIFY_VAR, zip_verify);
#endif
@@ -410,6 +412,14 @@ int TWinstall_zip(const char* path, int* wipe_cache) {
return INSTALL_CORRUPT;
}
if (unmount_system) {
gui_msg("unmount_system=Unmounting System...");
if(!PartitionManager.UnMount_By_Path(PartitionManager.Get_Android_Root_Path(), true)) {
gui_err("unmount_system_err=Failed unmounting System");
return -1;
}
}
time_t start, stop;
time(&start);
if (Zip.EntryExists(ASSUMED_UPDATE_BINARY_NAME)) {