Replace grep with findstr on Windows

This commit is contained in:
cmdr2 2022-10-23 14:37:59 +05:30
parent 0922ba938c
commit 461f618b8a
2 changed files with 10 additions and 10 deletions

View File

@ -14,7 +14,7 @@ if "%update_branch%"=="" (
set update_branch=main 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" ( @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" ( 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. 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" ( @if "%ERRORLEVEL%" EQU "0" (
@echo "Stable Diffusion UI's git repository was already installed. Updating from %update_branch%.." @echo "Stable Diffusion UI's git repository was already installed. Updating from %update_branch%.."

View File

@ -14,7 +14,7 @@ if exist "%cd%\profile" (
set USERPROFILE=%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" ( @if "%ERRORLEVEL%" EQU "0" (
@echo "Stable Diffusion's git repository was already installed. Updating.." @echo "Stable Diffusion's git repository was already installed. Updating.."
@ -50,7 +50,7 @@ if exist "%cd%\profile" (
@cd stable-diffusion @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" ( @if "%ERRORLEVEL%" EQU "0" (
@echo "Packages necessary for Stable Diffusion were already installed" @echo "Packages necessary for Stable Diffusion were already installed"
@ -92,7 +92,7 @@ if exist "%cd%\profile" (
set PATH=C:\Windows\System32;%PATH% 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" ( @if "%ERRORLEVEL%" EQU "0" (
@echo "Packages necessary for GFPGAN (Face Correction) were already installed" @echo "Packages necessary for GFPGAN (Face Correction) were already installed"
) else ( ) else (
@ -125,7 +125,7 @@ set PATH=C:\Windows\System32;%PATH%
@echo conda_sd_gfpgan_deps_installed >> ..\scripts\install_status.txt @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" ( @if "%ERRORLEVEL%" EQU "0" (
@echo "Packages necessary for ESRGAN (Resolution Upscaling) were already installed" @echo "Packages necessary for ESRGAN (Resolution Upscaling) were already installed"
) else ( ) else (
@ -152,7 +152,7 @@ set PATH=C:\Windows\System32;%PATH%
@echo conda_sd_esrgan_deps_installed >> ..\scripts\install_status.txt @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" ( @if "%ERRORLEVEL%" EQU "0" (
echo "Packages necessary for Stable Diffusion UI were already installed" echo "Packages necessary for Stable Diffusion UI were already installed"
) else ( ) else (
@ -172,14 +172,14 @@ set PATH=C:\Windows\System32;%PATH%
) )
call WHERE uvicorn > .tmp call WHERE uvicorn > .tmp
@>nul grep -c "uvicorn" .tmp @>nul findstr /m "uvicorn" .tmp
@if "%ERRORLEVEL%" NEQ "0" ( @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. @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 pause
exit /b 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" ( @if "%ERRORLEVEL%" NEQ "0" (
@echo conda_sd_ui_deps_installed >> ..\scripts\install_status.txt @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" ( @if "%ERRORLEVEL%" NEQ "0" (
@echo sd_weights_downloaded >> ..\scripts\install_status.txt @echo sd_weights_downloaded >> ..\scripts\install_status.txt
@echo sd_install_complete >> ..\scripts\install_status.txt @echo sd_install_complete >> ..\scripts\install_status.txt