From d0181b8fcdac761afec252151a8bfda116916e96 Mon Sep 17 00:00:00 2001 From: Doug Zongker Date: Wed, 19 Oct 2011 10:51:12 -0700 Subject: allow recovery packages to wipe cache updater now has a function "wipe_cache();" which causes recovery to wipe the cache partition after the successful installation of the package. Move log copying around a bit so logs and the last_install flag file are copied to cache after it's wiped. Bug: 5314244 Change-Id: Id35a9eb6dcd626c8f3a3a0076074f462ed3d44bd --- updater/install.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'updater') diff --git a/updater/install.c b/updater/install.c index 0396bae6c..7b4b99b01 100644 --- a/updater/install.c +++ b/updater/install.c @@ -1024,6 +1024,14 @@ Value* UIPrintFn(const char* name, State* state, int argc, Expr* argv[]) { return StringValue(buffer); } +Value* WipeCacheFn(const char* name, State* state, int argc, Expr* argv[]) { + if (argc != 0) { + return ErrorAbort(state, "%s() expects no args, got %d", name, argc); + } + fprintf(((UpdaterInfo*)(state->cookie))->cmd_pipe, "wipe_cache\n"); + return StringValue(strdup("t")); +} + Value* RunProgramFn(const char* name, State* state, int argc, Expr* argv[]) { if (argc < 1) { return ErrorAbort(state, "%s() expects at least 1 arg", name); @@ -1198,6 +1206,8 @@ void RegisterInstallFunctions() { RegisterFunction("read_file", ReadFileFn); RegisterFunction("sha1_check", Sha1CheckFn); + RegisterFunction("wipe_cache", WipeCacheFn); + RegisterFunction("ui_print", UIPrintFn); RegisterFunction("run_program", RunProgramFn); -- cgit v1.2.3