systemd

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package systemd installs ccswap's user service for Linux hosts.

Index

Constants

View Source
const Label = "ccswap.service"

Variables

View Source
var (
	Dir        = ""
	RuntimeDir = func() string { return fmt.Sprintf("/run/user/%d", os.Getuid()) }
	User       = func() string {
		if u, err := user.Current(); err == nil {
			return u.Username
		}
		return os.Getenv("USER")
	}
	Run = func(name string, args ...string) ([]byte, error) {
		cmd := exec.Command(name, args...)
		cmd.Env = runEnv()
		return cmd.CombinedOutput()
	}
)

Dir is the user unit directory ("" = $XDG_CONFIG_HOME/systemd/user or ~/.config/systemd/user). Run runs systemctl/loginctl; RuntimeDir is the /run/user/<uid> seam; User is the linger user.

View Source
var ErrNoSystemd error = i18n.Err("systemd.not_found")

ErrNoSystemd: systemctl is missing, or the host was not booted with systemd.

Functions

func Install

func Install(binPath, home string) error

Install returns *LingerError when only enabling linger failed.

func Linger

func Linger() (bool, error)

func Loaded

func Loaded() (bool, error)

Loaded reports whether the unit is active; ErrNoSystemd when the host has no systemd.

func ProgramPath

func ProgramPath() (string, error)

ProgramPath is the binary the installed unit runs (first word of ExecStart=).

func Refresh added in v0.2.0

func Refresh(bin string) (bool, error)

Refresh rewrites the installed unit as this version writes it when it runs bin, keeping its program, description, log and environment, and reports whether it did. A unit edited beyond that stays as it is. Nothing is restarted: after daemon-reload the new unit takes effect at the service's next start.

func Uninstall

func Uninstall() error

func Unit

func Unit(binPath, home string) []byte

Unit pins CCSWAP_HOME: the user manager's XDG_CONFIG_HOME may differ from the installing shell's.

Types

type LingerError

type LingerError struct{ User string }

LingerError: the service is installed, only `loginctl enable-linger` failed.

func (*LingerError) Error

func (e *LingerError) Error() string

Jump to

Keyboard shortcuts

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