Ports the community s6/s6-rc service catalog (early-boot mounts, udev,
dbus, session/power, networking, display managers, peripheral daemons)
to Lua-based service definitions.
- src/lua/s6lua.lua: shared helper library (exec, logging, fstab
parsing, oneshot shell runner, readiness notification)
- src/native/s6exec.c: minimal execvp() binding so longrun `run`
scripts can replace their own process image with the real daemon,
since stock Lua has no exec() and os.execute("exec ...") does not
solve it (the interpreter stays alive as an unsupervised parent)
- tools/catalog.lua + gen-services.lua: table-driven generator for
the structurally identical -srv/-log daemon pairs and agetty ttys
- tools/lint.lua, check-syntax.ps1, set-exec-bits.ps1: local
verification (no live s6/Linux target available this session)
- services/: 50 service directories (14 early-boot oneshots, 12
daemon srv/log pairs, 6 agetty ttys, boot/mount/setup/ttys/
graphical/default bundles)
Authored and syntax/structurally validated only. Native module is
unbuilt and daemon flags are unverified against Artix's real catalog
(gitea was unreachable during research) -- see docs/CONVENTIONS.md.
47 lines
2.2 KiB
Markdown
47 lines
2.2 KiB
Markdown
# s6-lua
|
|
|
|
A port of the community s6/s6-rc service catalog (the kind Artix Linux/Obarun use in place of
|
|
systemd units) into Lua-based service definitions.
|
|
|
|
Stock Lua has no `exec()` binding, and `os.execute("exec daemon")` doesn't solve the problem
|
|
either — it forks a shell that execs, but the Lua process itself stays alive blocked in
|
|
`waitpid()`, so s6 ends up supervising the interpreter instead of the daemon. `longrun` services
|
|
here hand off to the real daemon through a tiny vendored C module (`src/native/s6exec.c`,
|
|
`execvp()`); `oneshot` and `finish` scripts don't need it since they run to completion rather than
|
|
persisting. See `docs/CONVENTIONS.md` for the full rationale and naming rules.
|
|
|
|
## Layout
|
|
|
|
```
|
|
services/ the s6-rc source-definition tree (deploys verbatim to /etc/s6/sv)
|
|
src/lua/ shared helper library (s6lua.lua) every service script requires
|
|
src/native/ native exec binding (s6exec.c) + Makefile, Linux-only build
|
|
tools/ generator, structural linter, syntax checker, exec-bit fixer, installer
|
|
docs/ conventions and naming rules
|
|
```
|
|
|
|
`services/default` is the top-level bundle (boots to graphical target with SDDM); `services/boot`
|
|
is the multi-user/console-only target.
|
|
|
|
## Status
|
|
|
|
Authored and syntax-checked only — there is no live s6/s6-rc install in this environment to boot-
|
|
test against. See `docs/CONVENTIONS.md` for known unverified gaps (daemon flags reconstructed from
|
|
convention, not confirmed against Artix's actual catalog) and the recommended next step (install
|
|
s6/s6-rc/s6-linux-init on a Linux host — Arch is the closest packaging match — and boot-test the
|
|
`boot` bundle before enabling `graphical`).
|
|
|
|
## Local tooling
|
|
|
|
Requires `lua55`/`luac55` (this repo was authored against Lua 5.5, written to a subset valid under
|
|
5.4 too — see `docs/CONVENTIONS.md`).
|
|
|
|
```powershell
|
|
lua55 tools/gen-services.lua # regenerate the -srv/-log pairs + agetty ttys from tools/catalog.lua
|
|
lua55 tools/lint.lua # structural validation of services/
|
|
tools/check-syntax.ps1 # luac55 -p over every script
|
|
tools/set-exec-bits.ps1 # fix the git executable bit before committing (Windows checkout)
|
|
```
|
|
|
|
`tools/install.sh` deploys everything to a real Linux target (untested this session).
|