Documentation
¶
Overview ¶
Package units generates the systemd user units for the stack: a rig-control service and an optional modem per rig (template units, one instance per rig) and a single Pat service.
The units hold no device paths or ports. Each runs `hamstack run <kind> <rig>`, which reads the saved configuration and resolves the radio's serial port and sound card at the moment the service starts, so replugging a radio, using another USB port, or moving to another site needs no new units.
Index ¶
- func Dir() (string, error)
- func DirewolfConfig(rig config.Rig, prof profile.Profile, st config.Station, ...) string
- func DirewolfConfigWith(rig config.Rig, prof profile.Profile, st config.Station, ...) string
- func DirewolfPTT(mode, device string, rigPort int) (string, error)
- func Generate(p Plan) map[string]string
- func Install(p Plan) ([]string, error)
- func Installed() ([]string, error)
- func LegacyUnit(name string) bool
- func MercuryConfig(cfg config.Config, rig config.Rig, prof profile.Profile, st config.Station, ...) string
- func Remove() ([]string, error)
- func RemoveFiles(names []string) ([]string, error)
- func Stale(p Plan) ([]string, error)
- type Plan
- type RigPlan
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirewolfConfig ¶
func DirewolfConfig(rig config.Rig, prof profile.Profile, st config.Station, audioDevice, ptt string) string
DirewolfConfig returns the direwolf.conf for one rig. audioDevice is the ALSA device resolved right now ("" selects ALSA's null device, so Direwolf runs with no sound card); ptt is DirewolfPTT's line.
func DirewolfConfigWith ¶
func DirewolfConfigWith(rig config.Rig, prof profile.Profile, st config.Station, audioDevice, ptt, extra string) string
DirewolfConfigWith is DirewolfConfig with the user's own extra lines (the contents of the rig's direwolf.extra) added at the end, where they can override anything above them.
func DirewolfPTT ¶
DirewolfPTT is the PTT line of a Direwolf config. mode is the profile's packet PTT method; device is the serial port for rts/dtr; rigPort is the rig's rigctld port for "rig". It returns "" when the radio is keyed some other way (VOX), and an error for a mode it cannot honour.
func Installed ¶
Installed lists the hamstack unit files on disk (including ones from before rigs existed).
func LegacyUnit ¶
LegacyUnit reports whether a unit file name is one of the fixed single-radio units.
func MercuryConfig ¶
func MercuryConfig(cfg config.Config, rig config.Rig, prof profile.Profile, st config.Station, audioDevice, stateDir string) string
MercuryConfig returns the mercury.ini for one rig. audioDevice is the ALSA device resolved right now ("" for none, which selects Mercury's null audio).
func RemoveFiles ¶
RemoveFiles deletes the named unit files from the unit directory.
Types ¶
type Plan ¶
type Plan struct {
Config config.Config
Rigs []RigPlan // active rigs
Station config.Station // the active station
StateDir string // hamstack's own log directory
Pat string // absolute path of Pat
Hamstack string // absolute path of this program (the units run it)
}
Plan is everything needed to generate the units.
type Service ¶
type Service struct {
Kind string // config.RigCtld, config.Mercury or config.Pat
Rig string // rig id; empty for Pat
}
Service is one running thing: rig control or a modem for one rig, or Pat.
func Resolve ¶
Resolve turns a command-line word into services: "all", an exact "mercury@hf", a kind ("mercury": every Mercury), or a rig id ("hf": everything of that rig).
func ServicesFor ¶
ServicesFor lists the services of a configuration in start order: for each active rig its rig control and then its modem, and finally Pat.