| # Ensure /workspace holds the full setup (ComfyUI, workflows, | |
| # download_missing_models.sh). Everything is baked into the image at | |
| # /workspace already; this only matters when a network volume is mounted | |
| # over /workspace and shadows the baked-in files — then the missing pieces | |
| # are restored from /opt/workspace-seed.tar.gz. Existing files are never | |
| # overwritten (tar --skip-old-files), so models/outputs on a volume are safe. | |
| set -e | |
| if [[ ! -d /workspace || ! -w /workspace ]]; then | |
| echo "[seed-workspace] /workspace missing or not writable — skipping." >&2 | |
| exit 0 | |
| fi | |
| if [[ ! -d /workspace/ComfyUI || ! -d /workspace/workflows || ! -f /workspace/download_missing_models.sh ]]; then | |
| echo "[seed-workspace] Restoring missing /workspace files from image seed..." | |
| tar -xzf /opt/workspace-seed.tar.gz -C /workspace --skip-old-files | |
| echo "[seed-workspace] Done." | |
| fi | |