139 lines
3.9 KiB
Batchfile
139 lines
3.9 KiB
Batchfile
@echo off
|
|
setlocal
|
|
title MMnode Updater
|
|
|
|
REM ============================================================
|
|
REM MMnode (Moxie-Multimedia) one-click updater
|
|
REM
|
|
REM Put this file INSIDE the pack folder:
|
|
REM ComfyUI\custom_nodes\<pack-folder>\
|
|
REM (next to __init__.py) and double-click it.
|
|
REM
|
|
REM It syncs code from HuggingFace, removes stale files from
|
|
REM old versions, downloads model weights via git-lfs, verifies
|
|
REM the build, and reminds you to restart ComfyUI.
|
|
REM ============================================================
|
|
|
|
cd /d "%~dp0"
|
|
|
|
echo.
|
|
echo ==================================================
|
|
echo MMnode updater - syncing from HuggingFace
|
|
echo ==================================================
|
|
echo.
|
|
|
|
if not exist "__init__.py" (
|
|
echo [ERROR] This is not the MMnode pack folder.
|
|
echo Move update.bat into ComfyUI\custom_nodes\^<pack-folder^>
|
|
echo next to __init__.py, then run it again.
|
|
goto end_fail
|
|
)
|
|
|
|
where git >nul 2>&1
|
|
if errorlevel 1 (
|
|
echo [ERROR] Git is not installed or not in PATH.
|
|
echo Get it from https://git-scm.com/download/win
|
|
goto end_fail
|
|
)
|
|
|
|
netstat -ano 2>nul | findstr /c:":8188" >nul 2>&1
|
|
if not errorlevel 1 (
|
|
echo [WARN] ComfyUI appears to be running on port 8188.
|
|
echo It must be fully closed for the update to take effect.
|
|
echo Continuing in 5 seconds - close it now...
|
|
timeout /t 5 /nobreak >nul
|
|
)
|
|
|
|
if not exist ".git" (
|
|
echo [*] No git repo here yet - initializing...
|
|
git init
|
|
if errorlevel 1 goto gitfail
|
|
)
|
|
|
|
git remote remove origin >nul 2>&1
|
|
git remote add origin https://huggingface.co/Moxiegen/Moxie-Multimedia
|
|
if errorlevel 1 goto gitfail
|
|
|
|
echo.
|
|
echo [*] Fetching latest version from HuggingFace...
|
|
git fetch origin --prune
|
|
if errorlevel 1 (
|
|
echo [ERROR] Could not reach HuggingFace - check your internet.
|
|
goto end_fail
|
|
)
|
|
|
|
echo.
|
|
echo [*] Syncing files...
|
|
git reset --hard origin/main
|
|
if errorlevel 1 goto gitfail
|
|
|
|
echo.
|
|
echo [*] Cleaning stale files from older versions...
|
|
git clean -fd -e update.bat >nul 2>&1
|
|
|
|
echo.
|
|
echo [*] Syncing model weights...
|
|
git lfs version >nul 2>&1
|
|
if errorlevel 1 goto nolfs
|
|
git lfs install >nul 2>&1
|
|
echo Downloading weights - first run can take several minutes...
|
|
git lfs fetch origin main
|
|
if errorlevel 1 echo [WARN] Weight download failed - check connection, re-run later.
|
|
git lfs checkout
|
|
goto after_lfs
|
|
|
|
:nolfs
|
|
echo [WARN] git-lfs is NOT installed on this PC.
|
|
echo Code was updated, but model weights may be broken placeholders.
|
|
echo Install git-lfs from https://git-lfs.com
|
|
echo or run: winget install GitHub.git-lfs
|
|
echo ...then run this updater again.
|
|
|
|
:after_lfs
|
|
|
|
REM ---- verify build ----
|
|
set FIXCOUNT=0
|
|
for /f %%A in ('findstr /c:"_align_canvas_dimension" "nodes\project.py" ^| find /c /v ""') do set FIXCOUNT=%%A
|
|
|
|
set POINTER=0
|
|
for /r models %%F in (*.safetensors) do (
|
|
if %%~zF LSS 1000 set /a POINTER+=1
|
|
)
|
|
|
|
echo.
|
|
echo ==================================================
|
|
for /f "delims=" %%L in ('git log -1 --oneline') do echo Build: %%L
|
|
echo Fix marker: %FIXCOUNT% found in nodes\project.py
|
|
if %FIXCOUNT% GEQ 3 (
|
|
echo [OK] This is the fixed build.
|
|
) else (
|
|
echo [ERROR] Fix marker missing - update did not complete!
|
|
)
|
|
if %POINTER% GTR 0 (
|
|
echo [WARN] %POINTER% model file^(s^) are broken placeholders.
|
|
echo Install git-lfs from https://git-lfs.com and re-run.
|
|
) else (
|
|
echo [OK] Model weights look good.
|
|
)
|
|
echo ==================================================
|
|
|
|
echo.
|
|
echo All done. RESTART COMFYUI COMPLETELY before testing.
|
|
echo Close this window and any ComfyUI console, then start ComfyUI.
|
|
goto end_ok
|
|
|
|
:gitfail
|
|
echo.
|
|
echo [ERROR] A git command failed - scroll up for the message.
|
|
goto end_fail
|
|
|
|
:end_fail
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
|
|
:end_ok
|
|
echo.
|
|
pause
|
|
exit /b 0
|