#!/usr/bin/env bash set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck disable=SC1091 source "${SCRIPT_DIR}/catalog-lib.sh" # shellcheck disable=SC1091 source "${SCRIPT_DIR}/download-http-lib.sh" URL="" DEST="" while [[ $# -gt 0 ]]; do case "$1" in --url) URL="${2:-}" shift 2 ;; --dest) DEST="${2:-}" shift 2 ;; *) echo "Usage: $0 --url URL --dest /absolute/path/to/file" exit 1 ;; esac done if [[ -z "${URL}" || -z "${DEST}" ]]; then echo "Usage: $0 --url URL --dest /absolute/path/to/file" exit 1 fi load_comfyui_stack_env DATA_ROOT="${DATA_ROOT:-/data}" MODELS_ROOT="${DATA_ROOT}/apps/comfyui/models" if [[ "${DEST}" != "${MODELS_ROOT}"/* ]]; then echo "ERROR: Destination must be under ${MODELS_ROOT}" exit 1 fi if [[ -f "${DEST}" ]]; then echo "Already exists: ${DEST}" echo "" echo "Done." exit 0 fi mkdir -p "$(dirname "${DEST}")" download_http_file "${URL}" "${DEST}" if [[ ! -f "${DEST}" ]]; then echo "ERROR: Download finished but file missing: ${DEST}" exit 1 fi echo "" echo "Done."