Spaces:
Runtime error
Runtime error
Commit
·
3567f03
1
Parent(s):
704bfc1
Delete webui.sh
Browse files
webui.sh
DELETED
|
@@ -1,141 +0,0 @@
|
|
| 1 |
-
#!/bin/bash
|
| 2 |
-
#################################################
|
| 3 |
-
# Please do not make any changes to this file, #
|
| 4 |
-
# change the variables in webui-user.sh instead #
|
| 5 |
-
#################################################
|
| 6 |
-
# Read variables from webui-user.sh
|
| 7 |
-
# shellcheck source=/dev/null
|
| 8 |
-
if [[ -f webui-user.sh ]]
|
| 9 |
-
then
|
| 10 |
-
source ./webui-user.sh
|
| 11 |
-
fi
|
| 12 |
-
|
| 13 |
-
# Set defaults
|
| 14 |
-
# Install directory without trailing slash
|
| 15 |
-
if [[ -z "${install_dir}" ]]
|
| 16 |
-
then
|
| 17 |
-
install_dir="/home/$(whoami)"
|
| 18 |
-
fi
|
| 19 |
-
|
| 20 |
-
# Name of the subdirectory (defaults to stable-diffusion-webui)
|
| 21 |
-
if [[ -z "${clone_dir}" ]]
|
| 22 |
-
then
|
| 23 |
-
clone_dir="stable-diffusion-webui"
|
| 24 |
-
fi
|
| 25 |
-
|
| 26 |
-
# python3 executable
|
| 27 |
-
if [[ -z "${python_cmd}" ]]
|
| 28 |
-
then
|
| 29 |
-
python_cmd="python3"
|
| 30 |
-
fi
|
| 31 |
-
|
| 32 |
-
# git executable
|
| 33 |
-
if [[ -z "${GIT}" ]]
|
| 34 |
-
then
|
| 35 |
-
export GIT="git"
|
| 36 |
-
fi
|
| 37 |
-
|
| 38 |
-
# python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
|
| 39 |
-
if [[ -z "${venv_dir}" ]]
|
| 40 |
-
then
|
| 41 |
-
venv_dir="venv"
|
| 42 |
-
fi
|
| 43 |
-
|
| 44 |
-
if [[ -z "${LAUNCH_SCRIPT}" ]]
|
| 45 |
-
then
|
| 46 |
-
LAUNCH_SCRIPT="launch.py"
|
| 47 |
-
fi
|
| 48 |
-
|
| 49 |
-
# Disable sentry logging
|
| 50 |
-
export ERROR_REPORTING=FALSE
|
| 51 |
-
|
| 52 |
-
# Do not reinstall existing pip packages on Debian/Ubuntu
|
| 53 |
-
export PIP_IGNORE_INSTALLED=0
|
| 54 |
-
|
| 55 |
-
# Pretty print
|
| 56 |
-
delimiter="################################################################"
|
| 57 |
-
|
| 58 |
-
printf "\n%s\n" "${delimiter}"
|
| 59 |
-
printf "\e[1m\e[32mInstall script for stable-diffusion + Web UI\n"
|
| 60 |
-
printf "\e[1m\e[34mTested on Debian 11 (Bullseye)\e[0m"
|
| 61 |
-
printf "\n%s\n" "${delimiter}"
|
| 62 |
-
|
| 63 |
-
# Do not run as root
|
| 64 |
-
if [[ $(id -u) -eq 0 ]]
|
| 65 |
-
then
|
| 66 |
-
printf "\n%s\n" "${delimiter}"
|
| 67 |
-
printf "\e[1m\e[31mERROR: This script must not be launched as root, aborting...\e[0m"
|
| 68 |
-
printf "\n%s\n" "${delimiter}"
|
| 69 |
-
exit 1
|
| 70 |
-
else
|
| 71 |
-
printf "\n%s\n" "${delimiter}"
|
| 72 |
-
printf "Running on \e[1m\e[32m%s\e[0m user" "$(whoami)"
|
| 73 |
-
printf "\n%s\n" "${delimiter}"
|
| 74 |
-
fi
|
| 75 |
-
|
| 76 |
-
if [[ -d .git ]]
|
| 77 |
-
then
|
| 78 |
-
printf "\n%s\n" "${delimiter}"
|
| 79 |
-
printf "Repo already cloned, using it as install directory"
|
| 80 |
-
printf "\n%s\n" "${delimiter}"
|
| 81 |
-
install_dir="${PWD}/../"
|
| 82 |
-
clone_dir="${PWD##*/}"
|
| 83 |
-
fi
|
| 84 |
-
|
| 85 |
-
# Check prerequisites
|
| 86 |
-
for preq in "${GIT}" "${python_cmd}"
|
| 87 |
-
do
|
| 88 |
-
if ! hash "${preq}" &>/dev/null
|
| 89 |
-
then
|
| 90 |
-
printf "\n%s\n" "${delimiter}"
|
| 91 |
-
printf "\e[1m\e[31mERROR: %s is not installed, aborting...\e[0m" "${preq}"
|
| 92 |
-
printf "\n%s\n" "${delimiter}"
|
| 93 |
-
exit 1
|
| 94 |
-
fi
|
| 95 |
-
done
|
| 96 |
-
|
| 97 |
-
if ! "${python_cmd}" -c "import venv" &>/dev/null
|
| 98 |
-
then
|
| 99 |
-
printf "\n%s\n" "${delimiter}"
|
| 100 |
-
printf "\e[1m\e[31mERROR: python3-venv is not installed, aborting...\e[0m"
|
| 101 |
-
printf "\n%s\n" "${delimiter}"
|
| 102 |
-
exit 1
|
| 103 |
-
fi
|
| 104 |
-
|
| 105 |
-
printf "\n%s\n" "${delimiter}"
|
| 106 |
-
printf "Clone or update stable-diffusion-webui"
|
| 107 |
-
printf "\n%s\n" "${delimiter}"
|
| 108 |
-
cd "${install_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/, aborting...\e[0m" "${install_dir}"; exit 1; }
|
| 109 |
-
if [[ -d "${clone_dir}" ]]
|
| 110 |
-
then
|
| 111 |
-
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
| 112 |
-
"${GIT}" pull
|
| 113 |
-
else
|
| 114 |
-
"${GIT}" clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git "${clone_dir}"
|
| 115 |
-
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
| 116 |
-
fi
|
| 117 |
-
|
| 118 |
-
printf "\n%s\n" "${delimiter}"
|
| 119 |
-
printf "Create and activate python venv"
|
| 120 |
-
printf "\n%s\n" "${delimiter}"
|
| 121 |
-
cd "${install_dir}"/"${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
| 122 |
-
if [[ ! -d "${venv_dir}" ]]
|
| 123 |
-
then
|
| 124 |
-
"${python_cmd}" -m venv "${venv_dir}"
|
| 125 |
-
first_launch=1
|
| 126 |
-
fi
|
| 127 |
-
# shellcheck source=/dev/null
|
| 128 |
-
if [[ -f "${venv_dir}"/bin/activate ]]
|
| 129 |
-
then
|
| 130 |
-
source "${venv_dir}"/bin/activate
|
| 131 |
-
else
|
| 132 |
-
printf "\n%s\n" "${delimiter}"
|
| 133 |
-
printf "\e[1m\e[31mERROR: Cannot activate python venv, aborting...\e[0m"
|
| 134 |
-
printf "\n%s\n" "${delimiter}"
|
| 135 |
-
exit 1
|
| 136 |
-
fi
|
| 137 |
-
|
| 138 |
-
printf "\n%s\n" "${delimiter}"
|
| 139 |
-
printf "Launching launch.py..."
|
| 140 |
-
printf "\n%s\n" "${delimiter}"
|
| 141 |
-
"${python_cmd}" "${LAUNCH_SCRIPT}" "$@"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|