Documentation
¶
Overview ¶
Package s6 models s6 service directories: the unit of supervision under an s6-svscan scan dir (in winkit's WSL distro, /etc/s6/services). A Service can be loaded from a directory laid out like a scan dir entry, materialized back to disk, or flattened into build-context file maps.
The package is deliberately free of wsl/docker specifics so other consumers (devcell's fragment replacement) can import it directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// Name is the directory name under the scan dir.
Name string
// Run is the run script content. s6-supervise execve()s it directly,
// so it must start with a #! interpreter line.
Run string
// Files are extra files relative to the service dir (finish, data/…).
// The key "run" is reserved for Run.
Files map[string][]byte
}
Service is one s6 service directory for an s6-svscan scan dir.
func FromDir ¶
FromDir loads one service from a directory laid out like a scan dir entry: it must contain a "run" file; everything else becomes Files.
func FromFS ¶
FromFS loads a single service dir rooted at root within fsys (the fs.FS counterpart of FromDir, used for embedded catalogs).
func LoadDir ¶
LoadDir loads every subdirectory of dir as a Service — dir has the on-disk shape of an s6 scan dir. Non-directory entries and an empty dir are errors (a scan dir with stray files is almost always a misconfigured path).
func LoadFS ¶
LoadFS is LoadDir over an fs.FS rooted at root, for embedded catalogs. Services are returned sorted by name.
func (Service) ContextFiles ¶
ContextFiles flattens the service into file-map entries keyed by prefix + "<name>/<rel>" (slash-separated), the shape of a docker build context map. Run is normalized to LF line endings.