diff options
author | Ethan Yonker <dees_troy@teamw.in> | 2014-11-21 20:54:27 +0100 |
---|---|---|
committer | Ethan Yonker <dees_troy@teamw.in> | 2014-12-02 17:34:15 +0100 |
commit | 75bf041a8ad75f8fc9bba69e937e12b129338a4c (patch) | |
tree | 9a3202b8c06e075e1749a44948a3a3f184edf95e /twinstall.cpp | |
parent | TWRP MTP: make sure inotify_fd is set (diff) | |
download | android_bootable_recovery-75bf041a8ad75f8fc9bba69e937e12b129338a4c.tar android_bootable_recovery-75bf041a8ad75f8fc9bba69e937e12b129338a4c.tar.gz android_bootable_recovery-75bf041a8ad75f8fc9bba69e937e12b129338a4c.tar.bz2 android_bootable_recovery-75bf041a8ad75f8fc9bba69e937e12b129338a4c.tar.lz android_bootable_recovery-75bf041a8ad75f8fc9bba69e937e12b129338a4c.tar.xz android_bootable_recovery-75bf041a8ad75f8fc9bba69e937e12b129338a4c.tar.zst android_bootable_recovery-75bf041a8ad75f8fc9bba69e937e12b129338a4c.zip |
Diffstat (limited to 'twinstall.cpp')
-rw-r--r-- | twinstall.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/twinstall.cpp b/twinstall.cpp index f18570186..01bd67278 100644 --- a/twinstall.cpp +++ b/twinstall.cpp @@ -31,16 +31,17 @@ #include "mincrypt/rsa.h" #include "mincrypt/sha.h" #include "minui/minui.h" -#ifdef HAVE_SELINUX +#include "mtdutils/mounts.h" +#include "mtdutils/mtdutils.h" +#if (ANDROID_VERSION >= 5) #include "minzip/SysUtil.h" #include "minzip/Zip.h" +#include "verifier.h" #else +#include "verifierold.h" #include "minzipold/SysUtil.h" #include "minzipold/Zip.h" #endif -#include "mtdutils/mounts.h" -#include "mtdutils/mtdutils.h" -#include "verifier.h" #include "variables.h" #include "data.hpp" #include "partitions.hpp" @@ -278,28 +279,44 @@ extern "C" int TWinstall_zip(const char* path, int* wipe_cache) { #endif DataManager::SetProgress(0); +#if (ANDROID_VERSION >= 5) MemMapping map; if (sysMapFile(path, &map) != 0) { LOGERR("Failed to sysMapFile '%s'\n", path); return -1; } +#endif if (zip_verify) { gui_print("Verifying zip signature...\n"); +#if (ANDROID_VERSION >= 5) ret_val = verify_file(map.addr, map.length); +#else + ret_val = verify_file(path); +#endif if (ret_val != VERIFY_SUCCESS) { LOGERR("Zip signature verification failed: %i\n", ret_val); +#if (ANDROID_VERSION >= 5) sysReleaseMap(&map); +#endif return -1; } } +#if (ANDROID_VERSION >= 5) ret_val = mzOpenZipArchive(map.addr, map.length, &Zip); +#else + ret_val = mzOpenZipArchive(path, &Zip); +#endif if (ret_val != 0) { LOGERR("Zip file is corrupt!\n", path); +#if (ANDROID_VERSION >= 5) sysReleaseMap(&map); +#endif return INSTALL_CORRUPT; } ret_val = Run_Update_Binary(path, &Zip, wipe_cache); +#if (ANDROID_VERSION >= 5) sysReleaseMap(&map); +#endif return ret_val; } |