Allow all extension while checking for digest verification
Change-Id: Ie17582f144e0a5b5a68e2c6d88c26cb9f5a29ee6
(cherry picked from commit 57366118181ad8f78251dc034f55835e6947cc0a)
diff --git a/gui/action.cpp b/gui/action.cpp
index e785287..52981f2 100755
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -403,9 +403,8 @@
if (simulate) {
simulate_progress_bar();
} else {
- ret_val = TWinstall_zip(filename.c_str(), wipe_cache);
+ ret_val = TWinstall_zip(filename.c_str(), wipe_cache, (bool) DataManager::GetIntValue(TW_SKIP_DIGEST_CHECK_VAR));
PartitionManager.Unlock_Block_Partitions();
-
// Now, check if we need to ensure TWRP remains installed...
struct stat st;
if (stat("/system/bin/installTwrp", &st) == 0)
diff --git a/twrpDigestDriver.cpp b/twrpDigestDriver.cpp
index 0ab94df..0f8eb63 100755
--- a/twrpDigestDriver.cpp
+++ b/twrpDigestDriver.cpp
@@ -70,11 +70,7 @@
if (!TWFunc::Path_Exists(digestfile)) {
delete digest;
- if (Filename.find(".zip") == std::string::npos && Filename.find(".apk") == std::string::npos && Filename.find(".map") == std::string::npos) {
- gui_msg(Msg(msg::kError, "no_digest_found=No digest file found for '{1}'. Please unselect Enable Digest verification to restore.")(Filename));
- } else {
- return true;
- }
+ gui_msg(Msg(msg::kError, "no_digest_found=No digest file found for '{1}'. Please unselect Enable Digest verification to restore.")(Filename));
return false;
}
diff --git a/twrpinstall/include/twinstall.h b/twrpinstall/include/twinstall.h
old mode 100755
new mode 100644
index f60dd26..406ab6f
--- a/twrpinstall/include/twinstall.h
+++ b/twrpinstall/include/twinstall.h
@@ -1,6 +1,6 @@
#ifndef RECOVERY_TWINSTALL_H_
#define RECOVERY_TWINSTALL_H_
-int TWinstall_zip(const char* path, int* wipe_cache);
+int TWinstall_zip(const char* path, int* wipe_cache, bool check_for_digest = false);
#endif // RECOVERY_TWINSTALL_H_
diff --git a/twrpinstall/twinstall.cpp b/twrpinstall/twinstall.cpp
index d4c960a..62bbcbb 100755
--- a/twrpinstall/twinstall.cpp
+++ b/twrpinstall/twinstall.cpp
@@ -241,7 +241,7 @@
return INSTALL_SUCCESS;
}
-int TWinstall_zip(const char* path, int* wipe_cache) {
+int TWinstall_zip(const char* path, int* wipe_cache, bool check_for_digest) {
int ret_val, zip_verify = 1, unmount_system = 1;
gui_msg(Msg("installing_zip=Installing zip file '{1}'")(path));
@@ -249,11 +249,12 @@
string digest_str;
string Full_Filename = path;
- gui_msg("check_for_digest=Checking for Digest file...");
-
- if (*path != '@' && !twrpDigestDriver::Check_File_Digest(Full_Filename)) {
- LOGERR("Aborting zip install: Digest verification failed\n");
- return INSTALL_CORRUPT;
+ if (check_for_digest) {
+ gui_msg("check_for_digest=Checking for Digest file...");
+ if (*path != '@' && !twrpDigestDriver::Check_File_Digest(Full_Filename)) {
+ LOGERR("Aborting zip install: Digest verification failed\n");
+ return INSTALL_CORRUPT;
+ }
}
}