osrelease – github.com/ashcrow/osrelease Index | Files | Directories

package osrelease

import "github.com/ashcrow/osrelease"

Package osrelease package provides access to parsed os-release information

Index

Types

type OSRelease

type OSRelease struct {
	NAME               string            // OS Identifier
	VERSION            string            // Full OS Version
	ID                 string            // Lowercase OS identifier
	ID_LIKE            string            // Coma seperated list of closely related OSes
	VERSION_ID         string            // Lowercase OS version
	VERSION_CODENAME   string            // Lowercase OS release codename
	PRETTY_NAME        string            // Human presented OS/Release name
	ANSI_COLOR         string            // Suggested color for showing OS name
	CPE_NAME           string            // See http://scap.nist.gov/specifications/cpe/
	HOME_URL           string            // Main link for the OS
	BUG_REPORT_URL     string            // Bug report link for the OS
	PRIVACY_POLICY_URL string            // Privacy policy link for the OS
	VARIANT            string            // Human presnted OS Variant
	VARIANT_ID         string            // Lowercase OS Variant identifier
	ADDITIONAL_FIELDS  map[string]string // Custom/unsupported fields
	// contains filtered or unexported fields
}

OSRelease implements the format noted at https://www.freedesktop.org/software/systemd/man/os-release.html

func New

func New() (OSRelease, error)

New creates and returns a new insance of OSRelease. Generally New should be used to create a new instance.

func NewWithOverrides

func NewWithOverrides(etcOverridePath, usrOverridePath string) (OSRelease, error)

NewWithOverrides creates and returns a new instance of OSRelease using the paths passed in.

func (*OSRelease) GetField

func (o *OSRelease) GetField(key string) (string, error)

GetField returns a field from the instance. If the field is not present then an error us returned.

func (*OSRelease) Populate

func (o *OSRelease) Populate(paths []string) error

Populate reads the os-release file, parses it, and sets fields for use.

func (*OSRelease) SetField

func (o *OSRelease) SetField(key, value string)

SetField sets a field on an instance of OSRelease. If the field is not a supported field it will be added to ADDITIONAL_FIELDS.

Source Files

osrelease.go

Directories

PathSynopsis
cmd
Version
v0.0.0-20180626175927-9b292693c55c (latest)
Published
Jun 26, 2018
Platform
js/wasm
Imports
4 packages
Last checked
now

Tools for package owners.