2022-09-05 17:51:22 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-10-01 10:57:53 +00:00
|
|
|
set -Eeuo pipefail
|
|
|
|
|
2022-10-30 09:01:18 +00:00
|
|
|
# TODO: move all mkdir -p ?
|
2022-10-30 08:42:30 +00:00
|
|
|
mkdir -p /data/config/auto/scripts/
|
2022-10-14 20:42:34 +00:00
|
|
|
cp -n /docker/config.json /data/config/auto/config.json
|
|
|
|
jq '. * input' /data/config/auto/config.json /docker/config.json | sponge /data/config/auto/config.json
|
|
|
|
|
2022-10-17 16:55:16 +00:00
|
|
|
if [ ! -f /data/config/auto/ui-config.json ]; then
|
|
|
|
echo '{}' >/data/config/auto/ui-config.json
|
|
|
|
fi
|
|
|
|
|
2022-10-30 08:42:30 +00:00
|
|
|
# copy scripts, we cannot just mount the directory because it will override the already provided scripts in the repo
|
|
|
|
cp -rfT /data/config/auto/scripts/ "${ROOT}/scripts"
|
|
|
|
|
2022-10-01 10:57:53 +00:00
|
|
|
declare -A MOUNTS
|
|
|
|
|
|
|
|
MOUNTS["/root/.cache"]="/data/.cache"
|
|
|
|
|
|
|
|
# main
|
|
|
|
MOUNTS["${ROOT}/models/Stable-diffusion"]="/data/StableDiffusion"
|
2022-11-05 08:51:30 +00:00
|
|
|
MOUNTS["${ROOT}/models/VAE"]="/data/VAE"
|
2022-10-01 10:57:53 +00:00
|
|
|
MOUNTS["${ROOT}/models/Codeformer"]="/data/Codeformer"
|
|
|
|
MOUNTS["${ROOT}/models/GFPGAN"]="/data/GFPGAN"
|
|
|
|
MOUNTS["${ROOT}/models/ESRGAN"]="/data/ESRGAN"
|
|
|
|
MOUNTS["${ROOT}/models/BSRGAN"]="/data/BSRGAN"
|
|
|
|
MOUNTS["${ROOT}/models/RealESRGAN"]="/data/RealESRGAN"
|
|
|
|
MOUNTS["${ROOT}/models/SwinIR"]="/data/SwinIR"
|
2022-10-04 17:56:38 +00:00
|
|
|
MOUNTS["${ROOT}/models/ScuNET"]="/data/ScuNET"
|
2022-10-01 10:57:53 +00:00
|
|
|
MOUNTS["${ROOT}/models/LDSR"]="/data/LDSR"
|
2022-10-11 18:00:58 +00:00
|
|
|
MOUNTS["${ROOT}/models/hypernetworks"]="/data/Hypernetworks"
|
2022-11-04 21:41:38 +00:00
|
|
|
MOUNTS["${ROOT}/models/deepbooru"]="/data/Deepdanbooru"
|
2022-10-01 10:57:53 +00:00
|
|
|
|
|
|
|
MOUNTS["${ROOT}/embeddings"]="/data/embeddings"
|
2022-10-14 20:42:34 +00:00
|
|
|
MOUNTS["${ROOT}/config.json"]="/data/config/auto/config.json"
|
2022-10-17 16:55:16 +00:00
|
|
|
MOUNTS["${ROOT}/ui-config.json"]="/data/config/auto/ui-config.json"
|
2022-10-30 09:01:18 +00:00
|
|
|
MOUNTS["${ROOT}/extensions"]="/data/config/auto/extensions"
|
2022-10-01 10:57:53 +00:00
|
|
|
|
|
|
|
# extra hacks
|
|
|
|
MOUNTS["${ROOT}/repositories/CodeFormer/weights/facelib"]="/data/.cache"
|
|
|
|
|
|
|
|
for to_path in "${!MOUNTS[@]}"; do
|
|
|
|
set -Eeuo pipefail
|
|
|
|
from_path="${MOUNTS[${to_path}]}"
|
|
|
|
rm -rf "${to_path}"
|
2022-10-15 06:08:36 +00:00
|
|
|
if [ ! -f "$from_path" ]; then
|
2022-10-14 20:42:34 +00:00
|
|
|
mkdir -vp "$from_path"
|
|
|
|
fi
|
2022-10-04 17:56:38 +00:00
|
|
|
mkdir -vp "$(dirname "${to_path}")"
|
2022-10-01 10:57:53 +00:00
|
|
|
ln -sT "${from_path}" "${to_path}"
|
|
|
|
echo Mounted $(basename "${from_path}")
|
2022-09-05 17:51:22 +00:00
|
|
|
done
|
2022-10-11 16:18:52 +00:00
|
|
|
|
2022-10-30 09:01:18 +00:00
|
|
|
if [ -f "/data/config/auto/startup.sh" ]; then
|
|
|
|
pushd ${ROOT}
|
|
|
|
. /data/config/auto/startup.sh
|
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec "$@"
|