stable-diffusion-webui-docker/services/comfy/entrypoint.sh

40 lines
840 B
Bash
Raw Normal View History

#!/bin/bash
set -Eeuo pipefail
mkdir -vp /data/config/comfy/custom_nodes
declare -A MOUNTS
2025-03-10 21:22:09 +01:00
MOUNTS["${USER_HOME}/.cache"]="/data/.cache"
MOUNTS["${ROOT}/input"]="/data/config/comfy/input"
MOUNTS["${ROOT}/output"]="/output/comfy"
for to_path in "${!MOUNTS[@]}"; do
set -Eeuo pipefail
from_path="${MOUNTS[${to_path}]}"
rm -rf "${to_path}"
if [ ! -f "$from_path" ]; then
mkdir -vp "$from_path"
fi
mkdir -vp "$(dirname "${to_path}")"
ln -sT "${from_path}" "${to_path}"
echo Mounted $(basename "${from_path}")
done
if [ -f "/data/config/comfy/startup.sh" ]; then
pushd ${ROOT}
. /data/config/comfy/startup.sh
popd
fi
2025-05-05 11:02:02 +02:00
# Only chown if not running as root (UID != 0)
if [ "$(id -u)" -ne 0 ]; then
chown -R "$(id -u):$(id -g)" ~ 2>/dev/null || true
fi
2025-03-10 21:22:09 +01:00
chown -R $PUID:$PGID ~/.cache/
chmod 776 ~/.cache/
exec "$@"