int
install_package(const char* path, bool* wipe_cache, const char* install_file,
bool needs_mount)
{
modified_flash = true;
FILE* install_log = fopen_path(install_file, "w");
if (install_log) { //lefty_lan注:检查文件/tmp/last_install是否存在
fputs(path, install_log);//lefty_lan注:将新的文件路径/sideload/package.zip记录到/tmp/last_install文件中
fputc('\n', install_log);
} else {
LOGE("failed to open last_install: %s\n", strerror(errno));
}
int result;
if (setup_install_mounts() != 0) { //lefty_lan注:确保/tmp和/cache分区已经mount
LOGE("failed to set up expected mounts for install; aborting\n");
result = INSTALL_ERROR;
} else {
result = really_install_package(path, wipe_cache, needs_mount);//lefty_lan注:继续安装
}
if (install_log) {
fputc(result == INSTALL_SUCCESS ? '1' : '0', install_log);
fputc('\n', install_log);
fclose(install_log);
}
return result;
}
install.cpp文件install_package函数分析
最新推荐文章于 2021-05-01 15:03:52 发布