system

package
v0.0.0-...-b68f367 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2026 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyClosures

func CopyClosures(src System, dest System, paths []string, extraArgs ...string) error

Invoke the `nix-copy-closure` command to copy between two types of systems.

Types

type Command

type Command struct {
	Name   string
	Args   []string
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
	Env    map[string]string
}

func NewCommand

func NewCommand(name string, args ...string) *Command

func (*Command) RunAsRoot

func (c *Command) RunAsRoot(rootCmd string) *Command

func (*Command) SetEnv

func (c *Command) SetEnv(key string, value string)

type CommandRunner

type CommandRunner interface {
	Run(cmd *Command) (int, error)
	Logger() logger.Logger
	HasCommand(cmd string) bool
}

type Filesystem

type Filesystem interface {
	Stat(path string) (os.FileInfo, error)
	ReadLink(path string) (string, error)
	MkdirAll(path string, perm os.FileMode) error
	ReadFile(path string) ([]byte, error)
}

type LocalFilesystem

type LocalFilesystem struct{}

func (LocalFilesystem) MkdirAll

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

func (LocalFilesystem) ReadFile

func (LocalFilesystem) ReadFile(path string) ([]byte, error)
func (LocalFilesystem) ReadLink(name string) (string, error)

func (LocalFilesystem) Stat

func (LocalFilesystem) Stat(path string) (os.FileInfo, error)

type LocalSystem

type LocalSystem struct {
	// contains filtered or unexported fields
}

func NewLocalSystem

func NewLocalSystem(logger logger.Logger) *LocalSystem

func (*LocalSystem) FS

func (l *LocalSystem) FS() Filesystem

func (*LocalSystem) HasCommand

func (l *LocalSystem) HasCommand(name string) bool

func (*LocalSystem) IsNixOS

func (l *LocalSystem) IsNixOS() bool

func (*LocalSystem) IsRemote

func (l *LocalSystem) IsRemote() bool

func (*LocalSystem) Logger

func (l *LocalSystem) Logger() logger.Logger

func (*LocalSystem) Run

func (l *LocalSystem) Run(cmd *Command) (int, error)

type SFTPFilesystem

type SFTPFilesystem struct {
	// contains filtered or unexported fields
}

func NewSFTPFilesystem

func NewSFTPFilesystem(client *sftp.Client) *SFTPFilesystem

func (*SFTPFilesystem) MkdirAll

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

func (*SFTPFilesystem) ReadFile

func (f *SFTPFilesystem) ReadFile(path string) ([]byte, error)
func (f *SFTPFilesystem) ReadLink(path string) (string, error)

func (*SFTPFilesystem) Stat

func (f *SFTPFilesystem) Stat(path string) (os.FileInfo, error)

type SSHSystem

type SSHSystem struct {
	// contains filtered or unexported fields
}

func NewSSHSystem

func NewSSHSystem(host string, log logger.Logger) (*SSHSystem, error)

func (*SSHSystem) Address

func (s *SSHSystem) Address() string

func (*SSHSystem) Close

func (s *SSHSystem) Close()

func (*SSHSystem) EnsureRemoteRootPassword

func (s *SSHSystem) EnsureRemoteRootPassword(rootCmd string) error

func (*SSHSystem) FS

func (s *SSHSystem) FS() Filesystem

func (*SSHSystem) HasCommand

func (s *SSHSystem) HasCommand(name string) bool

func (*SSHSystem) IsNixOS

func (s *SSHSystem) IsNixOS() bool

func (*SSHSystem) IsRemote

func (s *SSHSystem) IsRemote() bool

func (*SSHSystem) Logger

func (s *SSHSystem) Logger() logger.Logger

func (*SSHSystem) Run

func (s *SSHSystem) Run(cmd *Command) (int, error)

type System

type System interface {
	CommandRunner
	IsNixOS() bool
	IsRemote() bool
	FS() Filesystem
}

Jump to

Keyboard shortcuts

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