fix(daemon): use correct service name for node install/uninstall

installSystemdService and uninstallSystemdService were hardcoded to use
resolveGatewaySystemdServiceName() instead of resolveSystemdServiceName(),
which respects the CLAWDBOT_SYSTEMD_UNIT environment variable override.

This caused 'clawdbot node install' to fail because:
1. The correct unit file was created (e.g., clawdbot-node.service)
2. But systemctl tried to enable 'clawdbot-gateway.service' instead

Fixes #2855

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
MohammadErfan Jabbari 2026-01-27 18:35:26 +01:00
parent f662039c47
commit e229dbc86a

View File

@ -213,7 +213,7 @@ export async function installSystemdService({
});
await fs.writeFile(unitPath, unit, "utf8");
const serviceName = resolveGatewaySystemdServiceName(env.CLAWDBOT_PROFILE);
const serviceName = resolveSystemdServiceName(env);
const unitName = `${serviceName}.service`;
const reload = await execSystemctl(["--user", "daemon-reload"]);
if (reload.code !== 0) {
@ -244,7 +244,7 @@ export async function uninstallSystemdService({
stdout: NodeJS.WritableStream;
}): Promise<void> {
await assertSystemdAvailable();
const serviceName = resolveGatewaySystemdServiceName(env.CLAWDBOT_PROFILE);
const serviceName = resolveSystemdServiceName(env);
const unitName = `${serviceName}.service`;
await execSystemctl(["--user", "disable", "--now", unitName]);