summaryrefslogtreecommitdiffstats
path: root/updater/updater.c
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2014-11-06 15:35:10 +0100
committerEthan Yonker <dees_troy@teamw.in>2014-11-06 15:35:13 +0100
commita167416289a8aef5d4c35861c9f4181f87b8bfd0 (patch)
treecfb0b940141a4273ac6ddb58070e36ea706b7358 /updater/updater.c
parent2.8.2.0 (diff)
parentUse more aggressive sync writing to applypatch. (diff)
downloadandroid_bootable_recovery-a167416289a8aef5d4c35861c9f4181f87b8bfd0.tar
android_bootable_recovery-a167416289a8aef5d4c35861c9f4181f87b8bfd0.tar.gz
android_bootable_recovery-a167416289a8aef5d4c35861c9f4181f87b8bfd0.tar.bz2
android_bootable_recovery-a167416289a8aef5d4c35861c9f4181f87b8bfd0.tar.lz
android_bootable_recovery-a167416289a8aef5d4c35861c9f4181f87b8bfd0.tar.xz
android_bootable_recovery-a167416289a8aef5d4c35861c9f4181f87b8bfd0.tar.zst
android_bootable_recovery-a167416289a8aef5d4c35861c9f4181f87b8bfd0.zip
Diffstat (limited to 'updater/updater.c')
-rw-r--r--updater/updater.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/updater/updater.c b/updater/updater.c
index 39c52b49d..78c0dc1a6 100644
--- a/updater/updater.c
+++ b/updater/updater.c
@@ -22,7 +22,9 @@
#include "edify/expr.h"
#include "updater.h"
#include "install.h"
+#include "blockimg.h"
#include "minzip/Zip.h"
+#include "minzip/SysUtil.h"
// Generated by the makefile, this function defines the
// RegisterDeviceExtensions() function, which calls all the
@@ -68,19 +70,24 @@ int main(int argc, char** argv) {
// Extract the script from the package.
- char* package_data = argv[3];
+ const char* package_filename = argv[3];
+ MemMapping map;
+ if (sysMapFile(package_filename, &map) != 0) {
+ printf("failed to map package %s\n", argv[3]);
+ return 3;
+ }
ZipArchive za;
int err;
- err = mzOpenZipArchive(package_data, &za);
+ err = mzOpenZipArchive(map.addr, map.length, &za);
if (err != 0) {
printf("failed to open package %s: %s\n",
- package_data, strerror(err));
+ argv[3], strerror(err));
return 3;
}
const ZipEntry* script_entry = mzFindZipEntry(&za, SCRIPT_NAME);
if (script_entry == NULL) {
- printf("failed to find %s in %s\n", SCRIPT_NAME, package_data);
+ printf("failed to find %s in %s\n", SCRIPT_NAME, package_filename);
return 4;
}
@@ -112,6 +119,7 @@ int main(int argc, char** argv) {
RegisterBuiltins();
RegisterInstallFunctions();
+ RegisterBlockImageFunctions();
RegisterDeviceExtensions();
FinishRegistration();
@@ -119,8 +127,7 @@ int main(int argc, char** argv) {
Expr* root;
int error_count = 0;
- yy_scan_string(script);
- int error = yyparse(&root, &error_count);
+ int error = parse_string(script, &root, &error_count);
if (error != 0 || error_count > 0) {
printf("%d parse errors\n", error_count);
return 6;
@@ -150,6 +157,8 @@ int main(int argc, char** argv) {
updater_info.cmd_pipe = cmd_pipe;
updater_info.package_zip = &za;
updater_info.version = atoi(version);
+ updater_info.package_zip_addr = map.addr;
+ updater_info.package_zip_len = map.length;
State state;
state.cookie = &updater_info;
@@ -180,6 +189,7 @@ int main(int argc, char** argv) {
if (updater_info.package_zip) {
mzCloseZipArchive(updater_info.package_zip);
}
+ sysReleaseMap(&map);
free(script);
return 0;