mirror of
https://github.com/openvinotoolkit/stable-diffusion-webui.git
synced 2024-12-14 22:53:25 +03:00
webui.sh: remove all cd
related code
This may be helpful for https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/7028, because we won't change working directory to the repo now, instead, we will use any working directory. If we set working directory to a path contains repo and the custom --data-dir, the problem in this issue should be solved. Howewer, this may be treated as an incompatible change if some code assume the working directory is always the repo. Also, there may be another solution that always let --data-dir be the subdirectory of the repo, but personally I think this may not be what we actually need. As this issue mainly influent on Docker and I am not familiar with .bat files, updating webui.bat is skipped. webui.sh: source env from repo instead $PWD
This commit is contained in:
parent
98695c1885
commit
d006108d75
28
webui.sh
28
webui.sh
@ -6,19 +6,18 @@
|
|||||||
|
|
||||||
# If run from macOS, load defaults from webui-macos-env.sh
|
# If run from macOS, load defaults from webui-macos-env.sh
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
if [[ -f webui-macos-env.sh ]]
|
if [[ -f "$(dirname $0)/webui-macos-env.sh" ]]
|
||||||
then
|
then
|
||||||
source ./webui-macos-env.sh
|
source "$(dirname $0)/webui-macos-env.sh"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Read variables from webui-user.sh
|
# Read variables from webui-user.sh
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
if [[ -f webui-user.sh ]]
|
if [[ -f "$(dirname $0)/webui-user.sh" ]]
|
||||||
then
|
then
|
||||||
source ./webui-user.sh
|
source "$(dirname $0)/webui-user.sh"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set defaults
|
# Set defaults
|
||||||
# Install directory without trailing slash
|
# Install directory without trailing slash
|
||||||
if [[ -z "${install_dir}" ]]
|
if [[ -z "${install_dir}" ]]
|
||||||
@ -47,12 +46,12 @@ fi
|
|||||||
# python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
|
# python3 venv without trailing slash (defaults to ${install_dir}/${clone_dir}/venv)
|
||||||
if [[ -z "${venv_dir}" ]]
|
if [[ -z "${venv_dir}" ]]
|
||||||
then
|
then
|
||||||
venv_dir="venv"
|
venv_dir="${install_dir}/${clone_dir}/venv"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "${LAUNCH_SCRIPT}" ]]
|
if [[ -z "${LAUNCH_SCRIPT}" ]]
|
||||||
then
|
then
|
||||||
LAUNCH_SCRIPT="launch.py"
|
LAUNCH_SCRIPT="${install_dir}/${clone_dir}/launch.py"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# this script cannot be run as root by default
|
# this script cannot be run as root by default
|
||||||
@ -140,22 +139,23 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${install_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/, aborting...\e[0m" "${install_dir}"; exit 1; }
|
if [[ ! -d "${install_dir}/${clone_dir}" ]]
|
||||||
if [[ -d "${clone_dir}" ]]
|
|
||||||
then
|
then
|
||||||
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
|
||||||
else
|
|
||||||
printf "\n%s\n" "${delimiter}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
printf "Clone stable-diffusion-webui"
|
printf "Clone stable-diffusion-webui"
|
||||||
printf "\n%s\n" "${delimiter}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
"${GIT}" clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git "${clone_dir}"
|
mkdir -p "${install_dir}"
|
||||||
cd "${clone_dir}"/ || { printf "\e[1m\e[31mERROR: Can't cd to %s/%s/, aborting...\e[0m" "${install_dir}" "${clone_dir}"; exit 1; }
|
"${GIT}" clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git "${install_dir}/${clone_dir}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
printf "\n%s\n" "${delimiter}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
printf "Create and activate python venv"
|
printf "Create and activate python venv"
|
||||||
printf "\n%s\n" "${delimiter}"
|
printf "\n%s\n" "${delimiter}"
|
||||||
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; }
|
# Make venv_dir absolute
|
||||||
|
if [[ "${venv_dir}" != /* ]]
|
||||||
|
then
|
||||||
|
venv_dir="${install_dir}/${clone_dir}/${venv_dir}"
|
||||||
|
fi
|
||||||
if [[ ! -d "${venv_dir}" ]]
|
if [[ ! -d "${venv_dir}" ]]
|
||||||
then
|
then
|
||||||
"${python_cmd}" -m venv "${venv_dir}"
|
"${python_cmd}" -m venv "${venv_dir}"
|
||||||
|
Loading…
Reference in New Issue
Block a user