package controller

import (
	"io/ioutil"
	"netease_control_center/interfaces/log"
	"strings"
	"time"
)

const (
	bootfilepath = "/tmp/booting_state"
	successtext  = "done"
)

func WaitBootDone() error {
	for {
		by, byerr := ioutil.ReadFile(bootfilepath)
		if byerr == nil && strings.Contains(string(by), successtext) {
			log.Println(log.DebugLog, "System done, continue")
			return nil
		} else {
			time.Sleep(100 * time.Millisecond)
		}
	}
}
