Files
ubuntu-bare-metal/stacks/server-ui/scripts/comfyui/download-file.sh
T
tomasz-syn-grzegorza 73e4fc005e Add stack Update, ComfyUI model manager, and slim ComfyUI stack.
Server UI gains Update on stack cards, ComfyUI Models tab with workflow
scan and downloads, and centralized comfyui_config. Model catalog and
download scripts move from stacks/comfyui to server-ui so ComfyUI stays a
minimal Docker wrapper for easier image updates.
2026-07-05 18:45:17 +00:00

63 lines
1.1 KiB
Bash
Executable File

#!/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."