forked from bmaltais/kohya_ss
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gui.sh
executable file
·22 lines (17 loc) · 958 Bytes
/
gui.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
# If it is run with the sudo command, get the complete LD_LIBRARY_PATH environment variable of the system and assign it to the current environment,
# because it will be used later.
if [ -n "$SUDO_USER" ] || [ -n "$SUDO_COMMAND" ] ; then
echo "The sudo command resets the non-essential environment variables, we keep the LD_LIBRARY_PATH variable."
export LD_LIBRARY_PATH=$(sudo -i printenv LD_LIBRARY_PATH)
fi
# This gets the directory the script is run from so pathing can work relative to the script where needed.
SCRIPT_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
# Step into GUI local directory
cd "$SCRIPT_DIR"
# Activate the virtual environment
source "$SCRIPT_DIR/venv/bin/activate"
# If the requirements are validated, run the kohya_gui.py script with the command-line arguments
if python "$SCRIPT_DIR"/tools/validate_requirements.py -r "$SCRIPT_DIR"/requirements.txt; then
python "$SCRIPT_DIR/kohya_gui.py" "$@"
fi