Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // LookPath is mockable for testing. LookPath = exec.LookPath // ReadFile is mockable for testing. ReadFile = os.ReadFile // RuntimeGOOS is mockable for testing. RuntimeGOOS = runtime.GOOS // OSReleasePaths are the standard paths checked for distro identification. OSReleasePaths = []string{"/etc/os-release", "/usr/lib/os-release"} )
Functions ¶
func HasDocker ¶
func HasDocker() bool
HasDocker returns true if the 'docker' executable is on PATH.
func HasFlatpak ¶
func HasFlatpak() bool
HasFlatpak returns true if the 'flatpak' executable is on PATH.
Types ¶
type DistroInfo ¶
type DistroInfo struct {
ID string
IDLike []string
VersionID string
Name string
PrettyName string
RawOS string // runtime.GOOS
}
DistroInfo contains parsed distribution information from /etc/os-release.
func Detect ¶
func Detect() DistroInfo
Detect probes the operating system and Linux distribution metadata.
func (DistroInfo) IsDebianUbuntu ¶
func (d DistroInfo) IsDebianUbuntu() bool
IsDebianUbuntu returns true if running on Ubuntu, Debian, or derivative.
func (DistroInfo) IsFedora ¶
func (d DistroInfo) IsFedora() bool
IsFedora returns true if running on Fedora or RHEL/CentOS family.
func (DistroInfo) IsLinux ¶
func (d DistroInfo) IsLinux() bool
IsLinux returns true if running on Linux.
func (DistroInfo) IsMacOS ¶
func (d DistroInfo) IsMacOS() bool
IsMacOS returns true if running on Darwin/macOS.
func (DistroInfo) IsRaspberryPi ¶
func (d DistroInfo) IsRaspberryPi() bool
IsRaspberryPi returns true if running on Raspbian / Raspberry Pi OS.
Click to show internal directories.
Click to hide internal directories.