AI Newsletter Digest improvements: fixed QP soft line break decoding, URL extraction, and content cleaning
This commit is contained in:
@@ -6,11 +6,9 @@ set -e
|
||||
|
||||
BACKUP_DIR="$HOME/.openclaw/workspace"
|
||||
STATE_DIR="$HOME/.openclaw"
|
||||
REPO_DIR="$HOME/openclaw-backup"
|
||||
# Use SSH URL (requires SSH key setup) or HTTP with credentials
|
||||
# SSH: git@gitea.kangaroo-eel.ts.net:Anthony/openclaw-backup.git
|
||||
# HTTP with token: http://username:token@gitea.kangaroo-eel.ts.net:3000/Anthony/openclaw-backup.git
|
||||
REPO_URL="${GITEA_BACKUP_URL:-git@gitea.kangaroo-eel.ts.net:Anthony/openclaw-backup.git}"
|
||||
REPO_DIR="/tmp/openclaw-backup-$$"
|
||||
GITEA_TOKEN="ba94c160b97c3a0fa5cf528ecc107eb2c8cddaa7"
|
||||
REPO_URL="http://git:${GITEA_TOKEN}@gitea.kangaroo-eel.ts.net:3000/Anthony/openclaw-backup.git"
|
||||
LOG_FILE="$HOME/.openclaw/workspace/logs/backup.log"
|
||||
|
||||
log() {
|
||||
@@ -22,44 +20,88 @@ mkdir -p "$(dirname "$LOG_FILE")"
|
||||
|
||||
log "Starting backup..."
|
||||
|
||||
# Clone or update repo
|
||||
if [ -d "$REPO_DIR" ]; then
|
||||
log "Updating existing repo..."
|
||||
cd "$REPO_DIR"
|
||||
git pull --rebase || log "Warning: pull failed, continuing..."
|
||||
else
|
||||
log "Cloning backup repo..."
|
||||
git clone "$REPO_URL" "$REPO_DIR"
|
||||
cd "$REPO_DIR"
|
||||
fi
|
||||
# Clean up any old temp repo
|
||||
rm -rf "$REPO_DIR"
|
||||
|
||||
# Backup workspace (excluding scripts directory to avoid recursion)
|
||||
# Clone repo fresh
|
||||
log "Cloning backup repo..."
|
||||
git clone "$REPO_URL" "$REPO_DIR"
|
||||
cd "$REPO_DIR"
|
||||
|
||||
# Backup workspace files (at root of repo)
|
||||
log "Backing up workspace..."
|
||||
rsync -av --delete \
|
||||
--exclude='.git' \
|
||||
--exclude='node_modules' \
|
||||
--exclude='*.log' \
|
||||
"$BACKUP_DIR/" "$REPO_DIR/workspace/"
|
||||
--exclude='.cache' \
|
||||
--exclude='.venvs' \
|
||||
--exclude='tmp' \
|
||||
"$BACKUP_DIR/" "$REPO_DIR/"
|
||||
|
||||
# Backup state directory (critical config)
|
||||
# Update skill tracker before backup
|
||||
log "Updating skill tracker..."
|
||||
"$BACKUP_DIR/scripts/skill-tracker.sh" save 2>/dev/null || true
|
||||
|
||||
# Backup state directory to openclaw-state/
|
||||
log "Backing up state directory..."
|
||||
mkdir -p "$REPO_DIR/state"
|
||||
mkdir -p "$REPO_DIR/openclaw-state"
|
||||
|
||||
# Copy critical state files
|
||||
rsync -av --delete \
|
||||
--include='openclaw.json' \
|
||||
--include='cron/' \
|
||||
--include='cron/**' \
|
||||
--include='skills/' \
|
||||
--include='skills/**' \
|
||||
--include='devices/' \
|
||||
--include='devices/**' \
|
||||
--include='devices/paired.json' \
|
||||
--exclude='*' \
|
||||
"$STATE_DIR/" "$REPO_DIR/state/"
|
||||
"$STATE_DIR/" "$REPO_DIR/openclaw-state/"
|
||||
|
||||
# Update manifest
|
||||
log "Updating manifest..."
|
||||
cat > "$REPO_DIR/BACKUP_MANIFEST.md" <<EOF
|
||||
# OpenClaw Backup
|
||||
Generated: $(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
## Contents
|
||||
- skills/ - All installed skills and configs
|
||||
- automations/ - Custom automations (morning briefing, etc.)
|
||||
- memory/ - Long-term memory and daily notes
|
||||
- *.md - Core configuration files
|
||||
- openclaw-state/ - CRITICAL: Gateway config, cron jobs, skills metadata
|
||||
- openclaw.json - Gateway config (models, plugins, channels)
|
||||
- cron/jobs.json - All cron jobs
|
||||
- devices/paired.json - Paired devices
|
||||
- .installed-skills.json - Skill tracker for auto-recovery after updates
|
||||
|
||||
## CRITICAL: Restore Order
|
||||
1. Clone this repo
|
||||
2. Copy openclaw-state/openclaw.json to ~/.openclaw/openclaw.json
|
||||
3. Copy openclaw-state/cron/jobs.json to ~/.openclaw/cron/jobs.json
|
||||
4. Copy openclaw-state/devices/paired.json to ~/.openclaw/devices/paired.json
|
||||
5. Copy workspace files to ~/.openclaw/workspace/
|
||||
6. Restart OpenClaw gateway
|
||||
7. Run: ~/.openclaw/workspace/scripts/skill-tracker.sh restore
|
||||
(This auto-reinstalls any skills lost during updates!)
|
||||
|
||||
## CRITICAL Credentials to Save Separately (NOT in this repo)
|
||||
Store these separately in a secure password manager!
|
||||
- All API keys from Notion database
|
||||
- WhatsApp session tokens
|
||||
- Any keys in ~/.config/
|
||||
EOF
|
||||
|
||||
# Configure git
|
||||
git config user.email "krillyclaw@gmail.com"
|
||||
git config user.name "Krilly the Crab"
|
||||
|
||||
# Commit and push
|
||||
log "Committing changes..."
|
||||
cd "$REPO_DIR"
|
||||
git add -A
|
||||
git diff --cached --quiet || git commit -m "Backup: $(date '+%Y-%m-%d %H:%M:%S')"
|
||||
git push origin main || git push origin master
|
||||
git push origin main
|
||||
|
||||
log "Backup complete!"
|
||||
|
||||
# Clean up
|
||||
rm -rf "$REPO_DIR"
|
||||
|
||||
Reference in New Issue
Block a user