package setup

import "github.com/purpleidea/mgmt/setup"

Package setup provides some simple facilities to help bootstrap things.

Index

Types

type API

type API interface {
	// Main runs everything for this setup item.
	Main(context.Context) error
}

API is the simple interface we expect for any setup items.

type Config

type Config struct {
}

Config is a struct of all the configuration values which are shared by all of the setup utilities. By including this as a separate struct, it can be used as part of the API if we want.

type Firstboot

type Firstboot struct {
	*cliUtil.SetupFirstbootArgs // embedded config
	Config                      // embedded Config

	// Program is the name of this program, usually set at compile time.
	Program string

	// Version is the version of this program, usually set at compile time.
	Version string

	// Debug represents if we're running in debug mode or not.
	Debug bool

	// Logf is a logger which should be used.
	Logf func(format string, v ...interface{})
}

Firstboot is the standalone entry program for the firstboot setup component.

func (*Firstboot) Main

func (obj *Firstboot) Main(ctx context.Context) error

Main runs everything for this setup item.

func (*Firstboot) Run

func (obj *Firstboot) Run(ctx context.Context) error

Run performs the desired actions. This templates and installs a systemd service and enables and starts it if so desired.

func (*Firstboot) Validate

func (obj *Firstboot) Validate() error

Validate verifies that the structure has acceptable data stored within.

type Pkg

type Pkg struct {
	*cliUtil.SetupPkgArgs // embedded config
	Config                // embedded Config

	// Program is the name of this program, usually set at compile time.
	Program string

	// Version is the version of this program, usually set at compile time.
	Version string

	// Debug represents if we're running in debug mode or not.
	Debug bool

	// Logf is a logger which should be used.
	Logf func(format string, v ...interface{})
}

Pkg is the standalone entry program for the pkg setup component.

func (*Pkg) Main

func (obj *Pkg) Main(ctx context.Context) error

Main runs everything for this setup item.

func (*Pkg) Run

func (obj *Pkg) Run(ctx context.Context) error

Run performs the desired actions. This generates a list of bash commands to run since we might not be able to run this binary to install these packages! The output (stdout) of this command can be run from a shell.

func (*Pkg) Validate

func (obj *Pkg) Validate() error

Validate verifies that the structure has acceptable data stored within.

type Svc

type Svc struct {
	*cliUtil.SetupSvcArgs // embedded config
	Config                // embedded Config

	// Program is the name of this program, usually set at compile time.
	Program string

	// Version is the version of this program, usually set at compile time.
	Version string

	// Debug represents if we're running in debug mode or not.
	Debug bool

	// Logf is a logger which should be used.
	Logf func(format string, v ...interface{})
}

Svc is the standalone entry program for the svc setup component.

func (*Svc) Main

func (obj *Svc) Main(ctx context.Context) error

Main runs everything for this setup item.

func (*Svc) Run

func (obj *Svc) Run(ctx context.Context) error

Run performs the desired actions. This templates and installs a systemd service and enables and starts it if so desired.

func (*Svc) Validate

func (obj *Svc) Validate() error

Validate verifies that the structure has acceptable data stored within.

Source Files

firstboot.go pkg.go setup.go svc.go

Version
v0.0.0-20250322185616-c50a578426f1 (latest)
Published
Mar 22, 2025
Platform
linux/amd64
Imports
7 packages
Last checked
4 days ago

Tools for package owners.