diff --git a/lib/client.js b/lib/client.js index f81ffc6..e220a04 100644 --- a/lib/client.js +++ b/lib/client.js @@ -508,7 +508,12 @@ class ClawClient { _setHostname(clawId) { const hostname = `claw-${clawId}`; - exec(`sudo hostname ${hostname}`, (err) => { + const cmd = [ + `sudo hostname ${hostname}`, + `echo "${hostname}" | sudo tee /etc/hostname > /dev/null`, + `sudo sed -i 's/^127\\.0\\.1\\.1.*/127.0.1.1 ${hostname}/' /etc/hosts`, + ].join(' && '); + exec(cmd, { shell: true }, (err) => { if (err) { log.warn('clawd', `设置 hostname 失败: ${err.message}`); } else { diff --git a/package.json b/package.json index ce2792e8..7eb42cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clawd", - "version": "1.2.0", + "version": "1.2.1", "description": "Claw Box daemon - connects local Linux box to claw.cutos.ai via WebSocket", "main": "lib/client.js", "bin": {