lsb

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package lsb implements parsing, marshaling, and manipulation of LSB-compliant init script metadata blocks, which are used to define dependencies, run levels, and other operational properties for initialization scripts in Unix-like systems.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMarkerMissing = errors.New("lsb block marker missing")
	ErrNilData       = errors.New("data cannot be nil")
)

Functions

This section is empty.

Types

type BootFacility

type BootFacility = string

type InitScript

type InitScript struct {
	// Meta
	Provides         string `lsb:"Provides"`
	ShortDescription string `lsb:"Short-Description"`
	Description      string `lsb:"Description"`

	// Operational
	DefaultStart  []RunLevel     `lsb:"Default-Start"`
	DefaultStop   []RunLevel     `lsb:"Default-Stop"`
	RequiredStart []BootFacility `lsb:"Required-Start"`
	RequiredStop  []BootFacility `lsb:"Required-Stop"`
	ShouldStart   []BootFacility `lsb:"Should-Start"`
	ShouldStop    []BootFacility `lsb:"Should-Stop"`

	// Extension
	XStartBefore []BootFacility `lsb:"X-Start-Before"`
	XStopAfter   []BootFacility `lsb:"X-Stop-After"`
	XInteractive bool           `lsb:"X-Interactive"`
}

func (*InitScript) Marshal

func (s *InitScript) Marshal() (string, error)

Marshal encodes an InitScript into its string representation.

func (*InitScript) SequenceNumber

func (s *InitScript) SequenceNumber() int

SequenceNumber calculates sequence number. It prioritizes scripts with fewer dependencies first. Required-Start and Should-Start dependencies are weighted heavily. Higher sequence numbers indicate later execution.

func (*InitScript) Unmarshal

func (s *InitScript) Unmarshal(data io.Reader) error

Unmarshal decodes a string into an InitScript.

type RunLevel

type RunLevel = uint8

Jump to

Keyboard shortcuts

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