package host import ( "fmt" "os" "path/filepath" "github.com/carlosframework/platform/internal/moves" ) // A bound constrains replacement only while a certified copy meeting it is // available. The executor itself remains runnable so it can repair the box. func rootFloorAvailable(opt string, bound *moves.Floor, seeds bool, candidate string) bool { if bound == nil { return false } for _, path := range []string{systemBinaryPath(opt), systemPrevPath(opt), filepath.Join(systemRootDir(opt), "staging", "carlos"), candidate} { if path == "" { continue } b, err := readRootFloorBinary(opt, path) if seeds { b = b.forSeeds() } if err == nil && b.supports(bound) { return true } } return false } func (a *systemApplier) activationFloor(floor *moves.Floor, seeds bool) *moves.Floor { if _, required, err := a.rootMoves.read(); err != nil || !required || floor == nil { return floor } if rootFloorAvailable(a.optDir, floor, seeds, "") { return floor } if !a.floorAlerted { rootFloorAlert() a.floorAlerted = true } return nil } func rootFloorAlert() { fmt.Fprintln(os.Stderr, "<1>"+errRootFloorHistory.Error()) }