diff --git a/core/system.go b/core/system.go index 66797730..fe90c025 100644 --- a/core/system.go +++ b/core/system.go @@ -679,6 +679,17 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation) error { labels["ABRoot.BaseImageDigest"] = imageDigest } + // Stage 3.1: Delete old image + switch operation { + case DRY_RUN_UPGRADE, DRY_RUN_APPLY, DRY_RUN_INITRAMFS: + default: + err = DeleteImageForRoot(futurePartition.Label) + if err != nil { + PrintVerboseErr("ABSystemRunOperation", 3.4, err) + return err + } + } + imageRecipe := NewImageRecipe( imageName, labels, @@ -803,13 +814,6 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation) error { return nil } - // Stage 6.3: Delete old image - err = DeleteImageForRoot(futurePartition.Label) - if err != nil { - PrintVerboseErr("ABSystemRunOperation", 6.3, err) - return err - } - // Stage 7: Update the bootloader // ------------------------------------------------ PrintVerboseSimple("[Stage 7] -------- ABSystemRunOperation")