From 778b65643f19df94947d390a5a17023043d840b4 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Tue, 9 Mar 2021 14:05:08 -0600 Subject: Ensure bundle is registered and cached when modifying machine state. #5702 --- src/engine/plan.cpp | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/engine/plan.cpp b/src/engine/plan.cpp index d6cc63ad..4f29209f 100644 --- a/src/engine/plan.cpp +++ b/src/engine/plan.cpp @@ -523,6 +523,19 @@ extern "C" HRESULT PlanRegistration( pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed + // Ensure the bundle is cached if not running from the cache. + if (!CacheBundleRunningFromCache()) + { + pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE; + } + + // Always write registration since things may have changed or it just needs to be "fixed up". + pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION; + + // Always update our estimated size registration when installing/modify/repair since things + // may have been added or removed or it just needs to be "fixed up". + pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE; + if (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action) { // If our provider key was detected and it points to our current bundle then we can @@ -621,26 +634,6 @@ extern "C" HRESULT PlanRegistration( { BOOL fAddonOrPatchBundle = (pRegistration->cAddonCodes || pRegistration->cPatchCodes); - // If the bundle is not cached or will not be cached after restart, ensure the bundle is cached. - if (!FileExistsAfterRestart(pRegistration->sczCacheExecutablePath, NULL)) - { - pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE; - pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION; - } - else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action && !CacheBundleRunningFromCache()) // repairing but not running from the cache. - { - pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE; - pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION; - } - else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action) // just repair, make sure the registration is "fixed up". - { - pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION; - } - - // Always update our estimated size registration when installing/modify/repair since things - // may have been added or removed or it just needs to be "fixed up". - pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE; - // Always plan to write our provider key registration when installing/modify/repair to "fix it" // if broken. pPlan->dependencyRegistrationAction = BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER; -- cgit v1.2.3-55-g6feb