service

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 25 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 service renders reviewable per-user startup configurations and manages explicitly requested macOS user agents. Rendering alone never registers, enables, starts or stops an operating-system service.

Index

Constants

View Source
const Label = "org.b1ug.nb1"

Variables

View Source
var ErrUserServiceUnsupported = errors.New("automatic user-service management in this adapter supports macOS only; service render remains available on other platforms; launchctl is not invoked")

Functions

func ResolveBoundExecutable

func ResolveBoundExecutable(binary, root string, uid int) (string, error)

ResolveBoundExecutable validates a deliberately updatable package entry. Fixed-path installations do not use this policy. The package rack remains canonical and a target must stay inside it after every link resolution.

func WriteUserStatus

func WriteUserStatus(output io.Writer, status UserStatus) error

Types

type Artifact

type Artifact struct {
	Filename string
	Content  []byte
}

func Render

func Render(c Config) (Artifact, error)

Render treats paths as target-platform values. Cross-platform rendering does not stat a remote executable or prove that it will run on the target system.

func WriteFile

func WriteFile(c Config, output string) (Artifact, error)

WriteFile validates and renders before opening the requested staging file. It refuses to replace an existing file and does not create parent directories.

type CommandResult

type CommandResult struct {
	Output    string
	ExitCode  int
	Truncated bool
}

CommandResult is an internal adapter result. Output may contain launchd diagnostic data, so it must never be copied wholesale to reports or logs.

type Config

type Config struct {
	Platform       string   `json:"platform"`
	Binary         string   `json:"binary"`
	BinaryRoot     string   `json:"binary_root,omitempty"`
	ConfigFile     string   `json:"config_file,omitempty"`
	UserConfigRoot string   `json:"user_config_root,omitempty"`
	Devices        []string `json:"devices"`
	Listen         string   `json:"listen"`
	LockDir        string   `json:"lock_dir"`
}

type Runner

type Runner interface {
	Run(context.Context, ...string) (CommandResult, error)
}

type UserManager

type UserManager struct {
	// contains filtered or unexported fields
}

func NewUserManager

func NewUserManager() (*UserManager, error)

NewUserManager only addresses this ordinary user's fixed GUI LaunchAgent. No arbitrary labels, UIDs, launchctl paths or installation directories are accepted by the CLI. Construction performs no writes or launchctl calls.

func (*UserManager) Install

func (m *UserManager) Install(ctx context.Context, config Config, start bool) (UserStatus, error)

Install never replaces a file, including a changed configuration previously installed by this tool. start is the explicit live bootstrap boundary.

func (*UserManager) Start

func (m *UserManager) Start(ctx context.Context) (UserStatus, error)

Start loads only a complete, existing managed configuration. A matching registration is already started for this command's purpose; never restart it.

func (*UserManager) Status

func (m *UserManager) Status(ctx context.Context, configOnly bool) (UserStatus, error)

Status with configOnly performs filesystem reads only. It creates no directories or lock files and never calls launchctl in that mode.

func (*UserManager) Stop

func (m *UserManager) Stop(ctx context.Context) (UserStatus, error)

Stop removes only the verified registration and deliberately retains the plist. This does not disable automatic loading at the next GUI login.

func (*UserManager) Uninstall

func (m *UserManager) Uninstall(ctx context.Context, stop bool) (UserStatus, error)

Uninstall always queries launchd first. stop authorizes bootout only after both the on-disk marker and the exact loaded path/program have been checked. It never treats a query error or unknown output format as 'not loaded'.

type UserStatus

type UserStatus struct {
	SchemaVersion     int      `json:"schema_version"`
	Label             string   `json:"label"`
	Target            string   `json:"target"`
	PlistPath         string   `json:"plist_path"`
	ConfigState       string   `json:"config_state"`
	Registration      string   `json:"registration"`
	RegistrationOwned bool     `json:"registration_owned"`
	AutoLoadAtLogin   *bool    `json:"auto_load_at_login"`
	Config            *Config  `json:"config"`
	Actions           []string `json:"actions"`
	Notes             []string `json:"notes"`
}

UserStatus distinguishes a known on-disk configuration from launchd registration. Registered does not mean running, HTTP-ready or USB-online.

Directories

Path Synopsis
Package systemduser manages one explicitly requested current-user unit.
Package systemduser manages one explicitly requested current-user unit.
Package taskquery reads one fixed current-user Task Scheduler registration.
Package taskquery reads one fixed current-user Task Scheduler registration.
Package taskuser verifies only the current Windows process's read-only identity.
Package taskuser verifies only the current Windows process's read-only identity.

Jump to

Keyboard shortcuts

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