diff --git a/ct/clawdbot.sh b/ct/clawdbot.sh index 14683a3f2..7f147dff9 100644 --- a/ct/clawdbot.sh +++ b/ct/clawdbot.sh @@ -24,34 +24,26 @@ function update_script() { check_container_storage check_container_resources - if [[ ! -d /opt/clawdbot ]]; then + if ! command -v clawdbot >/dev/null 2>&1; then msg_error "No ${APP} Installation Found!" exit fi - if check_for_gh_release "clawdbot" "clawdbot/clawdbot"; then + msg_info "Backing up Data" + cp -r /opt/clawdbot/data /opt/clawdbot_data_backup 2>/dev/null || true + cp -r /root/.clawdbot /root/.clawdbot_backup 2>/dev/null || true + msg_ok "Backed up Data" - msg_info "Backing up Data" - cp -r /opt/clawdbot/data /opt/clawdbot_data_backup 2>/dev/null || true - cp -r /root/.clawdbot /root/.clawdbot_backup 2>/dev/null || true - msg_ok "Backed up Data" + msg_info "Updating Clawdbot" + $STD npm install -g clawdbot@latest + msg_ok "Updated Clawdbot" - CLEAN_INSTALL=1 fetch_and_deploy_gh_release "clawdbot" "clawdbot/clawdbot" - - msg_info "Rebuilding Clawdbot" - cd /opt/clawdbot - $STD pnpm install --frozen-lockfile - $STD pnpm ui:build - msg_ok "Rebuilt Clawdbot" - - msg_info "Restoring Data" - cp -r /opt/clawdbot_data_backup/. /opt/clawdbot/data 2>/dev/null || true - cp -r /root/.clawdbot_backup/. /root/.clawdbot 2>/dev/null || true - rm -rf /opt/clawdbot_data_backup /root/.clawdbot_backup - msg_ok "Restored Data" - - msg_ok "Updated successfully!" - fi + msg_info "Restoring Data" + cp -r /opt/clawdbot_data_backup/. /opt/clawdbot/data 2>/dev/null || true + cp -r /root/.clawdbot_backup/. /root/.clawdbot 2>/dev/null || true + rm -rf /opt/clawdbot_data_backup /root/.clawdbot_backup + msg_ok "Restored Data" + msg_ok "Updated successfully!" exit } diff --git a/install/clawdbot-install.sh b/install/clawdbot-install.sh index f1a50cd4a..6769cc16a 100644 --- a/install/clawdbot-install.sh +++ b/install/clawdbot-install.sh @@ -22,12 +22,7 @@ msg_ok "Installed Dependencies" fetch_and_deploy_gh_release "clawdbot" "clawdbot/clawdbot" pnpm_version=$(grep -oP '"packageManager":\s*"pnpm@\K[^"]+' /opt/clawdbot/package.json 2>/dev/null || echo "latest") -NODE_VERSION="24" NODE_MODULE="pnpm@${pnpm_version}" setup_nodejs - -msg_info "Installing Clawdbot Dependencies" -cd /opt/clawdbot -$STD pnpm install --frozen-lockfile -msg_ok "Installed Dependencies" +NODE_VERSION="24" NODE_MODULE="pnpm@${pnpm_version},clawdbot@latest" setup_nodejs msg_info "Building Clawdbot UI" $STD pnpm ui:build