Ensure bundle is registered and cached when modifying machine state.
#5702
Sean Hall committed
Mar 9, 2021 at 14:05 UTC
778b65643f19df94947d390a5a17023043d840b4
1 file changed
+13
-20
src/engine/plan.cpp
+13
-20
@@ -523,6 +523,19 @@ extern "C" HRESULT PlanRegistration(
523
524
pPlan->fDisallowRemoval = FALSE; // by default the bundle can be planned to be removed
525
526
+ // Ensure the bundle is cached if not running from the cache.
527
+ if (!CacheBundleRunningFromCache())
528
+ {
529
+ pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
530
+ }
531
+
532
+ // Always write registration since things may have changed or it just needs to be "fixed up".
533
+ pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
534
+
535
+ // Always update our estimated size registration when installing/modify/repair since things
536
+ // may have been added or removed or it just needs to be "fixed up".
537
+ pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE;
538
+
539
if (BOOTSTRAPPER_ACTION_UNINSTALL == pPlan->action)
540
{
541
// If our provider key was detected and it points to our current bundle then we can
@@ -621,26 +634,6 @@ extern "C" HRESULT PlanRegistration(
634
{
635
BOOL fAddonOrPatchBundle = (pRegistration->cAddonCodes || pRegistration->cPatchCodes);
636
624
- // If the bundle is not cached or will not be cached after restart, ensure the bundle is cached.
625
- if (!FileExistsAfterRestart(pRegistration->sczCacheExecutablePath, NULL))
626
- {
627
- pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
628
- pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
629
- }
630
- else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action && !CacheBundleRunningFromCache()) // repairing but not running from the cache.
631
- {
632
- pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_CACHE_BUNDLE;
633
- pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
634
- }
635
- else if (BOOTSTRAPPER_ACTION_REPAIR == pPlan->action) // just repair, make sure the registration is "fixed up".
636
- {
637
- pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_WRITE_REGISTRATION;
638
- }
639
-
640
- // Always update our estimated size registration when installing/modify/repair since things
641
- // may have been added or removed or it just needs to be "fixed up".
642
- pPlan->dwRegistrationOperations |= BURN_REGISTRATION_ACTION_OPERATIONS_UPDATE_SIZE;
643
-
637
// Always plan to write our provider key registration when installing/modify/repair to "fix it"
638
// if broken.
639
pPlan->dependencyRegistrationAction = BURN_DEPENDENCY_REGISTRATION_ACTION_REGISTER;