Documentation
¶
Index ¶
- Constants
- func Arch() string
- func BuildId() string
- func Id() string
- func ImageId() string
- func ImageVersion() string
- func IsLike(name string) bool
- func Name() string
- func Pretty() string
- func PrettyVariant() string
- func PrettyVersion() string
- func PrintSet()
- func Version() string
- type OsRelease
- func (i *OsRelease) Arch() string
- func (i *OsRelease) BuildId() string
- func (i *OsRelease) Codename() string
- func (i *OsRelease) FromFile(filename string) (*OsRelease, error)
- func (i *OsRelease) Get(key string) (string, error)
- func (i *OsRelease) GetOfficial(key string) string
- func (i *OsRelease) GetUnknown(key string) string
- func (i *OsRelease) Id() string
- func (i *OsRelease) ImageId() string
- func (i *OsRelease) ImageVersion() string
- func (i *OsRelease) IsLike(name string) bool
- func (i *OsRelease) Load() error
- func (i *OsRelease) Name() string
- func (i *OsRelease) Pretty() string
- func (i *OsRelease) PrettyVariant() string
- func (i *OsRelease) PrettyVersion() string
- func (i *OsRelease) Set(key, value string) bool
- func (i *OsRelease) Variant() string
- func (i *OsRelease) Version() string
Constants ¶
const ( // Official fields NAME = "NAME" ID = "ID" ID_LIKE = "ID_LIKE" PRETTY_NAME = "PRETTY_NAME" CPE_NAME = "CPU_NAME" VARIANT = "VARIANT" VARIANT_ID = "VARIANT_ID" VERSION = "VERSION" VERSION_ID = "VERSION_ID" VERSION_CODENAME = "VERSION_CODENAME" BUILD_ID = "BUILD_ID" IMAGE_ID = "IMAGE_ID" IMAGE_VERSION = "IMAGE_VERSION" HOME_URL = "HOME_URL" DOCUMENTATION_URL = "DOCUMENTATION_URL" SUPPORT_URL = "SUPPORT_URL" BUG_REPORT_URL = "BUG_REPORT_URL" PRIVACY_POLICY_URL = "PRIVACY_POLICY_URL" SUPPORT_END = "SUPPORT_END" LOGO = "LOGO" ANSI_COLOR = "ANSI_COLOR" VENDOR_NAME = "VENDOR_NAME" VENDOR_URL = "VENDOR_URL" DEFAULT_HOSTNAME = "DEFAULT_HOSTNAME" ARCHITECTURE = "ARCHITECTURE" SYSEXT_LEVEL = "SYSEXT_LEVEL" CONFEXT_LEVEL = "CONFEXT_LEVEL" SYSEXT_SCOPE = "SYSEXT_SCOPE" CONFEXT_SCOPE = "CONFEXT_SCOPE" PORTABLE_PREFIXES = "PORTABLE_PREFIXES" // File paths to check ETC_OS_RELEASE = `/etc/os-release` USR_LIB_OS_RELEASE = `/usr/lib/os-release` )
constants of os-release official entries
const ( ARCH = `arch` DEBIAN = `debian` FEDORA = `fedora` OPENSUSE = `opensuse` RHEL = `rhel` SUSE = `suse` UBUNTU = `ubuntu` )
Names to match in IsLike to determine what is compatible
const SUPPORTED_SYSTEMD_VERSION = 256
Variables ¶
This section is empty.
Functions ¶
func ImageVersion ¶
func ImageVersion() string
func PrettyVariant ¶
func PrettyVariant() string
func PrettyVersion ¶
func PrettyVersion() string
Types ¶
type OsRelease ¶
type OsRelease struct {
// contains filtered or unexported fields
}
OsRelease uses the standard defined by [https://www.freedesktop.org/software/systemd/man/latest/os-release.html]
func Default ¶
func Default() *OsRelease
Default is used to access the default OsRelease object Shouldn't be needed regularly
func NewOsInfo ¶
func NewOsInfo() *OsRelease
NewOsInfo initializes a new OsInfo struct with the defined defaults of os-release
func (*OsRelease) FromFile ¶
FromFile sets the readFrom attribute. Panics if the given file can't be opened/doesn't exist
func (*OsRelease) Get ¶
Get returns the specified value defined by the given key This method checks official and unknown keys Returns the found value and nil; or an empty string and an error
func (*OsRelease) GetOfficial ¶
GetOfficial only returns the value of the official keys returns an empty string if the key isn't set
func (*OsRelease) GetUnknown ¶
GetUnknown only checks the unknown keys returns an empty string if nothing is found
func (*OsRelease) ImageVersion ¶
ImageVersion returns the value of IMAGE_VERSION
func (*OsRelease) PrettyVariant ¶
PrettyVariant returns the value of VARIANT
func (*OsRelease) PrettyVersion ¶
PrettyVersion returns the value of VERSION
func (*OsRelease) Set ¶
Set a value for the specified key returns true if the key is officially supported