#!/bin/bash
Comfy_UI_Migrate() {
if [ -d /root/comfyui ];then
        if [ ! -d /home/waas/ComfyUI  ];then
             mkdir /home/waas/ComfyUI/
             [ -d /root/comfyui/ComfyUI/models ] && mv /root/comfyui/ComfyUI/models  /home/waas/ComfyUI/  && ln -s /home/waas/ComfyUI/models /root/comfyui/ComfyUI/models
             [ -d /root/comfyui/ComfyUI/custom_nodes ] && mv /root/comfyui/ComfyUI/custom_nodes  /home/waas/ComfyUI/  && ln -s /home/waas/ComfyUI/custom_nodes /root/comfyui/ComfyUI/custom_nodes
             [ -d /root/comfyui/ComfyUI/input ] && mv /root/comfyui/ComfyUI/input  /home/waas/ComfyUI/  && ln -s /home/waas/ComfyUI/input /root/comfyui/ComfyUI/input
             [ -d /root/comfyui/ComfyUI/models ] && mv /root/comfyui/ComfyUI/output  /home/waas/ComfyUI/  && ln -s /home/waas/ComfyUI/output /root/comfyui/ComfyUI/output
             [ -d /root/comfyui/ComfyUI/models ] && mv /root/comfyui/ComfyUI/user  /home/waas/ComfyUI/  && ln -s /home/waas/ComfyUI/user /root/comfyui/ComfyUI/user
        fi
fi
}
printenv |grep WAAS_COMFYUI_IMAGE   &> /dev/null  && Comfy_UI_Migrate
