Spaces:
Runtime error
Runtime error
atikur-rabbi
commited on
Commit
•
f38adbe
1
Parent(s):
b8f2b94
Delete scripts
Browse files- scripts/bootstrap.sh +0 -93
- scripts/functions.sh +0 -39
- scripts/install_status.txt +0 -1
- scripts/on_env_start.sh +0 -45
scripts/bootstrap.sh
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
|
3 |
-
# This script will install git and conda (if not found on the PATH variable)
|
4 |
-
# using micromamba (an 8mb static-linked single-file binary, conda replacement).
|
5 |
-
# For users who already have git and conda, this step will be skipped.
|
6 |
-
|
7 |
-
# This enables a user to install this project without manually installing conda and git.
|
8 |
-
|
9 |
-
source ./scripts/functions.sh
|
10 |
-
|
11 |
-
set -o pipefail
|
12 |
-
|
13 |
-
OS_NAME=$(uname -s)
|
14 |
-
case "${OS_NAME}" in
|
15 |
-
Linux*) OS_NAME="linux";;
|
16 |
-
Darwin*) OS_NAME="osx";;
|
17 |
-
*) echo "Unknown OS: $OS_NAME! This script runs only on Linux or Mac" && exit
|
18 |
-
esac
|
19 |
-
|
20 |
-
OS_ARCH=$(uname -m)
|
21 |
-
case "${OS_ARCH}" in
|
22 |
-
x86_64*) OS_ARCH="64";;
|
23 |
-
arm64*) OS_ARCH="arm64";;
|
24 |
-
aarch64*) OS_ARCH="arm64";;
|
25 |
-
*) echo "Unknown system architecture: $OS_ARCH! This script runs only on x86_64 or arm64" && exit
|
26 |
-
esac
|
27 |
-
|
28 |
-
if ! which curl; then fail "'curl' not found. Please install curl."; fi
|
29 |
-
if ! which tar; then fail "'tar' not found. Please install tar."; fi
|
30 |
-
if ! which bzip2; then fail "'bzip2' not found. Please install bzip2."; fi
|
31 |
-
|
32 |
-
if pwd | grep ' '; then fail "The installation directory's path contains a space character. Conda will fail to install. Please change the directory."; fi
|
33 |
-
|
34 |
-
# https://mamba.readthedocs.io/en/latest/installation.html
|
35 |
-
if [ "$OS_NAME" == "linux" ] && [ "$OS_ARCH" == "arm64" ]; then OS_ARCH="aarch64"; fi
|
36 |
-
|
37 |
-
# config
|
38 |
-
export MAMBA_ROOT_PREFIX="$(pwd)/installer_files/mamba"
|
39 |
-
INSTALL_ENV_DIR="$(pwd)/installer_files/env"
|
40 |
-
LEGACY_INSTALL_ENV_DIR="$(pwd)/installer"
|
41 |
-
MICROMAMBA_DOWNLOAD_URL="https://micro.mamba.pm/api/micromamba/${OS_NAME}-${OS_ARCH}/latest"
|
42 |
-
umamba_exists="F"
|
43 |
-
|
44 |
-
# figure out whether git and conda needs to be installed
|
45 |
-
if [ -e "$INSTALL_ENV_DIR" ]; then export PATH="$INSTALL_ENV_DIR/bin:$PATH"; fi
|
46 |
-
|
47 |
-
PACKAGES_TO_INSTALL=""
|
48 |
-
|
49 |
-
if [ ! -e "$LEGACY_INSTALL_ENV_DIR/etc/profile.d/conda.sh" ] && [ ! -e "$INSTALL_ENV_DIR/etc/profile.d/conda.sh" ]; then PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL conda python=3.8.5"; fi
|
50 |
-
if ! hash "git" &>/dev/null; then PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL git"; fi
|
51 |
-
|
52 |
-
if "$MAMBA_ROOT_PREFIX/micromamba" --version &>/dev/null; then umamba_exists="T"; fi
|
53 |
-
|
54 |
-
# (if necessary) install git and conda into a contained environment
|
55 |
-
if [ "$PACKAGES_TO_INSTALL" != "" ]; then
|
56 |
-
# download micromamba
|
57 |
-
if [ "$umamba_exists" == "F" ]; then
|
58 |
-
echo "Downloading micromamba from $MICROMAMBA_DOWNLOAD_URL to $MAMBA_ROOT_PREFIX/micromamba"
|
59 |
-
|
60 |
-
mkdir -p "$MAMBA_ROOT_PREFIX"
|
61 |
-
curl -L "$MICROMAMBA_DOWNLOAD_URL" | tar -xvj -O bin/micromamba > "$MAMBA_ROOT_PREFIX/micromamba"
|
62 |
-
|
63 |
-
if [ "$?" != "0" ]; then
|
64 |
-
echo
|
65 |
-
echo "EE micromamba download failed"
|
66 |
-
echo "EE If the lines above contain 'bzip2: Cannot exec', your system doesn't have bzip2 installed"
|
67 |
-
echo "EE If there are network errors, please check your internet setup"
|
68 |
-
fail "micromamba download failed"
|
69 |
-
fi
|
70 |
-
|
71 |
-
chmod u+x "$MAMBA_ROOT_PREFIX/micromamba"
|
72 |
-
|
73 |
-
# test the mamba binary
|
74 |
-
echo "Micromamba version:"
|
75 |
-
"$MAMBA_ROOT_PREFIX/micromamba" --version
|
76 |
-
fi
|
77 |
-
|
78 |
-
# create the installer env
|
79 |
-
if [ ! -e "$INSTALL_ENV_DIR" ]; then
|
80 |
-
"$MAMBA_ROOT_PREFIX/micromamba" create -y --prefix "$INSTALL_ENV_DIR" || fail "unable to create the install environment"
|
81 |
-
fi
|
82 |
-
|
83 |
-
if [ ! -e "$INSTALL_ENV_DIR" ]; then
|
84 |
-
fail "There was a problem while installing$PACKAGES_TO_INSTALL using micromamba. Cannot continue."
|
85 |
-
fi
|
86 |
-
|
87 |
-
echo "Packages to install:$PACKAGES_TO_INSTALL"
|
88 |
-
|
89 |
-
"$MAMBA_ROOT_PREFIX/micromamba" install -y --prefix "$INSTALL_ENV_DIR" -c conda-forge $PACKAGES_TO_INSTALL
|
90 |
-
if [ "$?" != "0" ]; then
|
91 |
-
fail "Installation of the packages '$PACKAGES_TO_INSTALL' failed."
|
92 |
-
fi
|
93 |
-
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scripts/functions.sh
DELETED
@@ -1,39 +0,0 @@
|
|
1 |
-
#
|
2 |
-
# utility functions for all scripts
|
3 |
-
#
|
4 |
-
|
5 |
-
fail() {
|
6 |
-
echo
|
7 |
-
echo "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"
|
8 |
-
echo
|
9 |
-
if [ "$1" != "" ]; then
|
10 |
-
echo ERROR: $1
|
11 |
-
else
|
12 |
-
echo An error occurred.
|
13 |
-
fi
|
14 |
-
cat <<EOF
|
15 |
-
|
16 |
-
Error downloading Stable Diffusion UI. Sorry about that, please try to:
|
17 |
-
1. Run this installer again.
|
18 |
-
2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting
|
19 |
-
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
|
20 |
-
4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues
|
21 |
-
|
22 |
-
Thanks!
|
23 |
-
|
24 |
-
|
25 |
-
EOF
|
26 |
-
read -p "Press any key to continue"
|
27 |
-
exit 1
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
-
filesize() {
|
32 |
-
case "$(uname -s)" in
|
33 |
-
Linux*) stat -c "%s" $1;;
|
34 |
-
Darwin*) stat -f "%z" $1;;
|
35 |
-
*) echo "Unknown OS: $OS_NAME! This script runs only on Linux or Mac" && exit
|
36 |
-
esac
|
37 |
-
}
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scripts/install_status.txt
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
|
|
|
|
scripts/on_env_start.sh
DELETED
@@ -1,45 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
|
3 |
-
source ./scripts/functions.sh
|
4 |
-
|
5 |
-
printf "\n\nEasy Diffusion\n\n"
|
6 |
-
|
7 |
-
if [ -f "scripts/config.sh" ]; then
|
8 |
-
source scripts/config.sh
|
9 |
-
fi
|
10 |
-
|
11 |
-
if [ "$update_branch" == "" ]; then
|
12 |
-
export update_branch="main"
|
13 |
-
fi
|
14 |
-
|
15 |
-
if [ -f "scripts/install_status.txt" ] && [ `grep -c sd_ui_git_cloned scripts/install_status.txt` -gt "0" ]; then
|
16 |
-
echo "Easy Diffusion's git repository was already installed. Updating from $update_branch.."
|
17 |
-
|
18 |
-
cd sd-ui-files
|
19 |
-
|
20 |
-
git reset --hard
|
21 |
-
git -c advice.detachedHead=false checkout "$update_branch"
|
22 |
-
git pull
|
23 |
-
|
24 |
-
cd ..
|
25 |
-
else
|
26 |
-
printf "\n\nDownloading Easy Diffusion..\n\n"
|
27 |
-
printf "Using the $update_branch channel\n\n"
|
28 |
-
|
29 |
-
if git clone -b "$update_branch" https://github.com/cmdr2/stable-diffusion-ui.git sd-ui-files ; then
|
30 |
-
echo sd_ui_git_cloned >> scripts/install_status.txt
|
31 |
-
else
|
32 |
-
fail "git clone failed"
|
33 |
-
fi
|
34 |
-
fi
|
35 |
-
|
36 |
-
rm -rf ui
|
37 |
-
cp -Rf sd-ui-files/ui .
|
38 |
-
cp sd-ui-files/scripts/on_sd_start.sh scripts/
|
39 |
-
cp sd-ui-files/scripts/bootstrap.sh scripts/
|
40 |
-
cp sd-ui-files/scripts/check_modules.py scripts/
|
41 |
-
cp sd-ui-files/scripts/start.sh .
|
42 |
-
cp sd-ui-files/scripts/developer_console.sh .
|
43 |
-
cp sd-ui-files/scripts/functions.sh scripts/
|
44 |
-
|
45 |
-
exec ./scripts/on_sd_start.sh
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|