chore: add control-ui backup and restore helper scripts

This commit is contained in:
Chen Gu
2026-08-13 17:00:21 +08:00
parent d82197bbf9
commit 19ad03d390
2 changed files with 50 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
set -euo pipefail
TARGET_JS="/usr/local/lib/node_modules/openclaw/dist/control-ui/assets/index-Qb3PJV7U.js"
TARGET_HTML="/usr/local/lib/node_modules/openclaw/dist/control-ui/index.html"
STAMP="$(date +%Y%m%d-%H%M%S)"
OUT_DIR="${1:-$HOME/.openclaw/backups/control-ui/$STAMP}"
mkdir -p "$OUT_DIR"
cp "$TARGET_JS" "$OUT_DIR/index-Qb3PJV7U.js"
cp "$TARGET_HTML" "$OUT_DIR/index.html"
cat > "$OUT_DIR/README.txt" <<EOF
Backup created at: $(date)
JS: $TARGET_JS
HTML: $TARGET_HTML
Restore:
bash /Users/guchen/.openclaw/workspace/scripts/restore-control-ui.sh $OUT_DIR
EOF
echo "Backup saved to: $OUT_DIR"
+26
View File
@@ -0,0 +1,26 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -lt 1 ]]; then
echo "Usage: $0 <backup_dir>"
exit 1
fi
BACKUP_DIR="$1"
TARGET_JS="/usr/local/lib/node_modules/openclaw/dist/control-ui/assets/index-Qb3PJV7U.js"
TARGET_HTML="/usr/local/lib/node_modules/openclaw/dist/control-ui/index.html"
if [[ ! -f "$BACKUP_DIR/index-Qb3PJV7U.js" ]]; then
echo "Missing backup file: $BACKUP_DIR/index-Qb3PJV7U.js"
exit 1
fi
if [[ ! -f "$BACKUP_DIR/index.html" ]]; then
echo "Missing backup file: $BACKUP_DIR/index.html"
exit 1
fi
cp "$BACKUP_DIR/index-Qb3PJV7U.js" "$TARGET_JS"
cp "$BACKUP_DIR/index.html" "$TARGET_HTML"
echo "Restore complete."
echo "Now hard refresh Control UI (Ctrl+Shift+R)."