# Auto update
`src/update.c` (bundled, host only) is `pic update`. It uses the platform seam `run_program` for
every program (zit, quarry, make, the new pic's `--version`) and `lock` for `~/.pic/update.lock`; a
platform without `run_program` refuses.
State: `~/.pic/update.status` (key=value, replaced by rename: `checked`, `at`, `result`, `message`,
`built`, `failed`) and `~/.pic/update.log` (the last cycle's output). `built` is the trunk hash
last installed, `failed` the last one that did not pass; a cycle skips both unless `--force`.
A cycle never installs on anything but all of: clean checkout on trunk, `zit pull` and
`zit update trunk`, `make build/pic/release/pic`, `make test-smoke` (test-docs and the release suites folder, chat and print; `--full`:
`make test-release`, test-docs and every `run-*-rel`), and `NEW --version` exiting 0. The install is the one `make install-pic` does: a
temporary file in the target's directory, chmod, fsync, rename. The target is the path the running
pic reports for itself, so the terminal's and `pic remote`'s stamp checks see it.
The terminal interface starts `pic update --auto` detached (`up_kick` in `src/tui/app.c`); the
environment variable `PIC_NO_AUTO_UPDATE` stops that, and the Makefile sets it for every script.