Artifact 75b852b23ebf3db2ef0471483fb292940b7f9e7d17859a7c3aa630df9e511aa8:
- File
docs/install.md
— part of check-in
[7ecc8d52ea]
at
2026-11-14 06:52:19
on branch trunk
— Phase 7c-2: suit install sets up the two timers, and status has a one-line form
suit install writes two timers and loads them: one starts suit-run every minute, the other starts suit tend every hour. On macOS they are launchd user agents in ~/Library/LaunchAgents; on Linux, systemd user units. Each file is written with exactly mode 0644 whatever the umask. Running install again with nothing changed writes nothing and loads nothing. suit install --print shows the files and changes nothing. suit uninstall unloads the timers and removes exactly its own files. Neither touches a file that is not one of suit's own names.
Two timers stand in place of the planned single timer with a detached hourly child: the minute run stays inside its speed budget, and each job can be seen and stopped by itself.
The loader (launchctl or systemctl) is started by absolute path, never through a shell. Its path and the platform can be overridden only in the test builds; a test checks the release binary holds neither name.
suit status --line prints one short line for a status bar: suit ok, how many things need you, or not installed. Plain suit status says whether the timers are installed.
Known gaps. If the loader fails, the files stay in place and a second install says already installed without trying to load again; that needs a retry and a line in the attention file. The Linux units are checked as text and as loader arguments on macOS; systemd itself has not run them.
Found by the local gate before this check-in: an analyzer report, tests that needed a user name, and timer files written with the wrong mode under a strict umask.
1269 unit checks, 428 shell cases, 669 store cases, 612 placement cases and 378 project cases, under clang, under gcc 16, with no user name set, and under a strict umask. 100% coverage in all 23 source files. No suite has fewer cases than at the last check-in. (user: dmestas, size: 4882) [annotate] [blame] [check-ins using]
Install
suit install makes suit run by itself. It sets up two timers, both owned by
suit and named so they are recognisably suit's:
| Timer | Every | Starts | Does |
|---|---|---|---|
| run | 60 seconds | suit-run |
The no-change compare. It replaces itself with suit run when something differs. |
| tend | 3600 seconds | suit tend |
Every wardrobe: lint, check in, sync. |
Two timers, not one, so the minute run stays inside its speed budget and each job can be seen and stopped by itself.
The files
On macOS they are two launchd user agents in $HOME/Library/LaunchAgents:
app.zeitforge.suit.run.plistapp.zeitforge.suit.tend.plist
Each holds Label, ProgramArguments (absolute paths), StartInterval, RunAtLoad
(false), ProcessType Background, LowPriorityIO, StandardErrorPath
($SUIT_HOME/log/run.err or tend.err) and, only when SUIT_HOME is set to
something other than $HOME/.suit, an EnvironmentVariables entry for SUIT_HOME.
On Linux they are systemd user units in $HOME/.config/systemd/user (or
$XDG_CONFIG_HOME/systemd/user when that is set):
suit-run.serviceandsuit-run.timer(OnBootSec and OnUnitActiveSec 60s, AccuracySec 1s)suit-tend.serviceandsuit-tend.timer(3600s, Persistent true)
The services are Type=oneshot; the timers are WantedBy=timers.target.
suit install --print shows the exact text of each file for this machine.
Paths are XML-escaped in a property list and quoted for systemd; a path with a
space works. A path with a newline or other control character, or one over
1024 bytes, is refused.
suit install
- Finds the absolute path of the running
suitand of thesuit-runbeside it. Refuses, saying which, whensuit-runis not there or either is not an existing executable file. - Makes the folder if needed (and, on macOS,
$SUIT_HOME/log, which launchd needs before it can open the error file), then writes each file whose text differs, atomically, mode 0644. - Asks the loader to load the timers: on macOS
launchctl bootstrap gui/UID PLIST(afterbootout gui/UID/LABELwhen an older file was there); on Linuxsystemctl --user daemon-reload, thensystemctl --user enable --now NAME.timer. The loader is run directly with an absolute path, never through a shell, and waited for.
It says one line per timer: installed, updated or already installed.
Run again with nothing changed it writes nothing, loads nothing and says
already installed. A file that differs from what suit would write (an old
version, a changed path) is rewritten and its timer loaded again.
When any file is written, both timers are loaded again, so an install that stopped half way is finished by the next one. If the loader exits non-zero the command exits 3, names the loader's exit status, leaves the files in place and says so; load them by hand (below). Running install again then finds the files unchanged and loads nothing.
If a write fails, nothing is loaded and the command exits 1; a file already
written stays, and the next suit install finishes the job.
It never touches a file in those folders that is not one of its own names.
suit uninstall
Asks the loader to unload each timer, then removes exactly the files above and
says removed PATH for each. Folders are left. When no file is there it says
not installed and calls nothing. A loader that exits non-zero on unload is
reported but the files are still removed: a timer that was not loaded is
normal.
suit status --line
One short line for a status bar, exit 0, at most 60 characters:
suit: N need youwhen the attention file has N items (an item is a line that is not indented);suit: not installedwhen any timer file is absent;suit okotherwise.
Attention wins when both apply. It reads only the attention file and checks that the timer files exist; it opens no repository. If it cannot tell it exits 1 and says why on standard error.
Plain suit status ends its timers line the same way: timers: installed,
timers: not installed or timers: differ from this suit (run suit install).
Checking by hand
macOS:
launchctl print gui/$(id -u)/app.zeitforge.suit.run
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/app.zeitforge.suit.run.plist
launchctl bootout gui/$(id -u)/app.zeitforge.suit.run
Linux:
systemctl --user list-timers 'suit-*'
systemctl --user status suit-run.service
systemctl --user enable --now suit-run.timer
Tests
The tests set HOME and SUIT_HOME to a scratch folder and point suit at a fake
loader with SUIT_LOADER, and can choose which set of files is written with
SUIT_PLATFORM=linux|macos. Both variables exist only in the test builds (the
ones with fault injection); the release build has no code that reads them, which
test/release_clean.sh checks. No test runs launchctl or systemctl.