modules

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeCopy    = "copy"
	TypeInclude = "include"
	TypeLink    = "link"
	TypeMerge   = "merge"
	TypeMkdir   = "mkdir"
	TypeMove    = "move"
	TypeNetwork = "network"
	TypeRemove  = "remove"
	TypeReplace = "replace"
	TypeShell   = "shell"
	TypeSystemd = "systemd"
)

Variables

View Source
var EtcHostname = "/etc/hostname"
View Source
var EtcHosts = "/etc/hosts"

Functions

func GetEnvFromOutput

func GetEnvFromOutput(bytes string) map[string]string

Types

type CopyBody

type CopyBody struct {
	// Путь до файла, кого копировать
	Source string `yaml:"source,omitempty" json:"source,omitempty" required:""`

	// Путь до файла, куда копировать
	Destination string `yaml:"destination,omitempty" json:"destination,omitempty" required:""`

	// Заменять ли destination
	Replace bool `yaml:"replace,omitempty" json:"replace,omitempty"`
}

func (*CopyBody) Check

func (b *CopyBody) Check() error

func (*CopyBody) Execute

func (b *CopyBody) Execute(_ context.Context, _ build.RuntimeContext) (any, error)

type IncludeBody

type IncludeBody struct {
	// yml конфиги для выполнения
	Targets []string `yaml:"targets,omitempty" json:"targets,omitempty" required:""`
}

func (*IncludeBody) Execute

func (b *IncludeBody) Execute(ctx context.Context, svc build.RuntimeContext) (any, error)

func (*IncludeBody) IncludeTargets

func (b *IncludeBody) IncludeTargets() []string

IncludeTargets сообщает цели include движку для рекурсивной валидации.

type LinkBody

type LinkBody struct {
	// Где создать ссылку, абсолютный путь
	Target string `yaml:"target,omitempty" json:"target,omitempty" required:""`

	// Куда она будет вести
	To string `yaml:"to,omitempty" json:"to,omitempty" required:""`

	// Заменить ли target
	Replace bool `yaml:"replace,omitempty" json:"replace,omitempty"`
}

func (*LinkBody) Execute

func (b *LinkBody) Execute(_ context.Context, _ build.RuntimeContext) (any, error)

type MergeBody

type MergeBody struct {
	// Путь до файла, содержимое которого нужно взять
	Source string `yaml:"source,omitempty" json:"source,omitempty" required:""`

	// Путь до файла, куда нужно добавить содержимое
	Destination string `yaml:"destination,omitempty" json:"destination,omitempty" required:""`

	// Права для создания файла в формате rwxrwxrwx, если он не существует
	CreateFilePerm string `yaml:"create-file-perm,omitempty" json:"create-file-perm,omitempty"`

	// Добавлять ли содержимое в начало файла
	Prepend bool `yaml:"prepend,omitempty" json:"prepend,omitempty"`
}

func (*MergeBody) Execute

func (b *MergeBody) Execute(_ context.Context, _ build.RuntimeContext) (any, error)

type MkdirBody

type MkdirBody struct {
	// Пути, по которым нужно создать директории
	Targets []string `yaml:"targets,omitempty" json:"targets,omitempty" required:""`

	// Права у директорий в формате rwxrwxrwx
	Perm string `yaml:"perm,omitempty" json:"perm,omitempty" required:""`
}

func (*MkdirBody) Execute

func (b *MkdirBody) Execute(_ context.Context, _ build.RuntimeContext) (any, error)

type MoveBody

type MoveBody struct {
	// Что
	Source string `yaml:"source,omitempty" json:"source,omitempty" required:""`

	// Куда
	Destination string `yaml:"destination,omitempty" json:"destination,omitempty" required:""`

	// Заменить объект по destination
	Replace bool `yaml:"replace,omitempty" json:"replace,omitempty"`

	// Создать ссылку из родительской директории цели на назначение
	CreateLink bool `yaml:"create-link,omitempty" json:"create-link,omitempty"`
}

func (*MoveBody) Execute

func (b *MoveBody) Execute(ctx context.Context, svc build.RuntimeContext) (any, error)

type NetworkBody

type NetworkBody struct {
	// Hostname in image
	Hostname string `yaml:"hostname,omitempty" json:"hostname,omitempty" required:""`
}

func (*NetworkBody) Execute

func (b *NetworkBody) Execute(_ context.Context, _ build.RuntimeContext) (any, error)

type RemoveBody

type RemoveBody struct {
	// Путь до объектов, которые нужно удалить
	Targets []string `yaml:"targets,omitempty" json:"targets,omitempty" required:""`

	// Очистить объекты вместо удаления
	Inside bool `yaml:"inside,omitempty" json:"inside,omitempty"`
}

func (*RemoveBody) Execute

func (b *RemoveBody) Execute(_ context.Context, _ build.RuntimeContext) (any, error)

type ReplaceBody

type ReplaceBody struct {
	// Путь до файла
	Target string `yaml:"target,omitempty" json:"target,omitempty" required:""`

	// Regex шаблон
	Pattern string `yaml:"pattern,omitempty" json:"pattern,omitempty" required:""`

	// Замена
	Repl string `yaml:"repl,omitempty" json:"repl,omitempty" required:""`
}

func (*ReplaceBody) Execute

func (b *ReplaceBody) Execute(_ context.Context, _ build.RuntimeContext) (any, error)

type ShellBody

type ShellBody struct {
	// Команды на выполнение
	Command string `yaml:"command,omitempty" json:"command,omitempty" required:""`

	// Quiet command output
	Quiet bool `yaml:"quiet,omitempty" json:"quiet,omitempty"`
}

func (*ShellBody) Execute

func (b *ShellBody) Execute(ctx context.Context, svc build.RuntimeContext) (any, error)

type ShellOutput

type ShellOutput struct {
	Env map[string]string
}

type SystemdBody

type SystemdBody struct {
	// Имена сервисов
	Targets []string `yaml:"targets,omitempty" json:"targets,omitempty" required:""`

	// Включать или нет
	Enabled bool `yaml:"enabled,omitempty" json:"enabled,omitempty" conflicts:"Masked"`

	// Включать ли сервис глобально, для всех пользователей
	Global bool `yaml:"global,omitempty" json:"global,omitempty"`

	// Маскировать ли сервис
	Masked bool `yaml:"masked,omitempty" json:"masked,omitempty" conflicts:"Enabled"`
}

func (*SystemdBody) Execute

func (b *SystemdBody) Execute(ctx context.Context, svc build.RuntimeContext) (any, error)

Jump to

Keyboard shortcuts

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