[FL-2527] Updater: Migrating to new manifest path convention (#1213)
* Updater: Migrating to new manifest path convention * RPC: Added update preparation status to RPC * RPC: bumped protobuf submodule * Bumped protobuf_version.h * FuriCore: add missing include. Lib: make mlib smaller * Explicitly tell where we have doubles and fix random in animations * makefile: added -DLFS_NO_DEBUG * Updater: path len constant dedup * Updater: checking for hardware version match before parsing manifest * LD: moved _DRIVER_CONTEXT sections to .bss, where they belong. * LD: avoiding PROBGITS warning, moved _CONTEXT to data * Updater: Added version check on update package - refusing to install outdated Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -260,16 +260,18 @@ bool update_task_parse_manifest(UpdateTask* update_task) {
|
||||
string_init(manifest_path);
|
||||
|
||||
do {
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 10);
|
||||
if(!update_operation_get_current_package_path(
|
||||
update_task->storage, update_task->update_path)) {
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 13);
|
||||
if(!furi_hal_version_do_i_belong_here()) {
|
||||
break;
|
||||
}
|
||||
|
||||
path_concat(
|
||||
string_get_cstr(update_task->update_path),
|
||||
UPDATE_MANIFEST_DEFAULT_NAME,
|
||||
manifest_path);
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 20);
|
||||
if(!update_operation_get_current_package_manifest_path(
|
||||
update_task->storage, manifest_path)) {
|
||||
break;
|
||||
}
|
||||
|
||||
path_extract_dirname(string_get_cstr(manifest_path), update_task->update_path);
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 30);
|
||||
|
||||
UpdateManifest* manifest = update_task->manifest;
|
||||
@@ -277,6 +279,16 @@ bool update_task_parse_manifest(UpdateTask* update_task) {
|
||||
break;
|
||||
}
|
||||
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 40);
|
||||
if(manifest->manifest_version < UPDATE_OPERATION_MIN_MANIFEST_VERSION) {
|
||||
break;
|
||||
}
|
||||
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 50);
|
||||
if(manifest->target != furi_hal_version_get_hw_target()) {
|
||||
break;
|
||||
}
|
||||
|
||||
update_task->state.groups = update_task_get_task_groups(update_task);
|
||||
for(size_t stage_counter = 0; stage_counter < COUNT_OF(update_task_stage_progress);
|
||||
++stage_counter) {
|
||||
@@ -286,13 +298,13 @@ bool update_task_parse_manifest(UpdateTask* update_task) {
|
||||
}
|
||||
}
|
||||
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 50);
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 60);
|
||||
if((update_task->state.groups & UpdateTaskStageGroupFirmware) &&
|
||||
!update_task_check_file_exists(update_task, manifest->firmware_dfu_image)) {
|
||||
break;
|
||||
}
|
||||
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 70);
|
||||
update_task_set_progress(update_task, UpdateTaskStageProgress, 80);
|
||||
if((update_task->state.groups & UpdateTaskStageGroupRadio) &&
|
||||
(!update_task_check_file_exists(update_task, manifest->radio_image) ||
|
||||
(manifest->radio_version.version.type == 0))) {
|
||||
|
@@ -63,7 +63,6 @@ static bool update_task_post_update(UpdateTask* update_task) {
|
||||
|
||||
TarArchive* archive = tar_archive_alloc(update_task->storage);
|
||||
do {
|
||||
CHECK_RESULT(update_task_parse_manifest(update_task));
|
||||
path_concat(
|
||||
string_get_cstr(update_task->update_path), LFS_BACKUP_DEFAULT_FILENAME, file_path);
|
||||
|
||||
@@ -114,7 +113,7 @@ int32_t update_task_worker_backup_restore(void* context) {
|
||||
return UPDATE_TASK_NOERR;
|
||||
}
|
||||
|
||||
if(!update_operation_get_current_package_path(update_task->storage, update_task->update_path)) {
|
||||
if(!update_task_parse_manifest(update_task)) {
|
||||
return UPDATE_TASK_FAILED;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user