func checkUpdated()

in updates_check.go [32:65]


func checkUpdated(base string, timeInterval time.Duration) {
	trace("checkUpdated", base)
	olaris_base := joinpath(base, getOpsBranch())
	latest_check_path := joinpath(olaris_base, LATESTCHECK)
	olaris_path := joinpath(olaris_base, "olaris")

	// if no olaris dir, no update check
	if !isDir(olaris_path) {
		return
	}

	// get info on latest_check file
	file, ok := checkLatestFile(latest_check_path)
	if !ok {
		return
	}

	mtime := file.ModTime()
	now := time.Now().Local()
	diff := now.Sub(mtime)

	if diff >= timeInterval {
		fmt.Println("Checking for updates...")
		// touch latest_check file ONLY if enough time has passed
		touchLatestCheckFile(latest_check_path)

		// check if remote olaris is newer
		if checkRemoteOlarisNewer(olaris_path) {
			fmt.Print("New tasks available! Use 'ops -update' to update.\n\n")
		} else {
			fmt.Print("Tasks up to date!\n\n")
		}
	}
}