Download updates from the configured channel

This commit is contained in:
cmdr2 2022-09-09 18:26:00 +05:30
parent 0d33964a03
commit 09cdbe6b90
2 changed files with 26 additions and 6 deletions

View File

@ -4,6 +4,14 @@
@cd ..
if exist "scripts\config.bat" (
@call scripts\config.bat
)
if "%update_branch%"=="" (
set update_branch="main"
)
@>nul grep -c "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" (
@ -20,19 +28,20 @@
@>nul grep -c "sd_ui_git_cloned" scripts\install_status.txt
@if "%ERRORLEVEL%" EQU "0" (
@echo "Stable Diffusion UI's git repository was already installed. Updating.."
@echo "Stable Diffusion UI's git repository was already installed. Updating from %update_branch%.."
@cd sd-ui-files
@call git reset --hard
@call git checkout main
@call git checkout "%update_branch%"
@call git pull
@cd ..
) else (
@echo. & echo "Downloading Stable Diffusion UI.." & echo.
@echo "Using the %update_branch% channel" & echo.
@call git clone https://github.com/cmdr2/stable-diffusion-ui.git sd-ui-files && (
@call git clone -b "%update_branch%" https://github.com/cmdr2/stable-diffusion-ui.git sd-ui-files && (
@echo sd_ui_git_cloned >> scripts\install_status.txt
) || (
@echo "Error downloading Stable Diffusion UI. 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/blob/main/Troubleshooting.md" & 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!"

View File

@ -1,19 +1,28 @@
printf "\n\nStable Diffusion UI\n\n"
if [ -f "scripts/config.sh" ]; then
source scripts/config.sh
fi
if [ "$update_branch" == "" ]; then
export update_branch="main"
fi
if [ -f "scripts/install_status.txt" ] && [ `grep -c sd_ui_git_cloned scripts/install_status.txt` -gt "0" ]; then
echo "Stable Diffusion UI's git repository was already installed. Updating.."
echo "Stable Diffusion UI's git repository was already installed. Updating from $update_branch.."
cd sd-ui-files
git reset --hard
git checkout main
git checkout "$update_branch"
git pull
cd ..
else
printf "\n\nDownloading Stable Diffusion UI..\n\n"
printf "Using the $update_branch channel\n\n"
if git clone https://github.com/cmdr2/stable-diffusion-ui.git sd-ui-files ; then
if git clone -b "$update_branch" https://github.com/cmdr2/stable-diffusion-ui.git sd-ui-files ; then
echo sd_ui_git_cloned >> scripts/install_status.txt
else
printf "\n\nError downloading Stable Diffusion UI. Sorry about that, please try to:\n 1. Run this installer again.\n 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/blob/main/Troubleshooting.md\n 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\n 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues\nThanks!\n\n"
@ -27,3 +36,5 @@ cp sd-ui-files/scripts/on_sd_start.sh scripts/
cp sd-ui-files/scripts/start.sh .
./scripts/on_sd_start.sh
read -p "Press any key to continue"