# ============================================================================ # UmeAiRT ComfyUI -- Remote One-Liner Installer (PowerShell) # # Usage: # irm https://get.umeai.art/comfyui.ps1 | iex # # This script downloads the installer and delegates to Install.bat. # Sources: GitLab (git) -> HuggingFace (ZIP) -> ModelScope (ZIP) # ============================================================================ $ErrorActionPreference = "Stop" Write-Host "" Write-Host "============================================================================" -ForegroundColor Cyan Write-Host " UmeAiRT ComfyUI -- Auto-Installer" -ForegroundColor Cyan Write-Host "============================================================================" -ForegroundColor Cyan Write-Host "" # --- Config --- $InstallerDir = Join-Path $env:TEMP "ComfyUI-Auto_installer" $RepoUrl = "https://gitlab.com/UmeAiRT-Studio/ComfyUI-Auto_installer-Python.git" $CB_RepoUrl = "https://codeberg.org/UmeAiRT/ComfyUI-Auto_installer-Python.git" $Branch = "main" $HF_ZIP = "https://huggingface.co/UmeAiRT/ComfyUI-Auto-Installer-Assets/resolve/main/releases/ComfyUI-Auto_installer-latest.zip" $MS_ZIP = "https://www.modelscope.ai/datasets/UmeAiRT/ComfyUI-Auto-Installer-Assets/resolve/master/releases/ComfyUI-Auto_installer-latest.zip" $downloaded = $false # --- Source 1: GitLab Git (preferred) --- if (Get-Command git -ErrorAction SilentlyContinue) { Write-Host "[INFO] Downloading installer (Git)..." -ForegroundColor Cyan if (Test-Path $InstallerDir) { Remove-Item -Recurse -Force $InstallerDir } try { git clone --depth 1 -b $Branch $RepoUrl $InstallerDir --quiet 2>&1 | Out-Null } catch { $null } if ($LASTEXITCODE -eq 0) { $downloaded = $true } } # --- Source 1b: Codeberg Git fallback --- if (-not $downloaded -and (Get-Command git -ErrorAction SilentlyContinue)) { Write-Host "[INFO] GitLab unavailable. Trying Codeberg..." -ForegroundColor Yellow if (Test-Path $InstallerDir) { Remove-Item -Recurse -Force $InstallerDir } try { git clone --depth 1 -b $Branch $CB_RepoUrl $InstallerDir --quiet 2>&1 | Out-Null } catch { $null } if ($LASTEXITCODE -eq 0) { $downloaded = $true } } # --- Source 2: HuggingFace ZIP fallback --- if (-not $downloaded) { Write-Host "[INFO] Git unavailable or failed. Trying HuggingFace..." -ForegroundColor Yellow try { $zipPath = Join-Path $env:TEMP "ComfyUI-Auto_installer.zip" if (Test-Path $InstallerDir) { Remove-Item -Recurse -Force $InstallerDir } Invoke-WebRequest -Uri $HF_ZIP -OutFile $zipPath -UseBasicParsing # SHA-256 verification (non-blocking if checksum file unavailable) $hashOk = $true try { $hashUrl = "$HF_ZIP.sha256" $expectedHash = (Invoke-WebRequest -Uri $hashUrl -UseBasicParsing).Content.Trim().Split(" ")[0] $actualHash = (Get-FileHash -Path $zipPath -Algorithm SHA256).Hash if ($expectedHash.ToLower() -ne $actualHash.ToLower()) { Write-Host "[ERROR] SHA-256 mismatch! Archive may be corrupted or tampered." -ForegroundColor Red $hashOk = $false } else { Write-Host "[INFO] SHA-256 verified." -ForegroundColor Green } } catch { Write-Host "[WARN] Checksum file not available -- skipping verification." -ForegroundColor Yellow } if ($hashOk) { Expand-Archive -Path $zipPath -DestinationPath $env:TEMP -Force Remove-Item $zipPath -Force $downloaded = $true Write-Host "[INFO] Downloaded from HuggingFace." -ForegroundColor Green } else { Remove-Item $zipPath -Force -ErrorAction SilentlyContinue } } catch { Write-Host "[WARN] HuggingFace download failed." -ForegroundColor Yellow } } # --- Source 3: ModelScope ZIP fallback --- if (-not $downloaded) { Write-Host "[INFO] Trying ModelScope..." -ForegroundColor Yellow try { $zipPath = Join-Path $env:TEMP "ComfyUI-Auto_installer.zip" if (Test-Path $InstallerDir) { Remove-Item -Recurse -Force $InstallerDir } Invoke-WebRequest -Uri $MS_ZIP -OutFile $zipPath -UseBasicParsing # SHA-256 verification (non-blocking if checksum file unavailable) $hashOk = $true try { $hashUrl = "$MS_ZIP.sha256" $expectedHash = (Invoke-WebRequest -Uri $hashUrl -UseBasicParsing).Content.Trim().Split(" ")[0] $actualHash = (Get-FileHash -Path $zipPath -Algorithm SHA256).Hash if ($expectedHash.ToLower() -ne $actualHash.ToLower()) { Write-Host "[ERROR] SHA-256 mismatch! Archive may be corrupted or tampered." -ForegroundColor Red $hashOk = $false } else { Write-Host "[INFO] SHA-256 verified." -ForegroundColor Green } } catch { Write-Host "[WARN] Checksum file not available -- skipping verification." -ForegroundColor Yellow } if ($hashOk) { Expand-Archive -Path $zipPath -DestinationPath $env:TEMP -Force Remove-Item $zipPath -Force $downloaded = $true Write-Host "[INFO] Downloaded from ModelScope." -ForegroundColor Green } else { Remove-Item $zipPath -Force -ErrorAction SilentlyContinue } } catch { Write-Host "[ERROR] All download sources failed." -ForegroundColor Red Write-Host " Try manually: $HF_ZIP" -ForegroundColor Yellow return } } # --- Verify integrity --- $InstallBat = Join-Path $InstallerDir "Install.bat" $PyProject = Join-Path $InstallerDir "pyproject.toml" if (-not (Test-Path $InstallBat) -or -not (Test-Path $PyProject)) { Write-Host "[ERROR] Downloaded installer appears corrupted (missing key files)." -ForegroundColor Red Remove-Item -Recurse -Force $InstallerDir -ErrorAction SilentlyContinue return } Write-Host "[INFO] Installer ready." -ForegroundColor Green Write-Host "" # --- Launch Install.bat --- Push-Location $InstallerDir & cmd /c "`"$InstallBat`"" Pop-Location