Update sync.py
Browse files
sync.py
CHANGED
|
@@ -18,7 +18,6 @@ def restore():
|
|
| 18 |
print(f"Downloading {FILENAME} from {repo_id}...")
|
| 19 |
path = hf_hub_download(repo_id=repo_id, filename=FILENAME, repo_type="dataset", token=token)
|
| 20 |
|
| 21 |
-
# 修改为完整恢复 /root/.openclaw 下所有内容
|
| 22 |
with tarfile.open(path, "r:gz") as tar:
|
| 23 |
tar.extractall(path="/root/.openclaw/")
|
| 24 |
print(f"Success: Restored from {FILENAME}")
|
|
@@ -33,9 +32,9 @@ def backup():
|
|
| 33 |
print("Skip Backup: HF_DATASET or HF_TOKEN not set")
|
| 34 |
return
|
| 35 |
|
| 36 |
-
# 修改为备份 /root/.openclaw 下全部文件和文件夹
|
| 37 |
with tarfile.open(FILENAME, "w:gz") as tar:
|
| 38 |
-
|
|
|
|
| 39 |
|
| 40 |
# 上传并覆盖
|
| 41 |
api.upload_file(
|
|
|
|
| 18 |
print(f"Downloading {FILENAME} from {repo_id}...")
|
| 19 |
path = hf_hub_download(repo_id=repo_id, filename=FILENAME, repo_type="dataset", token=token)
|
| 20 |
|
|
|
|
| 21 |
with tarfile.open(path, "r:gz") as tar:
|
| 22 |
tar.extractall(path="/root/.openclaw/")
|
| 23 |
print(f"Success: Restored from {FILENAME}")
|
|
|
|
| 32 |
print("Skip Backup: HF_DATASET or HF_TOKEN not set")
|
| 33 |
return
|
| 34 |
|
|
|
|
| 35 |
with tarfile.open(FILENAME, "w:gz") as tar:
|
| 36 |
+
# 备份 /root/.openclaw 下面全部文件和文件夹(不带外层 .openclaw 目录)
|
| 37 |
+
tar.add("/root/.openclaw", arcname="")
|
| 38 |
|
| 39 |
# 上传并覆盖
|
| 40 |
api.upload_file(
|