Make the android-5.0 branch compile in 4.4 to 4.1
Migrate previous minzip to minzipold replacing the existing
minzipold. This will break compatibility with trees that do not
support selinux (ICS and older). Migrate former verifier files to
verifierold.
Add fuse.h to recovery source because older trees do not have it.
Add LOCAL_MODULE_TAGS where needed for 4.1 tree.
Change-Id: Iade57cb2b0115af7fce9f56aa98636b1744a1ef4
diff --git a/twinstall.cpp b/twinstall.cpp
index f185701..01bd672 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 @@
#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;
}