fix(hermesagent): shim handles hermes user invocation

runuser requires root. When the hermes user calls the shim directly
(e.g. via su - hermes), exec the binary directly instead.
This commit is contained in:
Stephen Chin
2026-05-02 12:30:34 -07:00
parent be8d55fb83
commit 8afb182095

View File

@@ -120,7 +120,11 @@ msg_info "Creating Hermes Shim"
cat <<'EOF' >/usr/bin/hermes
#!/bin/bash
cd /home/hermes
exec runuser -u hermes -- /home/hermes/.local/bin/hermes "$@"
if [[ "$(id -u)" -eq 0 ]]; then
exec runuser -u hermes -- /home/hermes/.local/bin/hermes "$@"
else
exec /home/hermes/.local/bin/hermes "$@"
fi
EOF
chmod +x /usr/bin/hermes
msg_ok "Created Hermes Shim"