chore: remove startup service-file patch
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
14
bin/clawd.js
14
bin/clawd.js
@@ -11,20 +11,6 @@ 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 fs = require('fs');
|
||||
const SERVICE_FILE = '/etc/systemd/system/clawd.service';
|
||||
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 fixed');
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
// 每次启动绑定 Quectel 串口驱动(失败不影响主流程)
|
||||
const bindScript = path.join(__dirname, '..', 'tools', 'bind-quectel-serial.sh');
|
||||
exec(`bash "${bindScript}"`, (err, stdout, stderr) => {
|
||||
|
||||
Reference in New Issue
Block a user