futility/updater_archive.c
/*
 * A callback function for manifest to scan files in archive.
 * Returns 0 to keep scanning, or non-zero to stop.
 */
A callback function for manifest to scan files in archive.
Returns 0 to keep scanning, or non-zero to stop.
A callback function for manifest to scan files in archive . Returns 0 to keep scanning or non - zero to stop .
static int manifest_scan_entries(const char *name, void *arg)
{
	struct manifest *manifest = (struct manifest *)arg;
	struct archive *archive = manifest->archive;
	struct model_config model = {0};
	char *slash;
	if (str_startswith(name, PATH_STARTSWITH_KEYSET))
		manifest->has_keyset = 1;
	if (!str_endswith(name, PATH_ENDSWITH_SERVARS))
		return 0;
	model.name = strdup(strchr(name, '/') + 1);
	slash = strchr(model.name, '/');
	if (slash)
		*slash = '\0';
	VB2_DEBUG("Found model <%s> setvars: %s\n", model.name, name);
	if (model_config_parse_setvars_file(&model, archive, name)) {
		ERROR("Invalid setvars file: %s\n", name);
		return 0;
	}
	if (model.ec_image && !archive_has_entry(archive, model.ec_image)) {
		VB2_DEBUG("Ignore non-exist EC image: %s\n", model.ec_image);
		free(model.ec_image);
		model.ec_image = NULL;
	}
	if (model.pd_image && !archive_has_entry(archive, model.pd_image)) {
		VB2_DEBUG("Ignore non-exist PD image: %s\n", model.pd_image);
		free(model.pd_image);
		model.pd_image = NULL;
	}
	if (model.signature_id)
		find_patches_for_model(&model, archive, model.signature_id);
	return !manifest_add_model(manifest, &model);
}
static int manifest_scan_entries ( const char * name , void * arg ) { struct manifest * manifest = ( struct manifest * ) arg ; struct archive * archive = manifest -> archive ; struct model_config model = { 0 } ; char * slash ; if ( str_startswith ( name , PATH_STARTSWITH_KEYSET ) ) manifest -> has_keyset = 1 ; if ( ! str_endswith ( name , PATH_ENDSWITH_SERVARS ) ) return 0 ; model . name = strdup ( strchr ( name , ' ' ) + 1 ) ; slash = strchr ( model . name , ' ' ) ; if ( slash ) * slash = ' \0 ' ; VB2_DEBUG ( " \n " , model . name , name ) ; if ( model_config_parse_setvars_file ( & model , archive , name ) ) { ERROR ( " \n " , name ) ; return 0 ; } if ( model . ec_image && ! archive_has_entry ( archive , model . ec_image ) ) { VB2_DEBUG ( " \n " , model . ec_image ) ; free ( model . ec_image ) ; model . ec_image = NULL ; } if ( model . pd_image && ! archive_has_entry ( archive , model . pd_image ) ) { VB2_DEBUG ( " \n " , model . pd_image ) ; free ( model . pd_image ) ; model . pd_image = NULL ; } if ( model . signature_id ) find_patches_for_model ( & model , archive , model . signature_id ) ; return ! manifest_add_model ( manifest , & model ) ; }
A callback function for manifest to scan files in archive.
A callback function for manifest to scan files in archive .
/* name: models/$MODEL/setvars.sh */ /* In legacy setvars.sh, the ec_image and pd_image may not exist. */ /* Find patch files. */