harness: fix tea-login using getent (not in PATH) — hardcode /root

This commit is contained in:
damocles 2026-05-21 23:05:13 +02:00
parent f762348fca
commit 317d580405

View file

@ -393,10 +393,10 @@
# tea reads config from ~/.config/tea/config.yml (for root: /root/.config/tea/config.yml). # tea reads config from ~/.config/tea/config.yml (for root: /root/.config/tea/config.yml).
# Write it directly so we control default:true and always # Write it directly so we control default:true and always
# refresh a rotated token — no 'tea login add' interactive dance. # refresh a rotated token — no 'tea login add' interactive dance.
# Use getent to resolve root's home dir rather than $HOME which # $HOME is unset in systemd service context (causing writes to
# is unset in systemd service context (causing writes to /.config/). # /.config/). Hardcode /root — always correct for NixOS containers
_HOME=$(getent passwd root | cut -d: -f6) # where the harness runs as root.
CONFIG="$_HOME/.config/tea/config.yml" CONFIG="/root/.config/tea/config.yml"
mkdir -p "$(dirname "$CONFIG")" || true mkdir -p "$(dirname "$CONFIG")" || true
cat > "$CONFIG" << EOF cat > "$CONFIG" << EOF
logins: logins: