Default install location is now environment-based
Better default install locations and updated the README to reflect.
This commit is contained in:
parent
dfe96a581d
commit
bff107878b
@ -11,6 +11,7 @@ If you run on Linux and would like to use the GUI, there is now a port of it as
|
|||||||
- [Linux/macOS](#linux-and-macos-dependencies)
|
- [Linux/macOS](#linux-and-macos-dependencies)
|
||||||
- [Installation](#installation)
|
- [Installation](#installation)
|
||||||
- [Linux/macOS](#linux-and-macos)
|
- [Linux/macOS](#linux-and-macos)
|
||||||
|
- [Default Install Locations](#install-location)
|
||||||
- [Windows](#windows)
|
- [Windows](#windows)
|
||||||
- [CUDNN 8.6](#optional--cudnn-86)
|
- [CUDNN 8.6](#optional--cudnn-86)
|
||||||
- [Upgrading](#upgrading)
|
- [Upgrading](#upgrading)
|
||||||
@ -90,6 +91,13 @@ Options:
|
|||||||
-h, --help Show this screen.
|
-h, --help Show this screen.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Install location
|
||||||
|
|
||||||
|
The default install location for Linux is `/opt/kohya_ss`. If /opt is not writeable, the fallback is `$HOME/kohya_ss`. Lastly, if all else fails it will simply install to the current folder you are in.
|
||||||
|
|
||||||
|
On macOS and other non-Linux machines, it will default install to `$HOME/kohya_ss` followed by where you're currently at if there's no access to $HOME.
|
||||||
|
You can override this behavior by specifying an install directory with the -d option.
|
||||||
|
|
||||||
If you are using the interactive mode, our default values for the accelerate config screen after running the script answer "This machine", "None", "No" for the remaining questions.
|
If you are using the interactive mode, our default values for the accelerate config screen after running the script answer "This machine", "None", "No" for the remaining questions.
|
||||||
These are the same answers as the Windows install.
|
These are the same answers as the Windows install.
|
||||||
|
|
||||||
|
54
setup.sh
54
setup.sh
@ -24,15 +24,50 @@ Options:
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Checks to see if variable is set and non-empty.
|
||||||
|
# This is defined first, so we can use the function for some default variable values
|
||||||
|
env_var_exists() {
|
||||||
|
if [[ ! -v "$1" ]] || [[ -z "$1" ]]; then
|
||||||
|
return 1
|
||||||
|
else
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Need RUNPOD to have a default value before first access
|
||||||
|
RUNPOD=false
|
||||||
|
if env_var_exists RUNPOD_POD_ID || env_var_exists RUNPOD_API_KEY; then
|
||||||
|
RUNPOD=true
|
||||||
|
fi
|
||||||
|
|
||||||
# Variables defined before the getopts loop, so we have sane default values.
|
# Variables defined before the getopts loop, so we have sane default values.
|
||||||
DIR="/workspace/kohya_ss"
|
# Default installation locations based on OS and environment
|
||||||
|
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||||
|
if [ "$RUNPOD" = true ]; then
|
||||||
|
DIR="/workspace/kohya_ss"
|
||||||
|
elif [ -w "/opt" ]; then
|
||||||
|
DIR="/opt/kohya_ss"
|
||||||
|
elif env_var_exists HOME; then
|
||||||
|
DIR="$HOME/kohya_ss"
|
||||||
|
else
|
||||||
|
# The last fallback is simply PWD
|
||||||
|
DIR="$(PWD)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if env_var_exists HOME; then
|
||||||
|
DIR="$HOME/kohya_ss"
|
||||||
|
else
|
||||||
|
# The last fallback is simply PWD
|
||||||
|
DIR="$(PWD)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
BRANCH="master"
|
BRANCH="master"
|
||||||
GIT_REPO="https://github.com/bmaltais/kohya_ss.git"
|
GIT_REPO="https://github.com/bmaltais/kohya_ss.git"
|
||||||
RUNPOD=false
|
|
||||||
INTERACTIVE=false
|
INTERACTIVE=false
|
||||||
PUBLIC=false
|
PUBLIC=false
|
||||||
|
|
||||||
while getopts "b:d:g:ir-:" opt; do
|
while getopts "b:d:g:ipr-:" opt; do
|
||||||
# support long options: https://stackoverflow.com/a/28466267/519360
|
# support long options: https://stackoverflow.com/a/28466267/519360
|
||||||
if [ "$opt" = "-" ]; then # long option: reformulate OPT and OPTARG
|
if [ "$opt" = "-" ]; then # long option: reformulate OPT and OPTARG
|
||||||
opt="${OPTARG%%=*}" # extract long option name
|
opt="${OPTARG%%=*}" # extract long option name
|
||||||
@ -67,15 +102,6 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|||||||
root=true
|
root=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Checks to see if variable is set and non-empty.
|
|
||||||
env_var_exists() {
|
|
||||||
if [[ ! -v "$1" ]] || [[ -z "$1" ]]; then
|
|
||||||
return 1
|
|
||||||
else
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
get_distro_name() {
|
get_distro_name() {
|
||||||
local line
|
local line
|
||||||
if [ -f /etc/os-release ]; then
|
if [ -f /etc/os-release ]; then
|
||||||
@ -142,10 +168,6 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
|||||||
echo "$FREESPACEINGB"
|
echo "$FREESPACEINGB"
|
||||||
}
|
}
|
||||||
|
|
||||||
if env_var_exists RUNPOD_POD_ID || env_var_exists RUNPOD_API_KEY; then
|
|
||||||
RUNPOD=true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Offer a warning and opportunity to cancel the installation if < 10Gb of Free Space detected
|
# Offer a warning and opportunity to cancel the installation if < 10Gb of Free Space detected
|
||||||
if [ "$(size_available)" -lt 10 ]; then
|
if [ "$(size_available)" -lt 10 ]; then
|
||||||
echo "You have less than 10Gb of free space. This installation may fail."
|
echo "You have less than 10Gb of free space. This installation may fail."
|
||||||
|
Loading…
Reference in New Issue
Block a user