SAyyeedd commited on
Commit
df375f0
·
verified ·
1 Parent(s): aa7e532

Delete sync.sh

Browse files
Files changed (1) hide show
  1. sync.sh +0 -54
sync.sh DELETED
@@ -1,54 +0,0 @@
1
- #!/bin/bash
2
-
3
- HF_TOKEN="${HF_TOKEN:?HF_TOKEN must be set}"
4
-
5
- huggingface-cli login --token "$HF_TOKEN" --add-to-git-credential 2>&1 | head -1
6
-
7
- HF_USER="${HF_USER:-$(huggingface-cli whoami 2>/dev/null | head -1 | cut -d' ' -f1)}"
8
-
9
- DATASET="${DATASET:-${HF_USER}/mc-server-data}"
10
-
11
- init_dataset() {
12
- echo "التحقق من Dataset: $DATASET"
13
- if huggingface-cli repo create "$DATASET" --type dataset 2>&1; then
14
- echo "✅ تم إنشاء Dataset"
15
- else
16
- echo "⚠️ Dataset موجود مسبقاً"
17
- fi
18
- }
19
-
20
- pull_files() {
21
- echo "سحب الملفات من Dataset..."
22
- mkdir -p /tmp/sync
23
- if huggingface-cli download "$DATASET" --local-dir /tmp/sync --token "$HF_TOKEN" 2>&1; then
24
- cp -r /tmp/sync/* /minecraft/ 2>/dev/null || echo "لا توجد ملفات في Dataset"
25
- rm -rf /tmp/sync
26
- echo "✅ تم سحب الملفات"
27
- else
28
- echo "ℹ️ Dataset فاضي أو لا يمكن السحب"
29
- fi
30
- }
31
-
32
- push_file() {
33
- [ -f "$1" ] && huggingface-cli upload "$DATASET" "$1" --token "$HF_TOKEN" 2>&1 && echo "✅ رفع $1"
34
- }
35
-
36
- backup_world() {
37
- echo "نسخ احتياطي للعالم..."
38
- tar czf /tmp/world-backup.tar.gz -C /minecraft world 2>/dev/null
39
- if huggingface-cli upload "$DATASET" /tmp/world-backup.tar.gz --token "$HF_TOKEN" 2>&1; then
40
- echo "✅ تم نسخ العالم"
41
- fi
42
- rm -f /tmp/world-backup.tar.gz
43
- }
44
-
45
- case "${1:-all}" in
46
- init) init_dataset ;;
47
- pull) pull_files ;;
48
- push) shift; push_file "$@" ;;
49
- backup) backup_world ;;
50
- all)
51
- init_dataset
52
- pull_files
53
- ;;
54
- esac