sysd

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package sysd analyzes and affects systemd configuration.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotInstalled is returned if an action is invoked
	// on a unit which does not exist.
	ErrNotInstalled = errors.New("cannot perform action on uninstalled unit")
)

Functions

func Enable

func Enable(fs FS, unit, target string) error

Enable enables the given unit as a WantedBy target.

func Exists

func Exists(fs FS, unit string) (bool, error)

Exists returns true if the unit exists.

func Install

func Install(fs FS, unitName string, conf *sysd.Unit, overwrite bool) error

Install installs the specified unit using the given name.

func IsEnabledOnTarget

func IsEnabledOnTarget(fs FS, unit, target string) (bool, error)

IsEnabled returns true if the given unit is enabled on the target.

Types

type FS

type FS interface {
	Stat(path string) (os.FileInfo, error)
	LStat(path string) (os.FileInfo, error)
	Symlink(at, to string) error
	Mkdir(at string) error
	Write(path string, data []byte, perms os.FileMode) error
}

FS describes an interface which must be provided, so the package can interact with the filesystem.

Jump to

Keyboard shortcuts

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