Versions in this module Expand all Collapse all v0 v0.4.0 Nov 12, 2023 v0.3.0 Jan 8, 2023 v0.2.0 Sep 11, 2022 Changes in this version type ServiceApplyOption + func ServiceReload() ServiceApplyOption + func ServiceRestart() ServiceApplyOption v0.1.0 Sep 1, 2022 Changes in this version + var ErrApkPackage = typederror.NewRoot("apk package resource") + var ErrApkPackageManager = typederror.New("apk error", ErrApkPackage) + var ErrApkPackageManagerNotAvailable = typederror.New("apk not available", ErrApkPackage) + var ErrApkPackageUnexpected = typederror.New("unexpected error", ErrApkPackage) + var ErrAptPackage = typederror.NewRoot("apt package resource") + var ErrAptPackageManager = typederror.New("apt error", ErrAptPackage) + var ErrAptPackageManagerNotAvailable = typederror.New("apt not available", ErrAptPackage) + var ErrAptPackageUnexpected = typederror.New("unexpected error", ErrAptPackage) + var ErrFile = typederror.NewRoot("file resource") + var ErrFileExists = typederror.New("file exists", ErrFile) + var ErrFileNotFound = typederror.New("file not found", ErrFile) + var ErrFileUnexpected = typederror.New("unexpected error", ErrFile) + var ErrFolder = typederror.NewRoot("folder resource") + var ErrFolderNotFound = typederror.New("folder not found", ErrFile) + var ErrFolderPathExists = typederror.New("folder path exists", ErrFile) + var ErrFolderUnexpected = typederror.New("unexpected error", ErrFile) + var ErrGroup = typederror.NewRoot("group resource") + var ErrGroupGidExists = typederror.New("group gid exists", ErrGroup) + var ErrGroupNameExists = typederror.New("group name exists", ErrGroup) + var ErrGroupNotFound = typederror.New("group not found", ErrGroup) + var ErrGroupUnexpected = typederror.New("unexpected error", ErrGroup) + var ErrInfo = typederror.NewRoot("info resource") + var ErrInfoUnexpected = typederror.New("unexpected error", ErrInfo) + var ErrLink = typederror.NewRoot("link resource") + var ErrLinkExists = typederror.New("link exists", ErrLink) + var ErrLinkNotFound = typederror.New("link not found", ErrLink) + var ErrLinkUnexpected = typederror.New("unexpected error", ErrLink) + var ErrService = typederror.NewRoot("service resource") + var ErrServiceNotFound = typederror.New("service not found", ErrService) + var ErrServiceOperation = typederror.New("failed service operation", ErrService) + var ErrServiceRunlevelNotFound = typederror.New("runlevel not found", ErrService) + var ErrServiceUnexpected = typederror.New("unexpected error", ErrService) + var ErrUser = typederror.NewRoot("user resource") + var ErrUserGroupNotFound = typederror.New("primary group not found", ErrUser) + var ErrUserNameExists = typederror.New("user name exists", ErrUser) + var ErrUserNotFound = typederror.New("user not found", ErrUser) + var ErrUserUidExists = typederror.New("user uid exists", ErrUser) + var ErrUserUnexpected = typederror.New("unexpected error", ErrUser) + func GetOsReleaseInfo(ctx context.Context, s system.System) (*osrelease.Info, error) + func PackageNameFilter(names ...string) func(pkg *Package) bool + func PackageStateFiler(state PackageState) func(pkg *Package) bool + type CatCommand struct + Path string + func (c *CatCommand) Command() string + type ChgrpCommand struct + Group string + NoDereference bool + Path string + func (c *ChgrpCommand) Command() string + type ChmodCommand struct + Mode fs.FileMode + Path string + func (c *ChmodCommand) Command() string + type ChownCommand struct + Group string + NoDereference bool + Path string + User string + func (c *ChownCommand) Command() string + type Command interface + Command func() string + func NewCommand(c string) Command + type CommandResult struct + ExitCode int + Stderr []byte + Stdout []byte + func ExecuteCommand(ctx context.Context, s system.System, c Command) (*CommandResult, error) + func ExecuteCommandWithOptions(ctx context.Context, s system.System, c Command, opts ...ExecuteCommandOption) (*CommandResult, error) + func (c *CommandResult) Error() error + func (c *CommandResult) StderrString() string + func (c *CommandResult) StdoutString() string + type CompositeCommand []Command + func (c CompositeCommand) Command() string + type ExecuteCommandOption func(*ExecuteCommandOptions) + func WithStderr() ExecuteCommandOption + func WithStderrFunc(f func(writer io.Writer) io.Writer) ExecuteCommandOption + func WithStdout() ExecuteCommandOption + func WithStdoutFunc(f func(writer io.Writer) io.Writer) ExecuteCommandOption + type ExecuteCommandOptions struct + type File struct + Content []byte + Gid int + Group string + Md5Sum string + Mode fs.FileMode + Path string + Source io.Reader + Uid int + User string + type FileClient interface + Create func(ctx context.Context, f File) error + Delete func(ctx context.Context, path string) error + Get func(ctx context.Context, path string) (*File, error) + Update func(ctx context.Context, f File) error + func NewFileClient(s system.System, opts ...FileClientOpt) FileClient + type FileClientOpt func(c *fileClient) + func FileClientCompression(enabled bool) FileClientOpt + func FileClientIncludeContent(include bool) FileClientOpt + type Folder struct + Gid int + Group string + Mode fs.FileMode + Path string + Uid int + User string + type FolderClient interface + Create func(ctx context.Context, folder Folder) error + Delete func(ctx context.Context, path string) error + Get func(ctx context.Context, path string) (*Folder, error) + Update func(ctx context.Context, folder Folder) error + func NewFolderClient(s system.System) FolderClient + type Group struct + Gid int + Name string + System bool + type GroupClient interface + Create func(ctx context.Context, group Group) (int, error) + Delete func(ctx context.Context, gid int) error + Get func(ctx context.Context, gid int) (*Group, error) + Update func(ctx context.Context, group Group) error + func NewGroupClient(s system.System) GroupClient + type IdentityInfo struct + Gid int + Group string + Name string + Uid int + type InfoClient interface + GetIdentity func(ctx context.Context) (*IdentityInfo, error) + GetRelease func(ctx context.Context) (*ReleaseInfo, error) + func NewInfoClient(s system.System) InfoClient + type InputCommand interface + Stdin func() io.Reader + func NewInputCommand(c string, in io.Reader) InputCommand + type Link struct + Gid int + Group string + Path string + Target string + Uid int + User string + type LinkClient interface + Create func(ctx context.Context, l Link) error + Delete func(ctx context.Context, path string) error + Get func(ctx context.Context, path string) (*Link, error) + Update func(ctx context.Context, l Link) error + func NewLinkClient(s system.System) LinkClient + type MkdirCommand struct + Mode fs.FileMode + Path string + func (c *MkdirCommand) Command() string + type Package struct + Manager PackageManager + Name string + State PackageState + Version PackageVersion + type PackageClient interface + Apply func(ctx context.Context, pkgs Packages) error + Get func(ctx context.Context) (Packages, error) + func NewApkPackageClient(s system.System) PackageClient + func NewAptPackageClient(s system.System) PackageClient + type PackageManager string + const ApkPackageManager + const AptPackageManager + type PackageMap map[string]*Package + func (p PackageMap) ToList() Packages + type PackageState uint8 + const PackageInstalled + const PackageNotInstalled + type PackageVersion struct + Available string + Installed string + Required string + type Packages []*Package + func (p Packages) ByName() func(i, j int) bool + func (p Packages) Filter(f func(pkg *Package) bool) Packages + func (p Packages) Names() []string + func (p Packages) ToMap() PackageMap + type ReleaseInfo struct + Name string + Release string + Vendor string + Version string + type Service struct + Enabled *bool + Name string + Runlevel string + Status *ServiceStatus + Supervisor ServiceSupervisor + Target string + type ServiceApplyOption func(*ServiceApplyOptions) + func ServiceReloaded() ServiceApplyOption + func ServiceRestarted() ServiceApplyOption + type ServiceApplyOptions struct + type ServiceClient interface + Apply func(ctx context.Context, s Service, opts ...ServiceApplyOption) error + Get func(ctx context.Context, args ServiceGetArgs) (*Service, error) + func NewOpenRcServiceClient(s system.System) ServiceClient + func NewSystemdServiceClient(s system.System) ServiceClient + type ServiceGetArgs struct + Name string + Runlevel string + type ServiceStatus string + const ServiceStatusStarted + const ServiceStatusStarting + const ServiceStatusStopped + const ServiceStatusStopping + const ServiceStatusUndefined + func ServiceStatusPtr(s ServiceStatus) *ServiceStatus + func (s ServiceStatus) IsPending() bool + type ServiceSupervisor string + const ServiceSupervisorOpenRC + const ServiceSupervisorSystemd + type SimpleCommand string + func (a SimpleCommand) Command() string + type User struct + Gid *int + Group string + Home string + Name string + Shell string + System *bool + Uid *int + type UserClient interface + Create func(ctx context.Context, user User) (int, error) + Delete func(ctx context.Context, uid int) error + Get func(ctx context.Context, uid int) (*User, error) + Update func(ctx context.Context, user User) error + func NewUserClient(s system.System) UserClient