Example #1
0
//https://github.com/mizzy/specinfra/blob/master/lib/specinfra/helper/detect_os/freebsd.rb
func detectFreebsd(c config.ServerInfo) (itsMe bool, bsd osTypeInterface) {
	bsd = newBsd(c)
	c.Family = "FreeBSD"
	if r := sshExec(c, "uname", noSudo); r.isSuccess() {
		if strings.Contains(r.Stdout, "FreeBSD") == true {
			if b := sshExec(c, "uname -r", noSudo); b.isSuccess() {
				bsd.setDistributionInfo("FreeBSD", strings.TrimSpace(b.Stdout))
				bsd.setServerInfo(c)
				return true, bsd
			}
		}
	}
	Log.Debugf("Not FreeBSD. Host: %s:%s", c.Host, c.Port)
	return false, bsd
}