Documentation
¶
Overview ¶
linuxdistroengine is a Go package that returns the name of the Linux distro being run. This is the main file that actually serves as the importable package.
The primary method that returns the name (or at least the family) of the current Linux distro is the DistroResult() method.
Possible DistroResult() string arguments:
"id": Print the basic, minimal ID "k": Print the kernel version of the distro "pn": Print the 'Pretty Name' of the distro, often including the version number "v": Print the version of this engine
The DistroResult() method also provides the following error Codes:
0: Complete, correct completion 1: OS run is NOT Linux 2: 'uname -r' command failed 3: /etc/os-release and /lib/os-release not found 4: Required section (ID & PRETTY_NAME) not found in os-release file 5: Invalid argument for DistroResult() method 44: Distro nor family not found (reference to HTTP 404 error) 254: Developer has not yet set error
Index ¶
Constants ¶
View Source
const ( SHORT_VERSION string = "1.0.0" VERSION_NAME string = "August 19th 2024" DEV_VERSION string = "-release" LONG_VERSION string = "v" + SHORT_VERSION + DEV_VERSION + " (" + VERSION_NAME + ")" )
Version constants
View Source
const ( DEFAULT string = "UNKNOWN_DISTRO" INVALID string = "INVALID_OPERATION" OSRELEASE_AMOUNT int = 2 )
Functional package constants
Variables ¶
View Source
var OSRELEASEFILE [OSRELEASE_AMOUNT]string = [OSRELEASE_AMOUNT]string{"/etc/os-release", "/lib/os-release"}
An array containing potential paths to the os-release file
Functions ¶
func DistroResult ¶
Returns result of the Linux Distro Engine (see top of page for details)
func OSReleaseFileExist ¶
Checks if the os-release file exists, based on the OSRELEASEFILE[] field
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.