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)

	// Prevent from adding `set -o pipefail` option
	c.Distro = config.Distro{Family: "FreeBSD"}

	if r := exec(c, "uname", noSudo); r.isSuccess() {
		if strings.Contains(r.Stdout, "FreeBSD") == true {
			if b := exec(c, "uname -r", noSudo); b.isSuccess() {
				rel := strings.TrimSpace(b.Stdout)
				bsd.setDistro("FreeBSD", rel)
				return true, bsd
			}
		}
	}
	Log.Debugf("Not FreeBSD. servernam: %s", c.ServerName)
	return false, bsd
}