From ab6c7e20826498523b460a165bd631747a6eefba Mon Sep 17 00:00:00 2001 From: JSTayco Date: Sat, 1 Apr 2023 09:59:35 -0700 Subject: [PATCH] Fixed git cloning for new directories. --- setup.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup.sh b/setup.sh index b516e78..b07976e 100755 --- a/setup.sh +++ b/setup.sh @@ -149,6 +149,11 @@ Script directory is ${SCRIPT_DIR}." >&5 PARENT_DIR="$(dirname "${DIR}")" VENV_DIR="$DIR/venv" +if [ -w "$PARENT_DIR" ] && [ ! -d "$DIR" ]; then + echo "Creating install folder ${DIR}." + mkdir "$DIR" +fi + if [ ! -w "$DIR" ]; then echo "We cannot write to ${DIR}." echo "Please ensure the install directory is accurate and you have the correct permissions." @@ -339,8 +344,8 @@ update_kohya_ss() { echo "Attempting to clone $GIT_REPO." if [ ! -d "$DIR/.git" ]; then - echo "Cloning and switching to $GIT_REPO:$BRANCH" >*4 - git -C "$DIR" clone -b "$BRANCH" "$GIT_REPO" "$(basename "$DIR")" >&3 + echo "Cloning and switching to $GIT_REPO:$BRANCH" >&4 + git -C "$PARENT_DIR" clone -b "$BRANCH" "$GIT_REPO" "$(basename "$DIR")" >&3 git -C "$DIR" switch "$BRANCH" >&4 else echo "git repo detected. Attempting to update repository instead."