Removed -v test as older versions of bash don't support that option

Made script compatible with very old version of bash, added some guards for library linking, and removed redundant library linking.
This commit is contained in:
JSTayco 2023-04-01 08:52:45 -07:00
parent b2e7d5f419
commit aed9f937da

View File

@ -33,10 +33,10 @@ 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
if [[ -n "${!1}" ]]; then
return 0
else
return 1
fi
}
@ -416,17 +416,6 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
}
check_storage_space
# This is the pre-install work for a kohya installation on a runpod
if [ "$RUNPOD" = true ]; then
if [ -d "$VENV_DIR" ]; then
echo "Pre-existing installation on a runpod detected."
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$VENV_DIR"/lib/python3.10/site-packages/tensorrt/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$VENV_DIR"/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/
cd "$DIR" || exit 1
fi
fi
update_kohya_ss
distro=get_distro_name
@ -506,8 +495,17 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
create_symlinks "$libnvinfer_symlink" "$libnvinfer_target"
create_symlinks "$libcudart_symlink" "$libcudart_target"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VENV_DIR/lib/python3.10/site-packages/tensorrt/"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$VENV_DIR/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/"
if [ -d "${VENV_DIR}/lib/python3.10/site-packages/tensorrt/" ]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VENV_DIR}/lib/python3.10/site-packages/tensorrt/"
else
echo "${VENV_DIR}/lib/python3.10/site-packages/tensorrt/ not found; not linking library."
fi
if [ -d "${VENV_DIR}/lib/python3.10/site-packages/tensorrt/" ]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VENV_DIR}/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/"
else
echo "${VENV_DIR}/lib/python3.10/site-packages/nvidia/cuda_runtime/lib/ not found; not linking library."
fi
configure_accelerate