agent/install.sh and server/install.sh handle tokens, root-owned config and
systemd units, and had no tests. I changed them twice recently (REPORT_HOSTNAME,
the Livepatch unit) and checked by hand.
They now take a KERNELWATCH_ROOT prefix (the agent already has one) that
prefixes every path they read or write and skips the root check. Unset, as on
real hosts, paths are unchanged; the other edits are quoting and mkdir -p
(instead of install -d) for system dirs that already exist, so nothing gets
chmod'd. Reviewers: the install.sh diffs are the part to read closely.
tests/test_install.py (27 tests) runs the real scripts against a fake root
with systemctl, apt-get, useradd, chown and others stubbed to log their
arguments:
fresh installs, with contents, modes and systemctl call order
upgrades keep config and token; rotation replaces the token
REPORT_HOSTNAME set, kept across upgrade and --server rewrite, cleared
apt-update marker, private CA, needrestart install/skip
failed first report, OS warnings, bad arguments, --help, refuses non-root
server: user created only if missing, config preserved on upgrade, old code
replaced, interrupted upgrade recovered
guards: every unit/script is installed, and deploy.sh ships every file the
agent installer uses
I checked the tests catch real breakage by mutating the scripts (world-readable
token, dropped unit, timer not started, ignored failed report, overwritten
server.toml, missing deploy file, etc.); each mutation failed a test.
Not covered
Real systemctl/apt-get/useradd behavior (stubbed). make lint couldn't run
locally (no shellcheck); CI covers it.
## Summary
agent/install.sh and server/install.sh handle tokens, root-owned config and
systemd units, and had no tests. I changed them twice recently (REPORT_HOSTNAME,
the Livepatch unit) and checked by hand.
They now take a `KERNELWATCH_ROOT` prefix (the agent already has one) that
prefixes every path they read or write and skips the root check. Unset, as on
real hosts, paths are unchanged; the other edits are quoting and `mkdir -p`
(instead of `install -d`) for system dirs that already exist, so nothing gets
chmod'd. Reviewers: the install.sh diffs are the part to read closely.
`tests/test_install.py` (27 tests) runs the real scripts against a fake root
with systemctl, apt-get, useradd, chown and others stubbed to log their
arguments:
- fresh installs, with contents, modes and systemctl call order
- token sources (env, file, prompt), empty tokens refused, token not echoed
- upgrades keep config and token; rotation replaces the token
- REPORT_HOSTNAME set, kept across upgrade and --server rewrite, cleared
- apt-update marker, private CA, needrestart install/skip
- failed first report, OS warnings, bad arguments, --help, refuses non-root
- server: user created only if missing, config preserved on upgrade, old code
replaced, interrupted upgrade recovered
- guards: every unit/script is installed, and deploy.sh ships every file the
agent installer uses
I checked the tests catch real breakage by mutating the scripts (world-readable
token, dropped unit, timer not started, ignored failed report, overwritten
server.toml, missing deploy file, etc.); each mutation failed a test.
## Not covered
Real systemctl/apt-get/useradd behavior (stubbed). `make lint` couldn't run
locally (no shellcheck); CI covers it.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
patrick
added 2 commits 2026-10-30 13:52:35 +00:00
KERNELWATCH_ROOT prefixes every path agent/install.sh and server/install.sh
read or write and skips their root check. Unset (as in production) every path
is unchanged; the only edits are quoting and mkdir -p for system directories
that already exist.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
27 tests run the real scripts with systemctl, apt-get, useradd and friends
stubbed: fresh installs, upgrades keeping config and token, token sources,
REPORT_HOSTNAME handling, apt-update marker, private CA, needrestart, failed
first report, OS warnings, argument errors, and the server's user creation,
config preservation and interrupted-upgrade recovery. Guards that every unit
and script is installed and that deploy.sh ships every file the agent
installer uses.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
patrick
merged commit e3010321d7 into main2026-10-30 14:22:02 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
agent/install.sh and server/install.sh handle tokens, root-owned config and
systemd units, and had no tests. I changed them twice recently (REPORT_HOSTNAME,
the Livepatch unit) and checked by hand.
They now take a
KERNELWATCH_ROOTprefix (the agent already has one) thatprefixes every path they read or write and skips the root check. Unset, as on
real hosts, paths are unchanged; the other edits are quoting and
mkdir -p(instead of
install -d) for system dirs that already exist, so nothing getschmod'd. Reviewers: the install.sh diffs are the part to read closely.
tests/test_install.py(27 tests) runs the real scripts against a fake rootwith systemctl, apt-get, useradd, chown and others stubbed to log their
arguments:
replaced, interrupted upgrade recovered
agent installer uses
I checked the tests catch real breakage by mutating the scripts (world-readable
token, dropped unit, timer not started, ignored failed report, overwritten
server.toml, missing deploy file, etc.); each mutation failed a test.
Not covered
Real systemctl/apt-get/useradd behavior (stubbed).
make lintcouldn't runlocally (no shellcheck); CI covers it.
🤖 Generated with Claude Code