chore: init

This commit is contained in:
Job79 committed 2026-11-15 15:52:10 +01:00
commit 9245b26500
42 files changed
+601

No files matched your search

@@ -0,0 +1,15 @@
# Applies the setup answers at every boot (see /usr/libexec/agent-boot). Before the setup is done
# there are none; agent-setup starts this when it is.
[Unit]
Description=Apply agent setup
ConditionPathExists=/var/lib/agent/hostname
After=systemd-tmpfiles-setup.service
Before=sshd.service claude-remote.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/libexec/agent-boot
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,21 @@
# First boot: asks for the root password, hostname and ssh key, on the screen (tty1) and the serial
# console (ttyS0) at once; whichever is answered first stops the other.
[Unit]
Description=Agent first-boot setup on %I
ConditionPathExists=!/var/lib/agent/hostname
After=systemd-tmpfiles-setup.service
Before=getty@%i.service serial-getty@%i.service
[Service]
Type=oneshot
ExecStart=/usr/libexec/agent-setup
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
# Answering on one console stops the setup on the other (SIGTERM), which is no failure.
SuccessExitStatus=SIGTERM
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,9 @@
# Starts Claude (Remote Control) once it is logged in: at boot, or when the user first logs in.
[Unit]
Description=Start Claude Remote Control once logged in
[Path]
PathExists=/var/lib/agent/claude/.credentials.json
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,16 @@
# Claude Code, in the background, controlled from claude.ai/code or the Claude app (Remote Control).
# Works in Claude's home. Started by claude-remote.path once Claude is logged in.
[Unit]
Description=Claude Code Remote Control
Wants=network-online.target user@1000.service
After=network-online.target user@1000.service agent-boot.service
[Service]
User=claude
WorkingDirectory=~
# In user.slice, so systemd-oomd kills it (or Claude's containers), not the system (user.slice.d).
Slice=user.slice
Environment=CLAUDE_CONFIG_DIR=/var/lib/agent/claude XDG_RUNTIME_DIR=/run/user/1000
ExecStart=/usr/bin/claude remote-control --name %H
Restart=always
RestartSec=10s
@@ -0,0 +1,14 @@
# The root password. /etc is read-only, so agent-setup writes the shadow file to /var and this
# mounts it over /etc/shadow.
[Unit]
Description=Root password from /var
ConditionPathExists=/var/lib/agent/etc/shadow
RequiresMountsFor=/var
[Mount]
What=/var/lib/agent/etc/shadow
Where=/etc/shadow
Options=bind
[Install]
WantedBy=local-fs.target
@@ -0,0 +1,6 @@
# Load our firewall (/usr/lib/agent/firewall.nft) instead of /etc/sysconfig/nftables.conf.
[Service]
ExecStart=
ExecStart=/usr/sbin/nft -f /usr/lib/agent/firewall.nft
ExecReload=
ExecReload=/usr/sbin/nft -f /usr/lib/agent/firewall.nft
@@ -0,0 +1,4 @@
# The host key is made by agent-boot, once the setup is done; agent-setup then starts sshd.
[Unit]
After=agent-boot.service
ConditionPathExists=/var/lib/agent/ssh_host_ed25519_key
@@ -0,0 +1,7 @@
# systemd-oomd for Claude and its containers: when they run the VM out of memory, kill the cgroup
# responsible before the VM thrashes on zram swap or the kernel's OOM killer picks sshd.
[Slice]
# Memory pressure above 60% for 30s: kill the cgroup reclaiming the most memory.
ManagedOOMMemoryPressure=kill
# Swap over 90% full: kill the cgroup using the most swap.
ManagedOOMSwap=kill