Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasSystemd ¶
func HasSystemd() bool
HasSystemd checks if the systemd service manager is available.
It checks if systemd is installed by checking for the presence of certain directories and the 'systemctl' command in the PATH.
Returns:
bool: True if systemd service manager is available, false otherwise.
func IsAlpine ¶
func IsAlpine() bool
IsAlpine checks if the current system is running Alpine Linux by reading the contents of the /etc/os-release file.
It returns true if the field "ID" in the /etc/os-release file contains the string "alpine", indicating that Alpine Linux is running. Otherwise, it returns false.
Returns:
bool: True if the system is running Alpine Linux, false otherwise.
func IsArchLinux ¶
func IsArchLinux() bool
IsArchLinux checks if the current system is running Arch Linux by reading the contents of the /etc/os-release file.
It returns true if the field "ID" in the /etc/os-release file contains the string "arch", indicating that Arch Linux is running. Otherwise, it returns false.
Returns:
bool: True if the system is running Arch Linux, false otherwise.
func IsDebian ¶
func IsDebian() bool
IsDebian checks if the current system is running Debian by reading the contents of the /etc/os-release file.
Returns:
bool: True if the system is running Debian, false otherwise.
func IsFedora ¶
func IsFedora() bool
IsFedora checks if the current system is running Fedora by reading the contents of the /etc/os-release file.
Returns:
bool: True if the system is running Fedora, false otherwise.
func IsFreeBSD ¶
func IsFreeBSD() bool
IsFreeBSD checks if the current system is running FreeBSD by reading the contents of the /etc/os-release file.
It returns true if the field "ID" in the /etc/os-release file contains the string "freebsd", indicating that FreeBSD is running. Otherwise, it returns false.
Returns:
bool: True if the system is running FreeBSD, false otherwise.
func IsOpenSUSE ¶
func IsOpenSUSE() bool
IsOpenSUSE checks if the current system is running openSUSE by reading the contents of the /etc/os-release file.
It returns true if the field "ID" in the /etc/os-release file contains the string "opensuse", indicating that openSUSE is running. Otherwise, it returns false.
Returns:
bool: True if the system is running openSUSE, false otherwise.
func IsOpenWrt ¶
func IsOpenWrt() bool
IsOpenWrt checks if the current system is running OpenWrt by reading the contents of the /etc/os-release file.
It returns true if the field "ID" in the /etc/os-release file contains the string "openwrt", indicating that OpenWrt is running. Otherwise, it returns false.
Returns:
bool: True if the system is running OpenWrt, false otherwise.
Types ¶
type OSReleaseField ¶
type OSReleaseField string
OSReleaseField represents a field in the /etc/os-release file.
The /etc/os-release file contains information about the operating system. This file is used by various Linux distributions to provide information about the distribution and its version.
The file contains key-value pairs of the form "KEY=VALUE". The keys and values are separated by an equal sign.
The OSReleaseField type represents a field in the /etc/os-release file.
const OSReleaseFieldID OSReleaseField = "ID"
OSReleaseFieldID is the constant representing the "ID" field in the "/etc/os-release" file.
func (OSReleaseField) String ¶
func (f OSReleaseField) String() string
String returns the string representation of an OSReleaseField.
It returns the string value of the OSReleaseFieldID constant.
The String method satisfies the Stringer interface.
type OSReleaseID ¶
type OSReleaseID string
OSReleaseID represents the ID field in the /etc/os-release file. It is used to identify the distribution of the operating system.
const ( // OSReleaseIDUnknown represents an unknown OS. OSReleaseIDUnknown OSReleaseID = "" // OSReleaseIDDebian represents Debian. OSReleaseIDDebian OSReleaseID = "debian" // OSReleaseIDUbuntu represents Ubuntu. OSReleaseIDUbuntu OSReleaseID = "ubuntu" // OSReleaseIDFedora represents Fedora. OSReleaseIDFedora OSReleaseID = "fedora" // OSReleaseIDFreeBSD represents FreeBSD. OSReleaseIDFreeBSD OSReleaseID = "freebsd" // OSReleaseIDArch represents Arch Linux. OSReleaseIDArch OSReleaseID = "arch" // OSReleaseIDOpenWrt represents OpenWrt. OSReleaseIDOpenWrt OSReleaseID = "openwrt" // OSReleaseIDAlpine represents Alpine Linux. OSReleaseIDAlpine OSReleaseID = "alpine" // OSReleaseIDOpenSUSE represents openSUSE. OSReleaseIDOpenSUSE OSReleaseID = "opensuse" )