Documentation ¶
Index ¶
- Variables
- type Arch
- type OS
- func (os OS) CmdFSHome(c client.Client, usr string) (string, error)
- func (os OS) CmdFSTempDir() string
- func (os OS) CmdPkgInstallBinary(c client.Client, usr, name string, b []byte) error
- func (os OS) CmdPkgWriteConfig(c client.Client, usr, name string, b []byte) error
- func (os OS) CmdSSHCopyID(c client.Client, usr string, key []byte) error
- func (os OS) CmdSSHGenerateKeyPair(c client.Client, path string) error
- func (os OS) CmdSSHGetHostKeys(c client.Client, host string, port int) ([]string, error)
- func (os OS) CmdSSHGetKeysPath(c client.Client, usr string) (string, error)
- func (os OS) CmdUserChangePasswd(c client.Client, usr, pwd string) error
- func (os OS) CmdUserCreate(c client.Client, name, pwd string) error
- func (os OS) CmdUserDisable(c client.Client, usr string) error
- func (os OS) CmdUserGID(c client.Client, usr string) (int, error)
- func (os OS) CmdUserMakeAdmin(c client.Client, usr string) error
- func (os OS) CmdUserUID(c client.Client, usr string) (int, error)
- func (os OS) DetectDistro(c client.Client) (string, string, error)
- func (os OS) DetectVersion(c client.Client) (string, error)
- func (os OS) IsUnix() bool
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedOS = errors.New("os not supported yet")
ErrUnsupportedOS is an error that gets returned when the command is not supported in the OS
Functions ¶
This section is empty.
Types ¶
type Arch ¶
type Arch int
Arch is the architecture of a CPU
func ArchFromString ¶
ArchFromString returns an Arch based on a string
type OS ¶
type OS int
OS is an Operative System
const ( // Unknown is a not known OS Unknown OS = iota // Linux is a Linux OS Linux // Windows is a Microsoft Windows OS Windows // Darwin is a macOS OS Darwin // AIX is an IBM AIX OS AIX // Dragonfly is a Dragonfly BSD OS Dragonfly // FreeBSD is a FreeBSD OS FreeBSD // NetBSD is a NetBSD OS NetBSD // OpenBSD is an OpenBSD OS OpenBSD // Plan9 is a Plan9 OS Plan9 // Solaris is a Solaris OS Solaris )
func (OS) CmdFSHome ¶
CmdFSHome returns the home directory of an user Heavily inspired (aka mostly copied) from github.com/mitchellh/go-homedir
func (OS) CmdFSTempDir ¶
CmdFSTempDir returns the absolute path of the tmp dir
func (OS) CmdPkgInstallBinary ¶
CmdPkgInstallBinary installs a binary in a system
func (OS) CmdPkgWriteConfig ¶
CmdPkgWriteConfig writes the configuration of a DRLM program
func (OS) CmdSSHCopyID ¶
CmdSSHCopyID copies the key to the OS
func (OS) CmdSSHGenerateKeyPair ¶
CmdSSHGenerateKeyPair generates an RSA 4096 key pair and saves them to the path as `id_rsa` and `id_rsa.pub`
func (OS) CmdSSHGetHostKeys ¶
CmdSSHGetHostKeys returns the public SSH keys of a host
func (OS) CmdSSHGetKeysPath ¶
CmdSSHGetKeysPath returns the SSH keys directory
func (OS) CmdUserChangePasswd ¶
CmdUserChangePasswd changes the password of an user
func (OS) CmdUserCreate ¶
CmdUserCreate creates a new user in the OS
func (OS) CmdUserDisable ¶
CmdUserDisable disables an user
func (OS) CmdUserGID ¶
CmdUserGID returns the gid of an user
func (OS) CmdUserMakeAdmin ¶
CmdUserMakeAdmin makes an user administrator
func (OS) CmdUserUID ¶
CmdUserUID returns the uid of an user
func (OS) DetectDistro ¶
DetectDistro returns the OS distro and distro version (or the OS equivalent)
func (OS) DetectVersion ¶
DetectVersion returns the OS version