fix: auto-patch clawd.service ReadWritePaths on startup; bump to 1.2.7
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
16
bin/clawd.js
16
bin/clawd.js
@@ -11,6 +11,22 @@ const config = require('../lib/config');
|
||||
const log = require('../lib/logger');
|
||||
const { pollSms } = require('../drivers/sim/sms-reader');
|
||||
|
||||
// 修复旧版 clawd.service:确保 ReadWritePaths 包含 /etc/hosts /etc/hostname
|
||||
const SERVICE_FILE = '/etc/systemd/system/clawd.service';
|
||||
const fs = require('fs');
|
||||
try {
|
||||
const svc = fs.readFileSync(SERVICE_FILE, 'utf8');
|
||||
if (svc.includes('ReadWritePaths=') && !svc.includes('/etc/hosts')) {
|
||||
const fixed = svc.replace(
|
||||
/ReadWritePaths=([^\n]*)/,
|
||||
(_, rest) => `ReadWritePaths=${rest.trimEnd()} /etc/hosts /etc/hostname`
|
||||
);
|
||||
fs.writeFileSync(SERVICE_FILE, fixed, 'utf8');
|
||||
exec('systemctl daemon-reload', () => {});
|
||||
log.info('clawd', 'clawd.service ReadWritePaths patched');
|
||||
}
|
||||
} catch (_) { /* not running under systemd or no permission */ }
|
||||
|
||||
// 每次启动绑定 Quectel 串口驱动(失败不影响主流程)
|
||||
const bindScript = path.join(__dirname, '..', 'tools', 'bind-quectel-serial.sh');
|
||||
exec(`bash "${bindScript}"`, (err, stdout, stderr) => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "clawd",
|
||||
"version": "1.2.6",
|
||||
"version": "1.2.7",
|
||||
"description": "Claw Box daemon - connects local Linux box to claw.cutos.ai via WebSocket",
|
||||
"main": "lib/client.js",
|
||||
"bin": {
|
||||
|
||||
Reference in New Issue
Block a user