From 409ec61be266441c79398ee7a147ef55c0e4766c Mon Sep 17 00:00:00 2001 From: JeLuF Date: Thu, 19 Jan 2023 00:40:20 +0100 Subject: [PATCH] Fail fatally, add same check on Linux, add some extra checks on Linux Linux: Check that curl, bzip2, tar are available, check whether there's a space character in the install path, check whether the CPU supports AVX. --- scripts/Start Stable Diffusion UI.cmd | 4 +--- scripts/bootstrap.sh | 7 +++++++ scripts/start.sh | 18 ++++++++++++++++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/scripts/Start Stable Diffusion UI.cmd b/scripts/Start Stable Diffusion UI.cmd index 34629051..d720328d 100644 --- a/scripts/Start Stable Diffusion UI.cmd +++ b/scripts/Start Stable Diffusion UI.cmd @@ -18,10 +18,8 @@ if exist "on_sd_start.bat" ( echo. echo ================================================================================ echo. - echo Not Recommended: If you're sure that you want to run the installer from this - echo directory, please press any key to continue. - echo. pause + exit /b ) @rem set legacy installer's PATH, if it exists diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh index 6a8df9b3..81c4510e 100755 --- a/scripts/bootstrap.sh +++ b/scripts/bootstrap.sh @@ -24,6 +24,13 @@ case "${OS_ARCH}" in *) echo "Unknown system architecture: $OS_ARCH! This script runs only on x86_64 or arm64" && exit esac +if ! which curl; then fail "'curl' not found. Please install curl."; fi +if ! which tar; then fail "'tar' not found. Please install tar."; fi +if ! which bzip2; then fail "'bzip2' not found. Please install bzip2."; fi + +if pwd | grep ' '; then fail "The installation directory's path contains a space character. Conda will fail to install. Please change the directory."; fi +if ! cat /proc/cpuinfo | grep avx | uniq; then fail "Your CPU doesn't support AVX."; fi + # https://mamba.readthedocs.io/en/latest/installation.html if [ "$OS_NAME" == "linux" ] && [ "$OS_ARCH" == "arm64" ]; then OS_ARCH="aarch64"; fi diff --git a/scripts/start.sh b/scripts/start.sh index 61ac3f74..3d8a585d 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -2,6 +2,24 @@ cd "$(dirname "${BASH_SOURCE[0]}")" +if [ -f "on_sd_start.bat" ]; then + echo ================================================================================ + echo + echo !!!! WARNING !!!! + echo + echo It looks like you\'re trying to run the installation script from a source code + echo download. This will not work. + echo + echo Recommended: Please close this window and download the installer from + echo https://stable-diffusion-ui.github.io/docs/installation/ + echo + echo ================================================================================ + echo + read + exit 1 +fi + + # set legacy installer's PATH, if it exists if [ -e "installer" ]; then export PATH="$(pwd)/installer/bin:$PATH"; fi