| |
| |
| |
| |
|
|
| $ErrorActionPreference = 'Stop' |
|
|
| $GithubRepo = "https://github.com/nullvoider07/windows10-base" |
| $RepoName = Split-Path $GithubRepo -Leaf |
|
|
| Write-Host "π Cloning GitHub repo: $GithubRepo" |
|
|
| |
| Write-Host "π§ Checking GitHub CLI..." |
|
|
| if (-not (Get-Command gh -ErrorAction SilentlyContinue)) { |
| Write-Host " GitHub CLI not found. Installing via winget..." |
| |
| |
| winget install --id GitHub.cli --exact --accept-source-agreements --accept-package-agreements |
| |
| |
| $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") |
| |
| |
| if (-not (Get-Command gh -ErrorAction SilentlyContinue)) { |
| throw "β Failed to install GitHub CLI automatically. Please install it manually from https://cli.github.com" |
| } |
| Write-Host " β
GitHub CLI installed successfully." |
| } else { |
| Write-Host " β
GitHub CLI already available." |
| } |
|
|
| gh repo clone $GithubRepo $RepoName -- --depth=1 |
|
|
| |
| Write-Host "π Creating folder: win10-image/" |
| $ImagePath = Join-Path $RepoName "win10-image" |
| New-Item -ItemType Directory -Force -Path $ImagePath | Out-Null |
|
|
| |
| Write-Host "π§ Checking uv..." |
|
|
| if (Get-Command uv -ErrorAction SilentlyContinue) { |
| Write-Host " uv already available β skipping installation." |
| } else { |
| Write-Host " Installing uv package manager..." |
| Invoke-RestMethod -Uri https://astral.sh/uv/install.ps1 | Invoke-Expression |
| $env:Path += ";$HOME\.cargo\bin;$HOME\.local\bin" |
| } |
|
|
| |
| Write-Host "π§ Creating ephemeral venv for huggingface-cli..." |
|
|
| $TempDir = [System.IO.Path]::GetTempPath() |
| $HfVenv = Join-Path $TempDir "hf-venv-$(New-Guid)" |
|
|
| |
| uv venv $HfVenv --quiet |
|
|
| |
| uv pip install --python "$HfVenv\Scripts\python.exe" transformers --quiet |
|
|
| Write-Host " β
huggingface-hub installed in ephemeral venv." |
|
|
| |
| Write-Host "π₯ Downloading win10.qcow2 (large file) into $RepoName\win10-image\ ..." |
| Write-Host " (This may take a while β progress bar will show)" |
|
|
| |
| & "$HfVenv\Scripts\hf.exe" download NullVoider/windows10-base win10.qcow2 --local-dir $ImagePath |
|
|
| |
| Write-Host "π§Ή Cleaning up ephemeral venv..." |
| Remove-Item -Recurse -Force $HfVenv |
|
|
| |
| Write-Host "" |
| Write-Host "β
SUCCESS!" -ForegroundColor Green |
| Write-Host " Repository cloned β $RepoName\" |
| Write-Host " QCOW2 image ready at: $RepoName\win10-image\win10.qcow2" |
| Write-Host "" |
| Write-Host " Next time just run: cd $RepoName ; git pull" |