Skip to content

Commit

Permalink
creates symlinks back to root
Browse files Browse the repository at this point in the history
  • Loading branch information
taukakao authored and mirkobrombin committed Jun 2, 2024
1 parent f818e46 commit 754cec1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions core/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,31 @@ Options=%s
return nil
}

func (s *ABSystem) CreateRootSymlinks(systemNewPath string) error {
PrintVerboseInfo("ABSystem.CreateRootSymlinks", "creating symlinks")
links := []string{"mnt", "proc", "run", "dev", "media", "root", "sys", "tmp", "var"}

for _, link := range links {
linkName := filepath.Join(systemNewPath, link)

err := os.RemoveAll(linkName)
if err != nil {
PrintVerboseErr("ABSystem.CreateRootSymlinks", 1, err)
return err
}

targetName := filepath.Join("/", link)

err = os.Symlink(targetName, linkName)
if err != nil {
PrintVerboseErr("ABSystem.CreateRootSymlinks", 2, err)
return err
}
}

return nil
}

// RunOperation executes a root-switching operation from the options below:
//
// UPGRADE:
Expand Down Expand Up @@ -730,6 +755,13 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation) error {
return err
}

// Create links back to the root system
err = s.CreateRootSymlinks(systemNew)
if err != nil {
PrintVerboseErr("ABSystem.RunOperation", 7.8, err)
return err
}

// Stage 8: Sync /etc
// ------------------------------------------------
PrintVerboseSimple("[Stage 8] -------- ABSystemRunOperation")
Expand Down

0 comments on commit 754cec1

Please sign in to comment.