utils

package
v0.0.0-...-05f81da Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClearVersion string

ClearVersion is running version of the OS

View Source
var Locale *gotext.Locale

Locale is used to access the localization functions

Functions

func CopyAllFiles

func CopyAllFiles(srcDir string, destDir string) error

CopyAllFiles copy all of the files in a directory recursively

func CopyFile

func CopyFile(src string, dest string) error

CopyFile copies src file to dest

func ExpandVariables

func ExpandVariables(vars map[string]string, str string) string

ExpandVariables iterates over vars map and replace all the occurrences of ${var} or $var in the str string

func FileExists

func FileExists(filePath string) (bool, error)

FileExists returns true if the file or directory exists else it returns false and the associated error

func HostHasEFI

func HostHasEFI() bool

HostHasEFI check if the running host supports EFI booting

func IntSliceContains

func IntSliceContains(is []int, value int) bool

IntSliceContains returns true if is contains value, returns false otherwise

func IsCheckCoverage

func IsCheckCoverage() bool

IsCheckCoverage returns true if CHECK_COVERAGE variable is set

func IsClearLinux

func IsClearLinux() bool

IsClearLinux checks if the current OS is Clear by looking for Swupd Mostly used in Go Testing

func IsLatestVersion

func IsLatestVersion(version string) bool

func IsRoot

func IsRoot() bool

IsRoot checks if the current User is root (UID 0) Mostly used in Go Testing

func IsStdoutTTY

func IsStdoutTTY() bool

IsStdoutTTY returns true if the stdout is attached to a tty

func IsVirtualBox

func IsVirtualBox() bool

IsVirtualBox returns true if the running system is executed from within VirtualBox Attempt to parse the System Management BIOS (SMBIOS) and Desktop Management Interface (DMI) to determine if we are executing inside a VirtualBox. Ignoring error conditions and assuming we are not VirtualBox.

func LookupISOTemplateDir

func LookupISOTemplateDir() (string, error)

LookupISOTemplateDir returns the directory to use for reading template files for ISO creation. It will look in the local developers build area first, or the ENV variable, and finally the standard system install location

func LookupLocaleDir

func LookupLocaleDir() (string, error)

LookupLocaleDir returns the directory to use for reading locale files for the UI.

func LookupThemeDir

func LookupThemeDir() (string, error)

LookupThemeDir returns the directory to use for reading theme files for the UI.

func MkdirAll

func MkdirAll(path string, perm os.FileMode) error

MkdirAll similar to go's standard os.MkdirAll() this function creates a directory named path, along with any necessary parents but also checks if path exists and takes no action if that's true.

func ParseOSClearVersion

func ParseOSClearVersion() error

ParseOSClearVersion parses the current version of the Clear Linux OS

func RunDiskPartitionTool

func RunDiskPartitionTool(tmpYaml string, lockFile string, diskUtilCmd string,
	remove []string, gui bool) (string, error)

RunDiskPartitionTool creates and executes a script which launches the disk partitioning tool and then returns to the installer.

func SetLocale

func SetLocale(language string)

SetLocale sets the locale of the installer based on the selected language

func StringSliceContains

func StringSliceContains(sl []string, str string) bool

StringSliceContains returns true if sl contains str, returns false otherwise

func VerifyRootUser

func VerifyRootUser() string

VerifyRootUser returns an error if we're not running as root

func VersionStringUint

func VersionStringUint(versionString string) (uint, error)

VersionStringUint converts string version to an uint version

func VersionUintString

func VersionUintString(versionUint uint) string

VersionUintString converts an uint version to the string version

Types

This section is empty.

Jump to

Keyboard shortcuts

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