diff --git a/install.bat b/install.bat index 475a1a0..9fa39ef 100644 --- a/install.bat +++ b/install.bat @@ -21,6 +21,40 @@ if exist "..\..\venv\" ( REM Install dependencies from the requirements.txt file pip install -r requirements.txt + REM Check if git is installed + where /q git + if %ERRORLEVEL% equ 0 ( + echo Git is installed. + + REM Check if the current directory is a git repository + if not exist ".git" ( + echo This directory is not a git repository. Initializing a new repository. + git init + git remote add origin https://github.com/Nourepide/ComfyUI-Allor + git pull origin master + ) else ( + echo This directory is already a git repository. + ) + ) else ( + echo Git is not installed. Using GitPython instead. + + REM Run a Python script that uses GitPython to do the same thing + python -c " +import git +from pathlib import Path + +# Check if the current directory is a git repository +if not (Path('.git').exists() or Path('.git').is_dir()): + print('This directory is not a git repository. Initializing a new repository.') + repo = git.Repo.init() + origin = repo.create_remote('origin', 'https://github.com/Nourepide/ComfyUI-Allor') + origin.fetch() + origin.pull(origin.refs[0].remote_head) +else: + print('This directory is already a git repository.') +" + ) + REM Deactivate the virtual environment deactivate ) else ( diff --git a/install.sh b/install.sh index 18a08f7..6f29e9e 100644 --- a/install.sh +++ b/install.sh @@ -21,6 +21,39 @@ if [ -d "../../venv" ]; then # Install dependencies from the requirements.txt file pip install -r requirements.txt + # Check if git is installed + if command -v git >/dev/null 2>&1; then + echo "Git is installed." + + # Check if the current directory is a git repository + if [ ! -d ".git" ]; then + echo "This directory is not a git repository. Initializing a new repository." + git init + git remote add origin https://github.com/Nourepide/ComfyUI-Allor + git pull origin master + else + echo "This directory is already a git repository." + fi + else + echo "Git is not installed. Using GitPython instead." + + # Run a Python script that uses GitPython to do the same thing + python -c " +import git +from pathlib import Path + +# Check if the current directory is a git repository +if not (Path('.git').exists() or Path('.git').is_dir()): + print('This directory is not a git repository. Initializing a new repository.') + repo = git.Repo.init() + origin = repo.create_remote('origin', 'https://github.com/Nourepide/ComfyUI-Allor') + origin.fetch() + origin.pull(origin.refs[0].remote_head) +else: + print('This directory is already a git repository.') +" + fi + # Deactivate the virtual environment deactivate else