From 45e1370ca5f55f68011faa0b612c8fb7d0d9a8ab Mon Sep 17 00:00:00 2001 From: stswangzhiping <59632378+stswangzhiping@users.noreply.github.com> Date: Mon, 4 May 2026 18:46:37 +0800 Subject: [PATCH] fix: rewrite clawd.service on upgrade; bump to 1.2.6 Co-authored-by: Cursor --- package.json | 2 +- tools/update-clawd.sh | 61 ++++++++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/package.json b/package.json index 3d5ba94..eb5573a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "clawd", - "version": "1.2.5", + "version": "1.2.6", "description": "Claw Box daemon - connects local Linux box to claw.cutos.ai via WebSocket", "main": "lib/client.js", "bin": { diff --git a/tools/update-clawd.sh b/tools/update-clawd.sh index e6c537e..097950e 100644 --- a/tools/update-clawd.sh +++ b/tools/update-clawd.sh @@ -63,20 +63,55 @@ if [ "$NO_RESTART" = true ]; then exit 0 fi -# Patch service file if ReadWritePaths is missing /etc/hosts or /etc/hostname +NODE_BIN=$(command -v node) +INSTALL_DIR="/opt/clawd" +CONFIG_DIR="/etc/clawd" +ENV_FILE="$CONFIG_DIR/env" SERVICE_FILE="/etc/systemd/system/$SERVICE" -if [ -f "$SERVICE_FILE" ]; then - if ! grep -q "/etc/hosts" "$SERVICE_FILE" || ! grep -q "/etc/hostname" "$SERVICE_FILE"; then - echo "==> Patching $SERVICE_FILE: adding /etc/hosts /etc/hostname to ReadWritePaths ..." - sed -i 's|ReadWritePaths=\(.*\)/tmp\(.*\)|ReadWritePaths=\1/tmp\2 /etc/hosts /etc/hostname|' "$SERVICE_FILE" - # If the pattern didn't match (different format), append directly - if ! grep -q "/etc/hosts" "$SERVICE_FILE"; then - sed -i 's|ReadWritePaths=.*|& /etc/hosts /etc/hostname|' "$SERVICE_FILE" - fi - systemctl daemon-reload - echo "==> daemon-reload done" - fi -fi + +echo "==> Writing service file: $SERVICE_FILE" +cat > "$SERVICE_FILE" < daemon-reload done" echo "==> Restarting service: $SERVICE" systemctl restart "$SERVICE"