forked from derivelinux/situation
god's greatest init
- C 93.4%
- Makefile 3.5%
- Shell 3.1%
| include | initial | |
| src | initial | |
| LICENSE | initial | |
| Makefile | forgot to rename file here | |
| rc.derive | initial | |
| rc.finir | initial | |
| README | initial | |
|\▒▓ \o▒▓ situation: god's greatest init o|▒▓ About situation you're seeng here is fork of derivelinux/situation. Core functionality, like supervisor, socket IPC, service management, dependency resolution were rewritten in C. Shell stays shell: rc.derive and rc.finir are plain scripts the user owns entirely. Build and install make make install DESTDIR=/ Add init=/bin/situation to the kernel cmdline. Static binary, no runtime deps beyond a libc. Boot sequence situation mounts virtual filesystems, sets the hostname and a handful of kernel parameters, then hands off to /etc/rc.derive. That script is responsible for everything site-specific: device manager, firmware, networking, getty. After rc.derive exits, the supervisor starts and launches enabled services. On shutdown (SIGTERM/SIGINT/SIGUSR1), /etc/rc.finir runs first, then services are stopped gracefully (5s SIGTERM window, then SIGKILL), and the system halts via reboot(2). Services Service definitions live in /etc/sv/. Each file is a key=value text file: type=longrun # longrun (default) or oneshot needs=postgres,redis # comma-separated, optional start=nginx -g 'daemon off;' stop=nginx -s quit # optional; default is SIGTERM A service is enabled by placing a symlink to it in /etc/sv/on/. The supervisor resolves the dependency graph (Kahn topological sort) and starts services in order. If a dependency dies, its dependents are stopped and restarted alongside it. Failed services are restarted with exponential backoff (1s → 30s max), resetting after 10s of stable uptime. Readiness can be signalled by touching /run/sv/ready/<name>. sctl see it for yourself, run sctl from console Paths /etc/sv/ service definitions /etc/sv/on/ symlinks to enabled services /etc/rc.derive boot script /etc/rc.finir shutdown script /run/sv/situation.sock IPC socket /run/sv/ready/<name> readiness marker