#!/bin/sh set -e REPO="${HF_DATASET:-jay-hank/Nexova-storage}" TOKEN="${HF_TOKEN}" DB_DIR="./data" DB_FILE="nexova.db" mkdir -p "$DB_DIR" if [ -z "$TOKEN" ]; then echo "[restore] HF_TOKEN not set, skip" exit 0 fi echo "[restore] downloading from $REPO..." STATUS=$(curl -s -o "$DB_DIR/$DB_FILE" -w "%{http_code}" \ "https://huggingface.co/datasets/$REPO/resolve/main/$DB_FILE" \ -H "Authorization: Bearer $TOKEN" \ -L) if [ "$STATUS" = "200" ]; then SIZE=$(wc -c < "$DB_DIR/$DB_FILE") echo "[restore] done ($SIZE bytes)" else echo "[restore] no backup (HTTP $STATUS), starting fresh" rm -f "$DB_DIR/$DB_FILE" fi