Documentation ¶
Overview ¶
Package units implements logic to build TwitchyLinux as a series of units.
Index ¶
- Variables
- func CheckSHA256(path, wantHash string) error
- func CmdCombined(ctx context.Context, bin string, args ...string) (string, error)
- func CmdOutput(ctx context.Context, bin string, args ...string) (string, error)
- func CompareExtractSemver(version, wantVersion string) (int, error)
- func CopyResource(ctx context.Context, opts *Opts, resourcePath, toPath string) error
- func DownloadFile(ctx context.Context, opts *Opts, url, outPath string) error
- func FindBinary(bin string) (string, error)
- func InstallConfigResources(ctx context.Context, opts *Opts, base, resourceDir string) error
- func Shell(ctx context.Context, opts *Opts, bin string, args ...string) error
- type Append
- type CheckHash
- type Chroot
- func (c *Chroot) AptInstall(ctx context.Context, opts *Opts, packages ...string) error
- func (c *Chroot) Close() error
- func (c *Chroot) CmdContext(ctx context.Context, opts *Opts, bin string, args ...string) (*exec.Cmd, error)
- func (c *Chroot) Shell(ctx context.Context, opts *Opts, bin string, args ...string) error
- type Clean
- type Cmd
- type Composite
- type Debootstrap
- type Download
- type EnableUnit
- type FileInfo
- type FinalizeApt
- type Gnome
- type Grub2
- type GrubColorPair
- type InstallFiles
- type InstallTools
- type Installer
- type Linux
- type Locale
- type Logger
- type Mkdir
- type OptPackage
- type Opts
- type Preflight
- type ShellCustomization
- type Systemd
- type Unit
- type UserSpec
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotMountpoint is returned from mountpointType if the given path // was not a mountpoint. ErrNotMountpoint = errors.New("not a mountpoint") )
Functions ¶
func CheckSHA256 ¶
CheckSHA256 compares the hash of the file with wantHash, returning an error is a mismatch occurs.
func CmdCombined ¶
CmdCombined returns the full standard output and standard error for the invocation of the provided binary given the provided arguments.
func CmdOutput ¶
CmdOutput returns the full standard output of invoking the given binary given the provided arguments.
func CompareExtractSemver ¶
CompareExtractSemver extracts a semver from the version string, returning the result of a version comparison with wantVersion.
func CopyResource ¶
CopyResource copies a file from the resource directory into the system. Both paths are relative to the resource and base system directory respectively.
func DownloadFile ¶
DownloadFile downloads a file.
func FindBinary ¶
FindBinary returns the full path to the binary specified by resolving paths registered in the PATH environment variable.
func InstallConfigResources ¶
InstallConfigResources copies config files within resourceDir into the directory at base. Both paths are relative to the resouce and base system directory respectively.
Types ¶
type Chroot ¶
type Chroot struct { Dir string // contains filtered or unexported fields }
Chroot represents a directory configured to be used as a chroot.
func (*Chroot) AptInstall ¶
AptInstall installs the given packages.
type Debootstrap ¶
Debootstrap bootstraps the base debian system.
type FinalizeApt ¶
type FinalizeApt struct {
Track string
}
FinalizeApt configures apt into an ideal state.
type Grub2 ¶
type Grub2 struct { DistroName string Quiet bool ColorNormal GrubColorPair ColorHighlight GrubColorPair }
Grub2 is a unit which installs Grub2.
type GrubColorPair ¶
type GrubColorPair struct {
FG, BG string
}
GrubColorPair describes a color pair in grub config.
type InstallFiles ¶
InstallFiles installs files into the target system.
type InstallTools ¶
InstallTools is a unit which installs packages from apt.
type Installer ¶
type Installer struct { }
Installer is a unit which installs the graphical installer.
type Logger ¶
type Logger interface { Stderr() io.Writer Stdout() io.Writer SetSubstage(string) SetProgress(msg string, fraction float64) }
Logger implements status reporting and logging for executing units.
type Mkdir ¶
type Mkdir struct {
Dir string
}
Mkdir represents the execution of mkdir on the target system.
type OptPackage ¶
OptPackage is a unit which installs packages from apt.
type Opts ¶
type Opts struct { // Dir represents the path the system is being built at. Dir string // Resources is the path to the builder resources directory. Resources string // Version is the current version of TwitchyLinux. Version string // Num indicates which unit (in execution order) the unit is. Num int // L is a logger which units can use to communicate state. L Logger // NumThreads is the number of concurrent threads to be used while building. NumThreads int DebProxy string }
Opts describes options provided to the units.
type Preflight ¶
type Preflight struct{}
Preflight checks the building system has the requisite packages and programs installed.
type ShellCustomization ¶
type ShellCustomization struct { AdditionalSkel []byte AdditionalProfileScripts map[string][]byte Users []UserSpec }
ShellCustomization is a unit which customizes the accounts + shell.
type Systemd ¶
type Systemd struct { }
Systemd is a unit which installs systemd and sets up basic configuration.
Source Files ¶
- unit_clean.go
- unit_composite.go
- unit_debootstrap.go
- unit_finalizeapt.go
- unit_gnome.go
- unit_grub.go
- unit_installer.go
- unit_installfiles.go
- unit_installtools.go
- unit_linux.go
- unit_locale.go
- unit_optpackage.go
- unit_preflight.go
- unit_shellcustomization.go
- unit_systemd.go
- units.go
- utils.go
- utils_chroot.go