feat: FTP-Spiegel fuer externe 3D-Assets
- --publish laedt Workbench-Dateien per FTPS hoch und verifiziert sie durch Rueckdownload und SHA-256 - --sync laedt fehlende Assets vom Server, wenn die Workbench fehlt - Manifest um remote-Pfad ergaenzt, Manifest-Test auf 53 Assertions - Doku, Architektur (D13) und Roadmap aktualisiert
This commit is contained in:
parent
8861cbae92
commit
697274ce1b
7 changed files with 494 additions and 104 deletions
|
|
@ -3,8 +3,8 @@
|
||||||
Stand: 2026-10-31
|
Stand: 2026-10-31
|
||||||
Grundlage: `rinkplanner/rinkplanner_definition_agent_guidelines.md`
|
Grundlage: `rinkplanner/rinkplanner_definition_agent_guidelines.md`
|
||||||
Übergeordnete Reihenfolge: `docs/roadmap.md`
|
Übergeordnete Reihenfolge: `docs/roadmap.md`
|
||||||
Letzte Session: `docs/findings-2026-10-31-arp-rig.md`
|
Letzte Session: `docs/findings-2026-10-31-asset-ftp.md`
|
||||||
(Session davor: `docs/findings-2026-10-31-sprungkombinationen.md`)
|
(Session davor: `docs/findings-2026-10-31-arp-rig.md`)
|
||||||
|
|
||||||
## 1. Leitentscheidung
|
## 1. Leitentscheidung
|
||||||
|
|
||||||
|
|
@ -182,6 +182,10 @@ den Godot-Import an. Damit bleiben Checkout und Build klein, während die
|
||||||
Arbeitsdateien versioniert und reproduzierbar bleiben. Phase 1 lädt keine
|
Arbeitsdateien versioniert und reproduzierbar bleiben. Phase 1 lädt keine
|
||||||
3D-Ressourcen; die Pipeline ist Vorbereitung für Phase 2. Details:
|
3D-Ressourcen; die Pipeline ist Vorbereitung für Phase 2. Details:
|
||||||
`docs/assets.md`.
|
`docs/assets.md`.
|
||||||
|
Für Rechner ohne Workbench spiegelt `tools/sync_assets.sh --publish` die
|
||||||
|
Dateien zusätzlich auf den bestehenden FTP-Server der Kür-Synchronisation;
|
||||||
|
`--sync` lädt sie bei Bedarf und prüft sie gegen den Manifest-Hash. Der
|
||||||
|
FTP-Spiegel ist eine Verteilungskopie, keine zweite Quelle der Wahrheit.
|
||||||
|
|
||||||
## 4. View- und Controller-Grenzen
|
## 4. View- und Controller-Grenzen
|
||||||
|
|
||||||
|
|
@ -452,9 +456,9 @@ Aktueller Stand:
|
||||||
PASV/EPSV/MDTM-Parsing, Sync-Stand und die Einstellungs-Verdrahtung.
|
PASV/EPSV/MDTM-Parsing, Sync-Stand und die Einstellungs-Verdrahtung.
|
||||||
Der FTP-Client wurde zusätzlich gegen den echten Zielserver geprüft
|
Der FTP-Client wurde zusätzlich gegen den echten Zielserver geprüft
|
||||||
(Upload, Download, Übernahme, Konflikt, Aufräumen).
|
(Upload, Download, Übernahme, Konflikt, Aufräumen).
|
||||||
- **3D-Assets:** 48 Assertions für Manifest-Schema, Pfade, Platzierung,
|
- **3D-Assets:** 53 Assertions für Manifest-Schema, Pfade, FTP-Pfade,
|
||||||
Rig-Metadaten, Hashes und – falls synchronisiert – Größe und SHA-256 der
|
Platzierung, Rig-Metadaten, Hashes und – falls synchronisiert – Größe und
|
||||||
GLB-Datei.
|
SHA-256 der GLB-Datei.
|
||||||
|
|
||||||
Autosave/Restore wird zusätzlich in einem isolierten `XDG_DATA_HOME`
|
Autosave/Restore wird zusätzlich in einem isolierten `XDG_DATA_HOME`
|
||||||
end-to-end geprüft.
|
end-to-end geprüft.
|
||||||
|
|
|
||||||
|
|
@ -37,27 +37,88 @@ tools/sync_assets.sh
|
||||||
`library/` legen (`..._v001.glb`, `..._v002.glb`).
|
`library/` legen (`..._v001.glb`, `..._v002.glb`).
|
||||||
3. Die bearbeitbare Quelle (`.blend`, Rig, Referenzvideo) nach `source/`.
|
3. Die bearbeitbare Quelle (`.blend`, Rig, Referenzvideo) nach `source/`.
|
||||||
4. Eintrag in `rinkplanner/assets/asset_manifest.json` ergänzen:
|
4. Eintrag in `rinkplanner/assets/asset_manifest.json` ergänzen:
|
||||||
ID, Quelle, Ziel, SHA-256, Größe, Platzierung, Rig, Animationen.
|
ID, Quelle, Ziel, FTP-Pfad, SHA-256, Größe, Platzierung, Rig, Animationen.
|
||||||
5. `./tools/sync_assets.sh --sync` kopiert und importiert.
|
5. `./tools/sync_assets.sh --sync` kopiert und importiert.
|
||||||
6. Vor dem Commit `./tools/sync_assets.sh --check` laufen lassen.
|
6. Bei geänderter Datei `./tools/sync_assets.sh --publish` für den Spiegel.
|
||||||
|
7. Vor dem Commit `./tools/sync_assets.sh --check` laufen lassen.
|
||||||
|
|
||||||
### Befehle
|
### Befehle
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./tools/sync_assets.sh --check # Standard: nur prüfen
|
./tools/sync_assets.sh --check # Standard: nur lokal prüfen
|
||||||
./tools/sync_assets.sh --sync # fehlende Dateien kopieren + Godot-Import
|
./tools/sync_assets.sh --sync # kopieren/laden + Godot-Import
|
||||||
./tools/sync_assets.sh --sync --force # abweichendes Ziel überschreiben
|
./tools/sync_assets.sh --sync --force # abweichendes Ziel überschreiben
|
||||||
|
./tools/sync_assets.sh --publish # Workbench-Dateien auf den FTP-Spiegel laden
|
||||||
```
|
```
|
||||||
|
|
||||||
Umgebungsvariablen:
|
`--sync` arbeitet in dieser Reihenfolge:
|
||||||
|
|
||||||
|
1. Ziel in `assets/external/` ist vorhanden und hat den Manifest-Hash → OK.
|
||||||
|
2. Workbench-Quelle ist vorhanden → kopieren.
|
||||||
|
3. Sonst vom FTP-Spiegel laden.
|
||||||
|
|
||||||
|
Damit funktioniert ein frischer Checkout auf einem Rechner ohne
|
||||||
|
Workbench-Archiv, sofern die FTP-Zugangsdaten vorliegen.
|
||||||
|
|
||||||
|
### FTP-Spiegel
|
||||||
|
|
||||||
|
Der vorhandene FTP-Server der Kür-Synchronisation dient als
|
||||||
|
Verteilungskopie. Die Dateien liegen dort unterhalb des App-Verzeichnisses:
|
||||||
|
|
||||||
|
```
|
||||||
|
<FTP_DIRECTORY>/assets/<remote>
|
||||||
|
# z. B. rinkplanner/assets/characters/skater_figure_rigged_deform_v002.glb
|
||||||
|
```
|
||||||
|
|
||||||
|
`FTP_DIRECTORY` ist das Verzeichnis aus `docs/credentials.txt` (aktuell
|
||||||
|
`rinkplanner`). Der Unterordner `assets` wird beim ersten Upload automatisch
|
||||||
|
angelegt (`--ftp-create-dirs`).
|
||||||
|
|
||||||
|
Zugangsdaten kommen aus `docs/credentials.txt` (gitignored) oder aus
|
||||||
|
`RINKPLANNER_FTP_*`-Umgebungsvariablen. Das Format ist dasselbe wie für die
|
||||||
|
App:
|
||||||
|
|
||||||
|
```
|
||||||
|
FTP_URL=<host>
|
||||||
|
FTP_USER=<benutzer>
|
||||||
|
FTP_PASSWORD=<passwort>
|
||||||
|
FTP_DIRECTORY=rinkplanner
|
||||||
|
```
|
||||||
|
|
||||||
|
Optional:
|
||||||
|
|
||||||
|
| Schlüssel | Bedeutung |
|
||||||
|
| :--- | :--- |
|
||||||
|
| `FTP_ASSET_DIRECTORY` | überschreibt `<FTP_DIRECTORY>/assets` |
|
||||||
|
| `FTP_VERIFY=1` | TLS-Zertifikat prüfen (Standard: 0) |
|
||||||
|
|
||||||
|
Der Server verwendet explizites FTPS (`AUTH TLS`, Port 21). Sein Zertifikat
|
||||||
|
hat keinen passenden Hostnamen, deshalb ist die Prüfung standardmäßig aus.
|
||||||
|
Die Integrität hängt nicht am Zertifikat, sondern am SHA-256 aus dem
|
||||||
|
Manifest: Nach jedem Upload wird die Datei zurückgeladen und gehasht; nach
|
||||||
|
jedem Download wird vor dem Verschieben gehasht.
|
||||||
|
|
||||||
|
`--publish` ist bewusst ein eigener Befehl. Ein normaler `--sync` lädt nichts
|
||||||
|
hoch und überschreibt keine Serverdatei.
|
||||||
|
|
||||||
|
Auf einem neuen Rechner:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp /pfad/zu/credentials.txt docs/credentials.txt
|
||||||
|
./tools/sync_assets.sh --sync
|
||||||
|
```
|
||||||
|
|
||||||
|
Weitere Umgebungsvariablen:
|
||||||
|
|
||||||
| Variable | Standard | Zweck |
|
| Variable | Standard | Zweck |
|
||||||
| :--- | :--- | :--- |
|
| :--- | :--- | :--- |
|
||||||
| `RINKPLANNER_WORKBENCH` | `~/Documents/workbench_rinkplanner` | Archivpfad |
|
| `RINKPLANNER_WORKBENCH` | `~/Documents/workbench_rinkplanner` | Archivpfad |
|
||||||
|
| `RINKPLANNER_CREDENTIALS` | `<repo>/docs/credentials.txt` | FTP-Konfiguration |
|
||||||
| `GODOT` | `/opt/godot/Godot_v4.7.2-stable_linux.x86_64` | Import-Binary |
|
| `GODOT` | `/opt/godot/Godot_v4.7.2-stable_linux.x86_64` | Import-Binary |
|
||||||
|
|
||||||
Das Skript prüft **Quelle und Ziel** gegen den Hash aus dem Manifest. Eine
|
Das Skript prüft beim Kopieren, Laden und Veröffentlichen die jeweilige
|
||||||
still veränderte Workbench-Datei wird nicht kopiert, sondern gemeldet.
|
Datei gegen den Hash aus dem Manifest. `--check` prüft nur das lokale Ziel;
|
||||||
|
eine still veränderte Workbench-Datei wird nicht kopiert, sondern gemeldet.
|
||||||
|
|
||||||
## Manifest
|
## Manifest
|
||||||
|
|
||||||
|
|
@ -69,6 +130,7 @@ still veränderte Workbench-Datei wird nicht kopiert, sondern gemeldet.
|
||||||
"format": "glb",
|
"format": "glb",
|
||||||
"source": "library/characters/skater_figure_rigged_deform_v002.glb",
|
"source": "library/characters/skater_figure_rigged_deform_v002.glb",
|
||||||
"target": "assets/external/characters/skater_figure_rigged_deform_v002.glb",
|
"target": "assets/external/characters/skater_figure_rigged_deform_v002.glb",
|
||||||
|
"remote": "characters/skater_figure_rigged_deform_v002.glb",
|
||||||
"sha256": "1c1f0646…",
|
"sha256": "1c1f0646…",
|
||||||
"bytes": 8345424,
|
"bytes": 8345424,
|
||||||
"source_scene": "source/characters/skater/skater_rig_v002.blend",
|
"source_scene": "source/characters/skater/skater_rig_v002.blend",
|
||||||
|
|
@ -95,6 +157,7 @@ still veränderte Workbench-Datei wird nicht kopiert, sondern gemeldet.
|
||||||
| `version` | Zähler der kuratierten Fassung |
|
| `version` | Zähler der kuratierten Fassung |
|
||||||
| `source` | Pfad relativ zum Workbench-Archiv |
|
| `source` | Pfad relativ zum Workbench-Archiv |
|
||||||
| `target` | Pfad relativ zum Godot-Projekt, immer unter `assets/external/` |
|
| `target` | Pfad relativ zum Godot-Projekt, immer unter `assets/external/` |
|
||||||
|
| `remote` | Pfad relativ zum FTP-Asset-Verzeichnis |
|
||||||
| `sha256` / `bytes` | Integritätsprüfung |
|
| `sha256` / `bytes` | Integritätsprüfung |
|
||||||
| `source_scene` | bearbeitbare Quelle (`.blend`) für Rig/Animation |
|
| `source_scene` | bearbeitbare Quelle (`.blend`) für Rig/Animation |
|
||||||
| `placement` | Up-Achse, Blickrichtung, Pivot und Höhe für die 3D-Szene |
|
| `placement` | Up-Achse, Blickrichtung, Pivot und Höhe für die 3D-Szene |
|
||||||
|
|
@ -155,6 +218,7 @@ Details und Messwerte: `docs/findings-2026-10-31-arp-rig.md`.
|
||||||
|
|
||||||
## Tests
|
## Tests
|
||||||
|
|
||||||
`tests/run_asset_manifest_tests.gd` prüft Schema, Pfade, Hashes und – falls
|
`tests/run_asset_manifest_tests.gd` prüft Schema, Pfade, FTP-Pfade, Hashes
|
||||||
synchronisiert – Größe und SHA-256 der Zieldatei. Fehlt das Asset (z. B. in
|
und – falls synchronisiert – Größe und SHA-256 der Zieldatei. Fehlt das
|
||||||
CI), wird der Dateicheck übersprungen, der Schema-Test bleibt aktiv.
|
Asset (z. B. in CI), wird der Dateicheck übersprungen, der Schema-Test bleibt
|
||||||
|
aktiv. Aktuell: 53 Assertions.
|
||||||
|
|
|
||||||
107
docs/findings-2026-10-31-asset-ftp.md
Normal file
107
docs/findings-2026-10-31-asset-ftp.md
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
# Findings 2026-10-31 – FTP-Spiegel für externe Assets
|
||||||
|
|
||||||
|
## Problem
|
||||||
|
|
||||||
|
Ein frischer Checkout auf einem anderen Rechner hat kein
|
||||||
|
Workbench-Archiv und damit keine 3D-Modelle. `assets/external/` ist
|
||||||
|
gitignored, der Rig und die GLB fehlen.
|
||||||
|
|
||||||
|
## Lösung
|
||||||
|
|
||||||
|
Der vorhandene FTP-Server der Kür-Synchronisation dient zusätzlich als
|
||||||
|
Verteilungskopie für die 3D-Assets. Das Repo bleibt die Quelle der Wahrheit
|
||||||
|
für IDs und Hashes; der Workbench bleibt die Quelle für die Bearbeitung.
|
||||||
|
|
||||||
|
```
|
||||||
|
FTP-Server
|
||||||
|
└── rinkplanner/ # FTP_DIRECTORY aus credentials.txt
|
||||||
|
├── ... # Kür-Dateien
|
||||||
|
└── assets/
|
||||||
|
└── characters/
|
||||||
|
└── skater_figure_rigged_deform_v002.glb
|
||||||
|
```
|
||||||
|
|
||||||
|
`FTP_ASSET_DIRECTORY` ist standardmäßig `<FTP_DIRECTORY>/assets` und kann
|
||||||
|
überschrieben werden. Beim ersten Upload legt curl die Ordner an.
|
||||||
|
|
||||||
|
## Ablauf
|
||||||
|
|
||||||
|
### Veröffentlichen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./tools/sync_assets.sh --publish
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Quelle gegen den Manifest-Hash prüfen.
|
||||||
|
2. Datei per explizitem FTPS hochladen (`AUTH TLS`, Port 21).
|
||||||
|
3. Datei zurückladen, Größe und SHA-256 prüfen.
|
||||||
|
4. Erst dann „OK".
|
||||||
|
|
||||||
|
`--publish` ist ein eigener Befehl; ein normaler `--sync` lädt nichts hoch.
|
||||||
|
|
||||||
|
### Auf einem Rechner ohne Workbench
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp /pfad/zu/credentials.txt docs/credentials.txt
|
||||||
|
./tools/sync_assets.sh --sync
|
||||||
|
```
|
||||||
|
|
||||||
|
`--sync` prüft in dieser Reihenfolge:
|
||||||
|
|
||||||
|
1. Ziel in `assets/external/` vorhanden und Hash korrekt → OK.
|
||||||
|
2. Workbench-Quelle vorhanden → kopieren.
|
||||||
|
3. Sonst FTP-Download nach temporärer Datei, Hash prüfen, verschieben,
|
||||||
|
Godot-Import anstoßen.
|
||||||
|
|
||||||
|
## Zugangsdaten
|
||||||
|
|
||||||
|
`docs/credentials.txt` (gitignored) mit den bestehenden Schlüsseln:
|
||||||
|
|
||||||
|
```
|
||||||
|
FTP_URL=<host>
|
||||||
|
FTP_USER=<benutzer>
|
||||||
|
FTP_PASSWORD=<passwort>
|
||||||
|
FTP_DIRECTORY=rinkplanner
|
||||||
|
```
|
||||||
|
|
||||||
|
Optional `FTP_ASSET_DIRECTORY` und `FTP_VERIFY=1`. Alternativ
|
||||||
|
`RINKPLANNER_FTP_*`-Umgebungsvariablen.
|
||||||
|
|
||||||
|
## Sicherheit und Integrität
|
||||||
|
|
||||||
|
- Der Server nutzt explizites FTPS. Sein Zertifikat hat keinen passenden
|
||||||
|
Hostnamen; die Prüfung ist deshalb standardmäßig aus (`FTP_VERIFY=0`).
|
||||||
|
- Der Vertrauensanker ist nicht das Zertifikat, sondern der SHA-256 aus
|
||||||
|
`asset_manifest.json`. Jeder Upload wird zurückgelesen und gehasht, jeder
|
||||||
|
Download vor dem Verschieben geprüft.
|
||||||
|
- Zugangsdaten liegen ausschließlich in der gitignorierten Datei bzw. in
|
||||||
|
Umgebungsvariablen. Das Manifest enthält keine Secrets.
|
||||||
|
- Der FTP-Spiegel ist eine Verteilungskopie. Ohne Workbench kann man Assets
|
||||||
|
laden, aber keine neuen Versionen erzeugen.
|
||||||
|
|
||||||
|
## Test
|
||||||
|
|
||||||
|
1. `--publish` lud `skater_figure_rigged_deform_v002.glb` (8.345.424 Bytes)
|
||||||
|
nach `rinkplanner/assets/characters/` und verifizierte den Rückdownload.
|
||||||
|
2. Ziel aus `assets/external/` entfernt, `RINKPLANNER_WORKBENCH` auf ein
|
||||||
|
nicht existierendes Verzeichnis gesetzt.
|
||||||
|
3. `--sync` lud die Datei per FTP, Hash
|
||||||
|
`1c1f06461b58b02d9b8332a756fdc88f533ff2d25f65a59d21ca0209b65128cb`,
|
||||||
|
Godot-Import erfolgreich.
|
||||||
|
4. `--check` danach grün.
|
||||||
|
|
||||||
|
## Tests und Doku
|
||||||
|
|
||||||
|
- `tests/run_asset_manifest_tests.gd`: jetzt 53 Assertions (zusätzlich
|
||||||
|
FTP-Pfad, Relativität, Eindeutigkeit).
|
||||||
|
- Gesamtsuite: **1128 Assertions**.
|
||||||
|
- `docs/assets.md` beschreibt Spiegel, Befehle und den Rechner ohne
|
||||||
|
Workbench.
|
||||||
|
|
||||||
|
## Offen
|
||||||
|
|
||||||
|
- Aufräumregel für alte Versionen auf dem Server (aktuell sammeln sich
|
||||||
|
versionierte Dateien).
|
||||||
|
- Android: 1K-Texturen oder separater Asset-Pack, damit die 8,35 MB nicht
|
||||||
|
ungeprüft ins APK wandern.
|
||||||
|
- Optional: `--check --remote`, um die Serverdatei ohne Download zu prüfen.
|
||||||
|
|
@ -183,6 +183,7 @@ UI-Feedback der Tester ohnehin noch ausstehen.
|
||||||
## Phase 2 – 3D-Präsentation
|
## Phase 2 – 3D-Präsentation
|
||||||
|
|
||||||
- [x] Externe Asset-Pipeline (Manifest, Hash-Prüfung, Sync nach `assets/external/`)
|
- [x] Externe Asset-Pipeline (Manifest, Hash-Prüfung, Sync nach `assets/external/`)
|
||||||
|
- [x] FTP-Spiegel für Rechner ohne Workbench (`--publish` / `--sync`-Fallback)
|
||||||
- [x] Geriggter Skater (AutoRigPro, 226 Control-/30 Deform-Bones, glTF-Export)
|
- [x] Geriggter Skater (AutoRigPro, 226 Control-/30 Deform-Bones, glTF-Export)
|
||||||
- [x] Animations-Bake und Godot-Import eines Testclips (`TestWave`)
|
- [x] Animations-Bake und Godot-Import eines Testclips (`TestWave`)
|
||||||
- [ ] 3D-Rink und Skater auf Basis desselben Datenmodells im Godot-Prototyp
|
- [ ] 3D-Rink und Skater auf Basis desselben Datenmodells im Godot-Prototyp
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
"format": "glb",
|
"format": "glb",
|
||||||
"source": "library/characters/skater_figure_rigged_deform_v002.glb",
|
"source": "library/characters/skater_figure_rigged_deform_v002.glb",
|
||||||
"target": "assets/external/characters/skater_figure_rigged_deform_v002.glb",
|
"target": "assets/external/characters/skater_figure_rigged_deform_v002.glb",
|
||||||
|
"remote": "characters/skater_figure_rigged_deform_v002.glb",
|
||||||
"sha256": "1c1f06461b58b02d9b8332a756fdc88f533ff2d25f65a59d21ca0209b65128cb",
|
"sha256": "1c1f06461b58b02d9b8332a756fdc88f533ff2d25f65a59d21ca0209b65128cb",
|
||||||
"bytes": 8345424,
|
"bytes": 8345424,
|
||||||
"source_scene": "source/characters/skater/skater_rig_v002.blend",
|
"source_scene": "source/characters/skater/skater_rig_v002.blend",
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,12 @@ func _run() -> void:
|
||||||
|
|
||||||
var seen_ids := {}
|
var seen_ids := {}
|
||||||
var seen_targets := {}
|
var seen_targets := {}
|
||||||
|
var seen_remotes := {}
|
||||||
for entry: Variant in asset_list:
|
for entry: Variant in asset_list:
|
||||||
_check(entry is Dictionary, "asset entry is an object")
|
_check(entry is Dictionary, "asset entry is an object")
|
||||||
if not entry is Dictionary:
|
if not entry is Dictionary:
|
||||||
continue
|
continue
|
||||||
_validate_asset(entry, seen_ids, seen_targets)
|
_validate_asset(entry, seen_ids, seen_targets, seen_remotes)
|
||||||
|
|
||||||
_finish()
|
_finish()
|
||||||
|
|
||||||
|
|
@ -61,7 +62,8 @@ func _run() -> void:
|
||||||
func _validate_asset(
|
func _validate_asset(
|
||||||
asset: Dictionary,
|
asset: Dictionary,
|
||||||
seen_ids: Dictionary,
|
seen_ids: Dictionary,
|
||||||
seen_targets: Dictionary
|
seen_targets: Dictionary,
|
||||||
|
seen_remotes: Dictionary
|
||||||
) -> void:
|
) -> void:
|
||||||
for key: String in [
|
for key: String in [
|
||||||
"id",
|
"id",
|
||||||
|
|
@ -70,6 +72,7 @@ func _validate_asset(
|
||||||
"format",
|
"format",
|
||||||
"source",
|
"source",
|
||||||
"target",
|
"target",
|
||||||
|
"remote",
|
||||||
"sha256",
|
"sha256",
|
||||||
"bytes",
|
"bytes",
|
||||||
"placement",
|
"placement",
|
||||||
|
|
@ -110,6 +113,19 @@ func _validate_asset(
|
||||||
)
|
)
|
||||||
seen_targets[target] = true
|
seen_targets[target] = true
|
||||||
|
|
||||||
|
var remote := str(asset.get("remote", ""))
|
||||||
|
_check(not remote.is_empty(), "asset '%s' has a remote path" % asset_id)
|
||||||
|
_check(_is_relative_path(remote), "asset '%s' remote path is relative" % asset_id)
|
||||||
|
_check(
|
||||||
|
not remote.contains(".."),
|
||||||
|
"asset '%s' remote path has no '..'" % asset_id
|
||||||
|
)
|
||||||
|
_check(
|
||||||
|
not seen_remotes.has(remote),
|
||||||
|
"asset '%s' remote path is unique" % asset_id
|
||||||
|
)
|
||||||
|
seen_remotes[remote] = true
|
||||||
|
|
||||||
var sha256 := str(asset.get("sha256", ""))
|
var sha256 := str(asset.get("sha256", ""))
|
||||||
_check(sha256.length() == 64, "asset '%s' has a SHA-256 length" % asset_id)
|
_check(sha256.length() == 64, "asset '%s' has a SHA-256 length" % asset_id)
|
||||||
_check(_is_hex(sha256), "asset '%s' has a hexadecimal SHA-256" % asset_id)
|
_check(_is_hex(sha256), "asset '%s' has a hexadecimal SHA-256" % asset_id)
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Synchronisiert externe 3D-Assets aus dem Workbench-Archiv in das Godot-Projekt.
|
# Synchronisiert externe 3D-Assets aus dem Workbench-Archiv oder per FTP.
|
||||||
#
|
#
|
||||||
# Die Binärdateien werden nicht versioniert. Das Manifest
|
# Reihenfolge beim Sync:
|
||||||
# rinkplanner/assets/asset_manifest.json beschreibt Quelle, Ziel, Hash und
|
# 1. Ziel ist vorhanden und hat den Manifest-Hash -> OK
|
||||||
# Metadaten. Nach dem Kopieren wird der Godot-Import angestoßen.
|
# 2. Workbench-Quelle ist vorhanden -> kopieren
|
||||||
|
# 3. Sonst: vom FTP-Spiegel laden (für Rechner ohne Workbench)
|
||||||
|
#
|
||||||
|
# Der FTP-Spiegel ist eine Verteilungskopie, keine zweite Quelle der Wahrheit.
|
||||||
|
# Integritätsanker ist immer der SHA-256 aus asset_manifest.json.
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
|
@ -11,22 +15,50 @@ PROJECT_DIR="$REPO_ROOT/rinkplanner"
|
||||||
MANIFEST="$PROJECT_DIR/assets/asset_manifest.json"
|
MANIFEST="$PROJECT_DIR/assets/asset_manifest.json"
|
||||||
WORKBENCH="${RINKPLANNER_WORKBENCH:-$HOME/Documents/workbench_rinkplanner}"
|
WORKBENCH="${RINKPLANNER_WORKBENCH:-$HOME/Documents/workbench_rinkplanner}"
|
||||||
GODOT="${GODOT:-/opt/godot/Godot_v4.7.2-stable_linux.x86_64}"
|
GODOT="${GODOT:-/opt/godot/Godot_v4.7.2-stable_linux.x86_64}"
|
||||||
|
CREDENTIALS_FILE="${RINKPLANNER_CREDENTIALS:-$REPO_ROOT/docs/credentials.txt}"
|
||||||
|
|
||||||
MODE="check"
|
MODE="check"
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
|
||||||
|
ENV_FTP_HOST="${RINKPLANNER_FTP_HOST:-}"
|
||||||
|
ENV_FTP_PORT="${RINKPLANNER_FTP_PORT:-}"
|
||||||
|
ENV_FTP_USER="${RINKPLANNER_FTP_USER:-}"
|
||||||
|
ENV_FTP_PASSWORD="${RINKPLANNER_FTP_PASSWORD:-}"
|
||||||
|
ENV_FTP_ROOT="${RINKPLANNER_FTP_ROOT:-}"
|
||||||
|
ENV_FTP_ASSET_DIR="${RINKPLANNER_FTP_ASSET_DIR:-}"
|
||||||
|
ENV_FTP_VERIFY="${RINKPLANNER_FTP_VERIFY:-}"
|
||||||
|
|
||||||
|
FILE_FTP_URL=""
|
||||||
|
FILE_FTP_USER=""
|
||||||
|
FILE_FTP_PASSWORD=""
|
||||||
|
FILE_FTP_ROOT=""
|
||||||
|
FILE_FTP_ASSET_DIR=""
|
||||||
|
FILE_FTP_VERIFY=""
|
||||||
|
FILE_FTP_PORT=""
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat <<'EOF'
|
cat <<'EOF'
|
||||||
Aufruf: tools/sync_assets.sh [--check|--sync] [--force]
|
Aufruf: tools/sync_assets.sh [--check|--sync|--publish] [--force]
|
||||||
|
|
||||||
--check Prüft nur, ob die Ziele vorhanden und hashes korrekt sind (Standard).
|
--check Prüft nur, ob die Ziele vorhanden und hashes korrekt sind (Standard).
|
||||||
--sync Kopiert fehlende Assets und importiert sie in Godot.
|
--sync Kopiert fehlende Assets aus der Workbench oder lädt sie per FTP
|
||||||
--force Überschreibt vorhandene Ziele mit abweichendem Hash (nur mit --sync).
|
und importiert sie anschließend in Godot.
|
||||||
|
--publish Lädt die Workbench-Dateien auf den FTP-Spiegel und prüft sie dort.
|
||||||
|
--force Überschreibt vorhandene Ziele mit abweichendem Hash (nur mit --sync).
|
||||||
|
|
||||||
Umgebung:
|
Umgebung:
|
||||||
RINKPLANNER_WORKBENCH Pfad zum Workbench-Archiv
|
RINKPLANNER_WORKBENCH Pfad zum Workbench-Archiv
|
||||||
(Standard: ~/Documents/workbench_rinkplanner)
|
(Standard: ~/Documents/workbench_rinkplanner)
|
||||||
GODOT Godot-Binary für den Import
|
RINKPLANNER_CREDENTIALS Pfad zur FTP-Konfiguration
|
||||||
|
(Standard: <repo>/docs/credentials.txt)
|
||||||
|
RINKPLANNER_FTP_HOST FTP-Host (überschreibt FTP_URL)
|
||||||
|
RINKPLANNER_FTP_PORT FTP-Port (Standard: 21)
|
||||||
|
RINKPLANNER_FTP_USER FTP-Benutzer
|
||||||
|
RINKPLANNER_FTP_PASSWORD FTP-Passwort
|
||||||
|
RINKPLANNER_FTP_ROOT App-Verzeichnis auf dem Server (z. B. rinkplanner)
|
||||||
|
RINKPLANNER_FTP_ASSET_DIR Asset-Verzeichnis (Standard: <ROOT>/assets)
|
||||||
|
RINKPLANNER_FTP_VERIFY 1 = TLS-Zertifikat prüfen, 0 = nicht prüfen
|
||||||
|
GODOT Godot-Binary für den Import
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -34,6 +66,7 @@ while [[ $# -gt 0 ]]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--check) MODE="check" ;;
|
--check) MODE="check" ;;
|
||||||
--sync) MODE="sync" ;;
|
--sync) MODE="sync" ;;
|
||||||
|
--publish) MODE="publish" ;;
|
||||||
--force) FORCE=1 ;;
|
--force) FORCE=1 ;;
|
||||||
-h|--help) usage; exit 0 ;;
|
-h|--help) usage; exit 0 ;;
|
||||||
*) echo "Unbekannte Option: $1" >&2; usage >&2; exit 2 ;;
|
*) echo "Unbekannte Option: $1" >&2; usage >&2; exit 2 ;;
|
||||||
|
|
@ -51,6 +84,114 @@ if [[ "$FORCE" -eq 1 && "$MODE" != "sync" ]]; then
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# --- FTP-Konfiguration lesen -------------------------------------------------
|
||||||
|
|
||||||
|
if [[ -f "$CREDENTIALS_FILE" ]]; then
|
||||||
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||||
|
line="${line%$'\r'}"
|
||||||
|
[[ -z "$line" || "$line" == \#* ]] && continue
|
||||||
|
[[ "$line" != *=* ]] && continue
|
||||||
|
key="${line%%=*}"
|
||||||
|
value="${line#*=}"
|
||||||
|
value="${value#\"}"; value="${value%\"}"
|
||||||
|
value="${value#\'}"; value="${value%\'}"
|
||||||
|
case "$key" in
|
||||||
|
FTP_URL) FILE_FTP_URL="$value" ;;
|
||||||
|
FTP_USER) FILE_FTP_USER="$value" ;;
|
||||||
|
FTP_PASSWORD) FILE_FTP_PASSWORD="$value" ;;
|
||||||
|
FTP_DIRECTORY) FILE_FTP_ROOT="$value" ;;
|
||||||
|
FTP_ASSET_DIRECTORY) FILE_FTP_ASSET_DIR="$value" ;;
|
||||||
|
FTP_VERIFY) FILE_FTP_VERIFY="$value" ;;
|
||||||
|
FTP_PORT) FILE_FTP_PORT="$value" ;;
|
||||||
|
esac
|
||||||
|
done < "$CREDENTIALS_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$FILE_FTP_URL" in
|
||||||
|
ftp://*) FILE_FTP_URL="${FILE_FTP_URL#ftp://}" ;;
|
||||||
|
ftps://*) FILE_FTP_URL="${FILE_FTP_URL#ftps://}" ;;
|
||||||
|
esac
|
||||||
|
FILE_FTP_URL="${FILE_FTP_URL%%/*}"
|
||||||
|
if [[ "$FILE_FTP_URL" == *:* ]]; then
|
||||||
|
FILE_FTP_PORT="${FILE_FTP_URL##*:}"
|
||||||
|
FILE_FTP_URL="${FILE_FTP_URL%:*}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
FTP_HOST="${ENV_FTP_HOST:-$FILE_FTP_URL}"
|
||||||
|
FTP_PORT="${ENV_FTP_PORT:-${FILE_FTP_PORT:-21}}"
|
||||||
|
FTP_USER="${ENV_FTP_USER:-$FILE_FTP_USER}"
|
||||||
|
FTP_PASSWORD="${ENV_FTP_PASSWORD:-$FILE_FTP_PASSWORD}"
|
||||||
|
FTP_ROOT="${ENV_FTP_ROOT:-$FILE_FTP_ROOT}"
|
||||||
|
FTP_ASSET_DIR="${ENV_FTP_ASSET_DIR:-$FILE_FTP_ASSET_DIR}"
|
||||||
|
FTP_VERIFY="${ENV_FTP_VERIFY:-${FILE_FTP_VERIFY:-0}}"
|
||||||
|
|
||||||
|
FTP_ROOT="${FTP_ROOT#/}"; FTP_ROOT="${FTP_ROOT%/}"
|
||||||
|
if [[ -z "$FTP_ASSET_DIR" ]]; then
|
||||||
|
if [[ -n "$FTP_ROOT" ]]; then
|
||||||
|
FTP_ASSET_DIR="$FTP_ROOT/assets"
|
||||||
|
else
|
||||||
|
FTP_ASSET_DIR="assets"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
FTP_ASSET_DIR="${FTP_ASSET_DIR#/}"; FTP_ASSET_DIR="${FTP_ASSET_DIR%/}"
|
||||||
|
|
||||||
|
REMOTE_READY=0
|
||||||
|
CURL_BASE=()
|
||||||
|
|
||||||
|
ensure_remote() {
|
||||||
|
if [[ "$REMOTE_READY" -eq 1 ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [[ -z "$FTP_HOST" || -z "$FTP_USER" || -z "$FTP_PASSWORD" ]]; then
|
||||||
|
echo "FTP-Zugang fehlt. Lege $CREDENTIALS_FILE an oder setze RINKPLANNER_FTP_*." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURL_BASE=(
|
||||||
|
--ssl-reqd
|
||||||
|
--silent
|
||||||
|
--show-error
|
||||||
|
--connect-timeout 20
|
||||||
|
--max-time 900
|
||||||
|
--user "$FTP_USER:$FTP_PASSWORD"
|
||||||
|
)
|
||||||
|
|
||||||
|
case "$FTP_VERIFY" in
|
||||||
|
1|true|TRUE|yes|YES)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
CURL_BASE+=(--insecure)
|
||||||
|
echo "Hinweis: TLS-Zertifikat wird nicht geprüft; Integrität sichert der SHA-256 aus dem Manifest." >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
REMOTE_READY=1
|
||||||
|
}
|
||||||
|
|
||||||
|
remote_url() {
|
||||||
|
local remote_path="$1"
|
||||||
|
remote_path="${remote_path#/}"
|
||||||
|
printf 'ftp://%s:%s/%s/%s' "$FTP_HOST" "$FTP_PORT" "$FTP_ASSET_DIR" "$remote_path"
|
||||||
|
}
|
||||||
|
|
||||||
|
remote_download() {
|
||||||
|
local remote_path="$1"
|
||||||
|
local destination="$2"
|
||||||
|
local url
|
||||||
|
url="$(remote_url "$remote_path")"
|
||||||
|
curl "${CURL_BASE[@]}" --output "$destination" "$url"
|
||||||
|
}
|
||||||
|
|
||||||
|
remote_upload() {
|
||||||
|
local remote_path="$1"
|
||||||
|
local source_path="$2"
|
||||||
|
local url
|
||||||
|
url="$(remote_url "$remote_path")"
|
||||||
|
curl "${CURL_BASE[@]}" --ftp-create-dirs --upload-file "$source_path" "$url"
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- Manifest lesen ----------------------------------------------------------
|
||||||
|
|
||||||
mapfile -t rows < <(python3 - "$MANIFEST" <<'PY'
|
mapfile -t rows < <(python3 - "$MANIFEST" <<'PY'
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
@ -63,6 +204,7 @@ for asset in document.get("assets", []):
|
||||||
asset["id"],
|
asset["id"],
|
||||||
asset["source"],
|
asset["source"],
|
||||||
asset["target"],
|
asset["target"],
|
||||||
|
asset.get("remote", ""),
|
||||||
asset["sha256"],
|
asset["sha256"],
|
||||||
str(asset["bytes"]),
|
str(asset["bytes"]),
|
||||||
]))
|
]))
|
||||||
|
|
@ -74,115 +216,170 @@ if [[ ${#rows[@]} -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
problems=0
|
file_size() {
|
||||||
copied=0
|
stat -c '%s' "$1"
|
||||||
|
|
||||||
check_asset() {
|
|
||||||
local source_path="$1"
|
|
||||||
local target_path="$2"
|
|
||||||
local expected_sha="$3"
|
|
||||||
local expected_bytes="$4"
|
|
||||||
|
|
||||||
if [[ ! -f "$source_path" ]]; then
|
|
||||||
echo " FEHLT (Quelle): $source_path" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
local actual_bytes actual_sha
|
|
||||||
actual_bytes="$(stat -c '%s' "$source_path")"
|
|
||||||
actual_sha="$(sha256sum "$source_path" | cut -d' ' -f1)"
|
|
||||||
if [[ "$actual_bytes" != "$expected_bytes" || "$actual_sha" != "$expected_sha" ]]; then
|
|
||||||
echo " HASH-FEHLER (Quelle): $source_path" >&2
|
|
||||||
echo " erwartet: $expected_bytes Bytes / $expected_sha" >&2
|
|
||||||
echo " gefunden: $actual_bytes Bytes / $actual_sha" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f "$target_path" ]]; then
|
|
||||||
echo " FEHLT (Ziel): $target_path" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
actual_bytes="$(stat -c '%s' "$target_path")"
|
|
||||||
actual_sha="$(sha256sum "$target_path" | cut -d' ' -f1)"
|
|
||||||
if [[ "$actual_bytes" != "$expected_bytes" || "$actual_sha" != "$expected_sha" ]]; then
|
|
||||||
echo " HASH-FEHLER (Ziel): $target_path" >&2
|
|
||||||
echo " erwartet: $expected_bytes Bytes / $expected_sha" >&2
|
|
||||||
echo " gefunden: $actual_bytes Bytes / $actual_sha" >&2
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file_sha() {
|
||||||
|
sha256sum "$1" | cut -d' ' -f1
|
||||||
|
}
|
||||||
|
|
||||||
|
matches_hash() {
|
||||||
|
local path="$1"
|
||||||
|
local expected_sha="$2"
|
||||||
|
local expected_bytes="$3"
|
||||||
|
[[ -f "$path" ]] || return 1
|
||||||
|
[[ "$(file_size "$path")" == "$expected_bytes" ]] || return 1
|
||||||
|
[[ "$(file_sha "$path")" == "$expected_sha" ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
# --- Publish -----------------------------------------------------------------
|
||||||
|
|
||||||
|
if [[ "$MODE" == "publish" ]]; then
|
||||||
|
ensure_remote
|
||||||
|
problems=0
|
||||||
|
for row in "${rows[@]}"; do
|
||||||
|
IFS=$'\t' read -r asset_id relative_source relative_target remote_path expected_sha expected_bytes <<< "$row"
|
||||||
|
source_path="$WORKBENCH/$relative_source"
|
||||||
|
|
||||||
|
echo "[$asset_id]"
|
||||||
|
if [[ -z "$remote_path" ]]; then
|
||||||
|
echo " KEIN FTP-PFAD im Manifest." >&2
|
||||||
|
problems=$((problems + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! matches_hash "$source_path" "$expected_sha" "$expected_bytes"; then
|
||||||
|
echo " QUELLE FEHLT ODER HAT FALSCHEN HASH: $source_path" >&2
|
||||||
|
problems=$((problems + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo " Lade hoch: $FTP_ASSET_DIR/$remote_path"
|
||||||
|
if ! remote_upload "$remote_path" "$source_path"; then
|
||||||
|
echo " UPLOAD FEHLGESCHLAGEN." >&2
|
||||||
|
problems=$((problems + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
tmp="$(mktemp "${TMPDIR:-/tmp}/rinkplanner-asset.XXXXXX")"
|
||||||
|
if ! remote_download "$remote_path" "$tmp"; then
|
||||||
|
echo " KONTROLLE FEHLGESCHLAGEN (Download)." >&2
|
||||||
|
rm -f "$tmp"
|
||||||
|
problems=$((problems + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! matches_hash "$tmp" "$expected_sha" "$expected_bytes"; then
|
||||||
|
echo " KONTROLLE FEHLGESCHLAGEN (Hash)." >&2
|
||||||
|
rm -f "$tmp"
|
||||||
|
problems=$((problems + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
rm -f "$tmp"
|
||||||
|
echo " OK"
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ "$problems" -gt 0 ]]; then
|
||||||
|
echo "" >&2
|
||||||
|
echo "$problems Asset(s) nicht veröffentlicht." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "FTP-Spiegel OK."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Check und Sync ----------------------------------------------------------
|
||||||
|
|
||||||
|
problems=0
|
||||||
|
changed=0
|
||||||
|
|
||||||
for row in "${rows[@]}"; do
|
for row in "${rows[@]}"; do
|
||||||
IFS=$'\t' read -r asset_id relative_source relative_target expected_sha expected_bytes <<< "$row"
|
IFS=$'\t' read -r asset_id relative_source relative_target remote_path expected_sha expected_bytes <<< "$row"
|
||||||
source_path="$WORKBENCH/$relative_source"
|
source_path="$WORKBENCH/$relative_source"
|
||||||
target_path="$PROJECT_DIR/$relative_target"
|
target_path="$PROJECT_DIR/$relative_target"
|
||||||
|
|
||||||
echo "[$asset_id]"
|
echo "[$asset_id]"
|
||||||
|
|
||||||
|
if matches_hash "$target_path" "$expected_sha" "$expected_bytes"; then
|
||||||
|
echo " OK"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ "$MODE" == "check" ]]; then
|
if [[ "$MODE" == "check" ]]; then
|
||||||
if check_asset "$source_path" "$target_path" "$expected_sha" "$expected_bytes"; then
|
if [[ ! -f "$target_path" ]]; then
|
||||||
echo " OK"
|
echo " FEHLT (Ziel): $target_path" >&2
|
||||||
else
|
else
|
||||||
problems=$((problems + 1))
|
echo " HASH-FEHLER (Ziel): $target_path" >&2
|
||||||
|
fi
|
||||||
|
if [[ -f "$source_path" ]]; then
|
||||||
|
echo " Mit tools/sync_assets.sh --sync aus der Workbench kopieren." >&2
|
||||||
|
else
|
||||||
|
echo " Mit tools/sync_assets.sh --sync aus dem FTP-Spiegel laden." >&2
|
||||||
fi
|
fi
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f "$source_path" ]]; then
|
|
||||||
echo " FEHLT (Quelle): $source_path" >&2
|
|
||||||
problems=$((problems + 1))
|
problems=$((problems + 1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source_bytes="$(stat -c '%s' "$source_path")"
|
if [[ -f "$target_path" && "$FORCE" -ne 1 ]]; then
|
||||||
source_sha="$(sha256sum "$source_path" | cut -d' ' -f1)"
|
echo " ABWEICHUNG: $target_path" >&2
|
||||||
if [[ "$source_bytes" != "$expected_bytes" || "$source_sha" != "$expected_sha" ]]; then
|
echo " Ziel hat einen anderen Hash. Mit --force überschreiben." >&2
|
||||||
echo " HASH-FEHLER (Quelle): $source_path" >&2
|
|
||||||
echo " Manifest und Workbench-Datei passen nicht zusammen." >&2
|
|
||||||
problems=$((problems + 1))
|
problems=$((problems + 1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "$target_path" ]]; then
|
if [[ -f "$source_path" ]]; then
|
||||||
target_sha="$(sha256sum "$target_path" | cut -d' ' -f1)"
|
if ! matches_hash "$source_path" "$expected_sha" "$expected_bytes"; then
|
||||||
if [[ "$target_sha" == "$expected_sha" ]]; then
|
echo " HASH-FEHLER (Quelle): $source_path" >&2
|
||||||
echo " OK (bereits synchronisiert)"
|
echo " Manifest und Workbench-Datei passen nicht zusammen." >&2
|
||||||
continue
|
|
||||||
fi
|
|
||||||
if [[ "$FORCE" -ne 1 ]]; then
|
|
||||||
echo " ABWEICHUNG: $target_path" >&2
|
|
||||||
echo " Ziel hat einen anderen Hash. Mit --force überschreiben." >&2
|
|
||||||
problems=$((problems + 1))
|
problems=$((problems + 1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
mkdir -p "$(dirname "$target_path")"
|
||||||
|
cp "$source_path" "$target_path"
|
||||||
|
if ! matches_hash "$target_path" "$expected_sha" "$expected_bytes"; then
|
||||||
|
echo " KOPIERFEHLER: $target_path" >&2
|
||||||
|
problems=$((problems + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo " Kopiert (Workbench): $relative_target"
|
||||||
|
changed=$((changed + 1))
|
||||||
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$remote_path" ]]; then
|
||||||
|
echo " FEHLT: weder Workbench noch FTP-Pfad vorhanden." >&2
|
||||||
|
problems=$((problems + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
ensure_remote
|
||||||
|
tmp="$(mktemp "${TMPDIR:-/tmp}/rinkplanner-asset.XXXXXX")"
|
||||||
|
echo " Workbench fehlt, lade aus FTP: $FTP_ASSET_DIR/$remote_path"
|
||||||
|
if ! remote_download "$remote_path" "$tmp"; then
|
||||||
|
echo " DOWNLOAD FEHLGESCHLAGEN." >&2
|
||||||
|
rm -f "$tmp"
|
||||||
|
problems=$((problems + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
if ! matches_hash "$tmp" "$expected_sha" "$expected_bytes"; then
|
||||||
|
echo " HASH-FEHLER (FTP): $remote_path" >&2
|
||||||
|
rm -f "$tmp"
|
||||||
|
problems=$((problems + 1))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
mkdir -p "$(dirname "$target_path")"
|
mkdir -p "$(dirname "$target_path")"
|
||||||
cp "$source_path" "$target_path"
|
mv "$tmp" "$target_path"
|
||||||
target_sha="$(sha256sum "$target_path" | cut -d' ' -f1)"
|
chmod 644 "$target_path"
|
||||||
if [[ "$target_sha" != "$expected_sha" ]]; then
|
echo " Geladen (FTP): $relative_target"
|
||||||
echo " KOPIERFEHLER: $target_path" >&2
|
changed=$((changed + 1))
|
||||||
problems=$((problems + 1))
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo " Kopiert: $relative_target"
|
|
||||||
copied=$((copied + 1))
|
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "$problems" -gt 0 ]]; then
|
if [[ "$problems" -gt 0 ]]; then
|
||||||
echo "" >&2
|
echo "" >&2
|
||||||
echo "$problems Asset(s) nicht in Ordnung." >&2
|
echo "$problems Asset(s) nicht in Ordnung." >&2
|
||||||
if [[ "$MODE" == "check" ]]; then
|
|
||||||
echo "Mit tools/sync_assets.sh --sync kopieren." >&2
|
|
||||||
fi
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$MODE" == "sync" && "$copied" -gt 0 ]]; then
|
if [[ "$MODE" == "sync" && "$changed" -gt 0 ]]; then
|
||||||
if [[ -x "$GODOT" ]]; then
|
if [[ -x "$GODOT" ]]; then
|
||||||
echo "Godot-Import..."
|
echo "Godot-Import..."
|
||||||
"$GODOT" --headless --path "$PROJECT_DIR" --import >/dev/null
|
"$GODOT" --headless --path "$PROJECT_DIR" --import >/dev/null
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue