fix: persist hostname to /etc/hostname and /etc/hosts; bump v1.2.1

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
stswangzhiping
2026-05-04 17:29:09 +08:00
parent e4e99c9aed
commit f71d448047
2 changed files with 7 additions and 2 deletions

View File

@@ -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 {

View File

@@ -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": {