From 461f618b8a3fef355507f72aeaddf014cf05bc33 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 23 Oct 2022 14:37:59 +0530 Subject: [PATCH] Replace grep with findstr on Windows --- scripts/on_env_start.bat | 4 ++-- scripts/on_sd_start.bat | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/on_env_start.bat b/scripts/on_env_start.bat index 0c8eb327..f48b65aa 100644 --- a/scripts/on_env_start.bat +++ b/scripts/on_env_start.bat @@ -14,7 +14,7 @@ if "%update_branch%"=="" ( set update_branch=main ) -@>nul grep -c "conda_sd_ui_deps_installed" scripts\install_status.txt +@>nul findstr /m "conda_sd_ui_deps_installed" scripts\install_status.txt @if "%ERRORLEVEL%" NEQ "0" ( for /f "tokens=*" %%a in ('python -c "import os; parts = os.getcwd().split(os.path.sep); print(len(parts))"') do if "%%a" NEQ "2" ( echo. & echo "!!!! WARNING !!!!" & echo. @@ -28,7 +28,7 @@ if "%update_branch%"=="" ( ) ) -@>nul grep -c "sd_ui_git_cloned" scripts\install_status.txt +@>nul findstr /m "sd_ui_git_cloned" scripts\install_status.txt @if "%ERRORLEVEL%" EQU "0" ( @echo "Stable Diffusion UI's git repository was already installed. Updating from %update_branch%.." diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index feb73468..ca492df5 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -14,7 +14,7 @@ if exist "%cd%\profile" ( set USERPROFILE=%cd%\profile ) -@>nul grep -c "sd_git_cloned" scripts\install_status.txt +@>nul findstr /m "sd_git_cloned" scripts\install_status.txt @if "%ERRORLEVEL%" EQU "0" ( @echo "Stable Diffusion's git repository was already installed. Updating.." @@ -50,7 +50,7 @@ if exist "%cd%\profile" ( @cd stable-diffusion -@>nul grep -c "conda_sd_env_created" ..\scripts\install_status.txt +@>nul findstr /m "conda_sd_env_created" ..\scripts\install_status.txt @if "%ERRORLEVEL%" EQU "0" ( @echo "Packages necessary for Stable Diffusion were already installed" @@ -92,7 +92,7 @@ if exist "%cd%\profile" ( set PATH=C:\Windows\System32;%PATH% -@>nul grep -c "conda_sd_gfpgan_deps_installed" ..\scripts\install_status.txt +@>nul findstr /m "conda_sd_gfpgan_deps_installed" ..\scripts\install_status.txt @if "%ERRORLEVEL%" EQU "0" ( @echo "Packages necessary for GFPGAN (Face Correction) were already installed" ) else ( @@ -125,7 +125,7 @@ set PATH=C:\Windows\System32;%PATH% @echo conda_sd_gfpgan_deps_installed >> ..\scripts\install_status.txt ) -@>nul grep -c "conda_sd_esrgan_deps_installed" ..\scripts\install_status.txt +@>nul findstr /m "conda_sd_esrgan_deps_installed" ..\scripts\install_status.txt @if "%ERRORLEVEL%" EQU "0" ( @echo "Packages necessary for ESRGAN (Resolution Upscaling) were already installed" ) else ( @@ -152,7 +152,7 @@ set PATH=C:\Windows\System32;%PATH% @echo conda_sd_esrgan_deps_installed >> ..\scripts\install_status.txt ) -@>nul grep -c "conda_sd_ui_deps_installed" ..\scripts\install_status.txt +@>nul findstr /m "conda_sd_ui_deps_installed" ..\scripts\install_status.txt @if "%ERRORLEVEL%" EQU "0" ( echo "Packages necessary for Stable Diffusion UI were already installed" ) else ( @@ -172,14 +172,14 @@ set PATH=C:\Windows\System32;%PATH% ) call WHERE uvicorn > .tmp -@>nul grep -c "uvicorn" .tmp +@>nul findstr /m "uvicorn" .tmp @if "%ERRORLEVEL%" NEQ "0" ( @echo. & echo "UI packages not found! Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!" & echo. pause exit /b ) -@>nul grep -c "conda_sd_ui_deps_installed" ..\scripts\install_status.txt +@>nul findstr /m "conda_sd_ui_deps_installed" ..\scripts\install_status.txt @if "%ERRORLEVEL%" NEQ "0" ( @echo conda_sd_ui_deps_installed >> ..\scripts\install_status.txt ) @@ -317,7 +317,7 @@ echo. > "..\models\stable-diffusion\Put your custom ckpt files here.txt" -@>nul grep -c "sd_install_complete" ..\scripts\install_status.txt +@>nul findstr /m "sd_install_complete" ..\scripts\install_status.txt @if "%ERRORLEVEL%" NEQ "0" ( @echo sd_weights_downloaded >> ..\scripts\install_status.txt @echo sd_install_complete >> ..\scripts\install_status.txt