@@ -461,8 +461,26 @@ data::InstallationResult ComposeAppManager::finalizeInstall(const Uptane::Target
461461 } else {
462462 LOG_INFO << " Installing and starting Apps..." ;
463463 }
464+
465+ const auto install_context{target.custom_data ().get (" install-context" , Json::nullValue)};
466+ std::string newly_enabled_apps_msg;
464467 // "finalize" (run) Apps that were pulled and created before reboot
465468 for (const auto & app_pair : getApps (target)) {
469+ if (!install_context.empty () && install_context.isMember (" apps" )) {
470+ if (!(install_context[" apps" ].isMember (app_pair.first ) &&
471+ install_context[" apps" ][app_pair.first ] == app_pair.second )) {
472+ LOG_INFO << app_pair.first
473+ << " was enabled after the update reboot; skipping its start during finalization."
474+ " Re-run the update to fetch and install the newly enabled apps." ;
475+ if (!newly_enabled_apps_msg.empty ()) {
476+ newly_enabled_apps_msg += " , " + app_pair.first ;
477+ } else {
478+ newly_enabled_apps_msg = " \n # Newly enabled apps are detected: " + app_pair.first ;
479+ }
480+ continue ;
481+ }
482+ }
483+
466484 const AppEngine::Result run_res = app_engine_->run ({app_pair.first , app_pair.second });
467485 if (!run_res) {
468486 const std::string err_desc{boost::str (
@@ -473,6 +491,7 @@ data::InstallationResult ComposeAppManager::finalizeInstall(const Uptane::Target
473491 // Do we need to set some flag for the uboot and trigger a system reboot in order to boot on a previous
474492 // ostree version, hence a proper/full rollback happens???
475493 ir.description += " , however " + err_desc;
494+ ir.description += newly_enabled_apps_msg;
476495 ir.description += " \n # Apps running:\n " + getRunningAppsInfoForReport ();
477496 // this is a hack to distinguish between ostree install (rollback) and App start failures.
478497 // data::ResultCode::Numeric::kInstallFailed - boot on a new ostree version failed (rollback at boot)
@@ -494,6 +513,9 @@ data::InstallationResult ComposeAppManager::finalizeInstall(const Uptane::Target
494513
495514 app_engine_->prune (app_shortlist);
496515 }
516+ if (!newly_enabled_apps_msg.empty ()) {
517+ ir.description += newly_enabled_apps_msg;
518+ }
497519 }
498520
499521 if (data::ResultCode::Numeric::kNeedCompletion != ir.result_code .num_code ) {
0 commit comments