@@ -17,7 +17,6 @@ import (
1717 "errors"
1818 "fmt"
1919 "os"
20- "os/exec"
2120 "path/filepath"
2221 "strconv"
2322 "strings"
@@ -285,8 +284,7 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation, freeSpace bool) err
285284 return err
286285 }
287286
288- systemNew := filepath .Join (partFuture .Partition .MountPoint , "new" )
289- os .RemoveAll (systemNew ) // errors are safe to ignore
287+ systemNew := filepath .Join (partFuture .Partition .MountPoint )
290288
291289 cq .Add (func (args ... interface {}) error {
292290 return partFuture .Partition .Unmount ()
@@ -376,14 +374,6 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation, freeSpace bool) err
376374 PrintVerboseErr ("ABSystem.RunOperation" , 4 , err )
377375 return err
378376 }
379- } else {
380- PrintVerboseInfo ("ABSystemRunOperation" , "Creating a reflink clone of the old system to copy into" )
381- err = exec .Command ("cp" , "--reflink" , "-a" , partFuture .Partition .MountPoint , systemNew ).Run ()
382- if err != nil {
383- PrintVerboseWarn ("ABSystem.RunOperation" , 4.1 , "reflink copy of system failed, falling back to slow copy because:" , err )
384- // can be safely ignored
385- // file system doesn't support CoW
386- }
387377 }
388378
389379 abrootTrans := filepath .Join (partFuture .Partition .MountPoint , "abroot-trans" )
@@ -468,11 +458,6 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation, freeSpace bool) err
468458 return err
469459 }
470460
471- // from this point on, it is not possible to stop the upgrade
472- // so we create the finalizing file. Note that interrupting the upgrade
473- // from this point on will not leave the system in an inconsistent
474- // state, but it could leave the future partition in a dirty state
475- // preventing it from booting.
476461 err = s .createFinalizingFile ()
477462 if err != nil {
478463 PrintVerboseErr ("ABSystem.RunOperation" , 5.3 , err )
@@ -654,43 +639,10 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation, freeSpace bool) err
654639 return partBoot .Unmount ()
655640 }, nil , 100 , & goodies.NoErrorHandler {}, false )
656641
657- // Stage 9: Apply the new rootfs
642+ // Stage 9: Atomic swap the bootloader
658643 // ------------------------------------------------
659644 PrintVerboseSimple ("[Stage 9] -------- ABSystemRunOperation" )
660645
661- err = ClearDirectory (partFuture .Partition .MountPoint , []string {"new" })
662- if err != nil {
663- PrintVerboseErr ("ABSystem.RunOperation" , 10.1 , err )
664- return err
665- }
666-
667- files , err := os .ReadDir (systemNew )
668- if err != nil {
669- PrintVerboseErr ("ABSystem.RunOperation" , 10.2 , err )
670- return err
671- }
672-
673- // Move everything from /part-future/new to /part-future
674- for _ , file := range files {
675- srcPath := filepath .Join (systemNew , file .Name ())
676- dstPath := filepath .Join (partFuture .Partition .MountPoint , file .Name ())
677- err = os .Rename (srcPath , dstPath )
678- if err != nil {
679- PrintVerboseErr ("ABSystem.RunOperation" , 10.3 , err )
680- return err
681- }
682- }
683-
684- err = os .RemoveAll (systemNew )
685- if err != nil {
686- PrintVerboseErr ("ABSystem.RunOperation" , 10.4 , err )
687- return err
688- }
689-
690- // Stage 10: Atomic swap the bootloader
691- // ------------------------------------------------
692- PrintVerboseSimple ("[Stage 10] -------- ABSystemRunOperation" )
693-
694646 grub , err := NewGrub (partBoot )
695647 if err != nil {
696648 PrintVerboseErr ("ABSystem.RunOperation" , 11 , err )
0 commit comments