osrelease

package
v3.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Overview

Package osrelease is to parse a os release file content.

Index

Constants

View Source
const (
	// EtcOsRelease is the path of os-release file.
	EtcOsRelease string = "/etc/os-release"
	// DebianID is the identifier used by the Debian operating system.
	DebianID = "debian"
	// FedoraID is the identifier used by the Fedora operating system.
	FedoraID = "fedora"
	// UbuntuID is the identifier used by the Ubuntu operating system.
	UbuntuID = "ubuntu"
	// RhelID is the identifier used by the Rhel operating system.
	RhelID = "rhel"
	// CentosID is the identifier used by the Centos operating system.
	CentosID = "centos"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	ID         string
	IDLike     string
	Name       string
	PrettyName string
	Version    string
	VersionID  string
}

Data exposes the most common identification parameters.

func Parse

func Parse(content string) (data *Data)

Parse is to parse a os release file content.

func (*Data) IsCentOS

func (d *Data) IsCentOS() bool

IsCentOS will return true for CentOS.

func (*Data) IsLikeDebian

func (d *Data) IsLikeDebian() bool

IsLikeDebian will return true for Debian and any other related OS, such as Ubuntu.

func (*Data) IsLikeFedora

func (d *Data) IsLikeFedora() bool

IsLikeFedora will return true for Fedora and any other related OS, such as CentOS or RHEL.

func (*Data) IsRHEL

func (d *Data) IsRHEL() bool

IsRHEL will return true for RHEL OS.

func (*Data) IsUbuntu

func (d *Data) IsUbuntu() bool

IsUbuntu will return true for Ubuntu OS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL