Documentation
¶
Overview ¶
Package os is the os behavior: the operating system of the host, its distribution and version.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Behavior = behavior.Register(behavior.Define( "os", "Get the operating system of target hosts", behavior.Title("OS"), behavior.Node, behavior.API, behavior.Area(area.Node), behavior.CLI, behavior.Platform(behavior.PlatformLinux, newReader), behavior.Platform(behavior.PlatformDarwin, newReader), behavior.RunsOnPlatform(behavior.PlatformDarwin, "sw_vers"), behavior.Read("get", Get). Describe("Get the operating system of the host"). Explain("Reads the distribution and its version: the ID and VERSION_ID of "+ "/etc/os-release on Linux, and darwin with the ProductVersion of sw_vers on "+ "macOS, such as darwin 15.5."). Example("An Ubuntu host", GetInput{}, Entry{OSInfo: Release{Distribution: "ubuntu", Version: "24.04"}}, behavior.OnPlatform(behavior.PlatformLinux), behavior.Exists("/etc/os-release", "NAME=\"Ubuntu\"\nID=ubuntu\nVERSION_ID=\"24.04\"\n"), ). Example("A Mac", GetInput{}, Entry{OSInfo: Release{Distribution: "darwin", Version: "15.5"}}, behavior.OnPlatform(behavior.PlatformDarwin), behavior.Prints("sw_vers", "ProductName:\t\tmacOS\nProductVersion:\t\t15.5\nBuildVersion:\t\t24F74\n"), ), ))
Behavior is the os definition.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
OSInfo Release `json:"os_info" doc:"The operating system"`
}
Entry is the host's operating system.
Click to show internal directories.
Click to hide internal directories.