bootstrap

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

View Source
const StepNameAptInstall = "apt install"

Name of the step registered by [AddAptInstall]. This step will install pending packages enqueued with AddAptPackages. Set any step that uses that to be before this step.

View Source
const StepNameAptUpdate = "apt update"

Name of the step registered by [AddAptUpdate]. Steps that modify apt sources should reference this as a `before` constraint.

Variables

This section is empty.

Functions

func AddAptPackages

func AddAptPackages(ctx *Context, names ...string)

AddAptPackages adds the given package names to the pending list of packages to install. They will be installed by the next `apt install` step, either the "main" one, or one registered by WithExtraAptInstall.

The caller is responsible for ensuring that such a step runs after this.

func ChangedAptSources

func ChangedAptSources(ctx *Context)

ChangedAptSources will mark the apt sources list as dirty, so a secondary `apt update` step registered with WithExtraAptUpdate will actually run.

func Configure

func Configure(opts ...option)

func Get

func Get[T any](ctx *Context, k InfoKey[T]) (T, bool)

func NewPlan

func NewPlan() *plan

func Run

func Run(ctx context.Context) error

func Save

func Save[T any](ctx *Context, k InfoKey[T], v T)

func Sim

func Sim(ctx context.Context) error

func WithAfter

func WithAfter(names ...string) stepOpt

WithAfter adds normal dependencies to the step

func WithAptPackages

func WithAptPackages(
	stepName string,
	packages ...string,
) option

WithAptPackages is an option for Configure that will register a step to mark the given package(s) to be installed by the main `apt install` step.

func WithBefore

func WithBefore(names ...string) stepOpt

WithBefore adds reverse dependencies to the step

func WithChildCmdBuilders

func WithChildCmdBuilders(fns ...func() *cobra.Command) option

func WithChildCmds

func WithChildCmds(cmds ...*cobra.Command) option

func WithExtraAptInstall

func WithExtraAptInstall(name string, opts ...stepOpt) option

WithExtraAptInstall adds a secondary `apt install` step with the given name. It will always run after the main `apt install` step. You may pass additional ordering constraints in the options.

You likely want to pair this with WithExtraAptUpdate, one or more steps to add new apt sources that call ChangedAptSources and AddAptPackages.

func WithExtraAptUpdate

func WithExtraAptUpdate(name string, opts ...stepOpt) option

WithExtraAptUpdate adds a secondary `apt update` step with the given name. It will always run after the main `apt update` step. You may pass additional ordering constraints in the options.

func WithSim

func WithSim(f func(*Context) error) stepOpt

WithSim sets the simulation function that will be run instead of just printing the step name in Sim (dry run) invocations.

func WithSteps

func WithSteps(steps ...*Step) option

Types

type Context

type Context struct {
	context.Context
	// contains filtered or unexported fields
}

func NewContext

func NewContext(ctx context.Context) *Context

func (*Context) Value

func (ctx *Context) Value(key any) any

type InfoKey

type InfoKey[T any] struct {
	// contains filtered or unexported fields
}

func NewKey

func NewKey[T any](name string) InfoKey[T]

type Step

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

func NewStep added in v0.2.0

func NewStep(
	name string,
	run func(*Context) error,
	opts ...stepOpt,
) *Step

NewStep creates a new bootstrap step with the given name and run function.

Dependencies, simulation (dry-run) mode special case, and other options can be set via the additional option arguments.

Directories

Path Synopsis
input module
Package textedit provides helpers for making changes to line-oriented text files.
Package textedit provides helpers for making changes to line-oriented text files.

Jump to

Keyboard shortcuts

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