Documentation ¶
Index ¶
- func DecodeRecoveryToken(recoverytoken string) []string
- func EncodeRecoveryToken(data ...string) string
- func Exists(path string) bool
- func ExtractOCIImage(img v1.Image, targetDestination string) error
- func FindCommand(def string, options []string) string
- func Flavor() string
- func GetCurrentPlatform() string
- func GetImage(targetImage, targetPlatform string) (v1.Image, error)
- func GetInit() string
- func GetInterfaceIP(in string) string
- func GetOCIImageSize(targetImage, targetPlatform string) (int64, error)
- func IsOpenRCBased() bool
- func K3sBin() string
- func ListOutput(rels []string, output string) []string
- func ListToOutput(rels []string, output string) []string
- func Name() string
- func OSRelease(key string, file ...string) (string, error)
- func OnSignal(fn func(), sig ...os.Signal)
- func PowerOFF()
- func PrintBanner(d []byte)
- func Prompt(t string) (string, error)
- func RandStringRunes(n int) string
- func Reboot()
- func SH(c string) (string, error)
- func SHInDir(c, dir string, envs ...string) (string, error)
- func SetEnv(env []string)
- func Shell() *exec.Cmd
- func ShellSTDIN(s, c string) (string, error)
- func UUID() string
- func Version() string
- func WriteEnv(envFile string, config map[string]string) error
- type CleanJob
- type CleanStack
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeRecoveryToken ¶ added in v0.0.2
func EncodeRecoveryToken ¶ added in v0.0.2
func ExtractOCIImage ¶ added in v0.0.3
ExtractOCIImage will extract a given targetImage into a given targetDestination
func FindCommand ¶
func GetCurrentPlatform ¶ added in v0.0.3
func GetCurrentPlatform() string
GetCurrentPlatform returns the current platform in docker style `linux/amd64` for use with image utils
func GetImage ¶ added in v0.0.17
GetImage if returns the proper image to pull with transport and auth tries local daemon first and then fallbacks into remote
func GetInterfaceIP ¶ added in v0.0.2
func GetOCIImageSize ¶ added in v0.0.12
func IsOpenRCBased ¶ added in v0.0.2
func IsOpenRCBased() bool
func ListOutput ¶ added in v0.0.2
func ListToOutput ¶ added in v0.0.2
func OSRelease ¶
OSRelease finds the value of the specified key in the /etc/os-release file or, if a second argument is passed, on the file specified by the second argument. (optionally file argument is there for testing reasons).
func PrintBanner ¶ added in v0.0.2
func PrintBanner(d []byte)
func RandStringRunes ¶ added in v0.0.2
func ShellSTDIN ¶ added in v0.0.2
Types ¶
type CleanStack ¶ added in v0.0.10
type CleanStack struct {
// contains filtered or unexported fields
}
CleanStack is a basic LIFO stack that resizes as needed.
func NewCleanStack ¶ added in v0.0.10
func NewCleanStack() *CleanStack
NewCleanStack returns a new stack. It's used to push jobs into it that need to be executed in order, like unmounting disks or removing dirs, and it will run those jobs in the order they were pushed into it to maintain order So you can create a dir, push its removal into the stack, mount something into that dir and push its unmounting into the stack and when cleanup is triggered it will first unmount and then remove the dir Usually its setup inside a function with a defer immediately so it auto cleans if you return from anywhere in the function That way you don't need to track on each return what needs to be cleaned and whatnot cleanup := utils.NewCleanStack() defer func() { err = cleanup.Cleanup(err) }()
func (*CleanStack) Cleanup ¶ added in v0.0.10
func (clean *CleanStack) Cleanup(err error) error
Cleanup runs the whole cleanup stack. In case of error it runs all jobs and returns the first error occurrence.
func (*CleanStack) Pop ¶ added in v0.0.10
func (clean *CleanStack) Pop() CleanJob
Pop removes and returns a node from the stack in last to first order.
func (*CleanStack) Push ¶ added in v0.0.10
func (clean *CleanStack) Push(job CleanJob)
Push adds a node to the stack