From b6c6fef770bcec70d7ae538cee92e2dd00753ddc Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Sun, 23 Oct 2022 10:47:44 +0530 Subject: [PATCH] Use findstr instead of grep 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 4d402fdc..a4df2e33 100644 --- a/scripts/on_env_start.bat +++ b/scripts/on_env_start.bat @@ -12,7 +12,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. @@ -26,7 +26,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 94ba6a89..536bf5a9 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -15,7 +15,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.." @@ -51,7 +51,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" @@ -93,7 +93,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 ( @@ -126,7 +126,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 ( @@ -153,7 +153,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 ( @@ -173,14 +173,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 ) @@ -318,7 +318,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