Delete scripts/setup-mac15.ps1 with huggingface_hub
Browse files- scripts/setup-mac15.ps1 +0 -84
scripts/setup-mac15.ps1
DELETED
|
@@ -1,84 +0,0 @@
|
|
| 1 |
-
# =============================================================================
|
| 2 |
-
# setup.mac15.ps1
|
| 3 |
-
# One-command clone + automatic download of mac15 files into mac15-image/
|
| 4 |
-
# =============================================================================
|
| 5 |
-
|
| 6 |
-
$ErrorActionPreference = 'Stop' # Exit immediately if any command fails
|
| 7 |
-
|
| 8 |
-
$GithubRepo = "https://github.com/nullvoider07/mac15-base"
|
| 9 |
-
$RepoName = Split-Path $GithubRepo -Leaf
|
| 10 |
-
|
| 11 |
-
Write-Host "π Cloning GitHub repo: $GithubRepo"
|
| 12 |
-
|
| 13 |
-
# ----------------------------- Clone with GitHub CLI -----------------------
|
| 14 |
-
Write-Host "π§ Checking GitHub CLI..."
|
| 15 |
-
|
| 16 |
-
if (-not (Get-Command gh -ErrorAction SilentlyContinue)) {
|
| 17 |
-
Write-Host " GitHub CLI not found. Installing via winget..."
|
| 18 |
-
|
| 19 |
-
# Install gh silently, accepting agreements automatically
|
| 20 |
-
winget install --id GitHub.cli --exact --accept-source-agreements --accept-package-agreements
|
| 21 |
-
|
| 22 |
-
# Refresh the PATH variables in the current session so 'gh' is recognized immediately
|
| 23 |
-
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
| 24 |
-
|
| 25 |
-
# Verify installation succeeded
|
| 26 |
-
if (-not (Get-Command gh -ErrorAction SilentlyContinue)) {
|
| 27 |
-
throw "β Failed to install GitHub CLI automatically. Please install it manually from https://cli.github.com"
|
| 28 |
-
}
|
| 29 |
-
Write-Host " β
GitHub CLI installed successfully."
|
| 30 |
-
} else {
|
| 31 |
-
Write-Host " β
GitHub CLI already available."
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
gh repo clone $GithubRepo $RepoName -- --depth=1
|
| 35 |
-
|
| 36 |
-
# ----------------------------- Create folder -------------------------------
|
| 37 |
-
Write-Host "π Creating folder: mac15-image/"
|
| 38 |
-
$ImagePath = Join-Path $RepoName "mac15-image"
|
| 39 |
-
New-Item -ItemType Directory -Force -Path $ImagePath | Out-Null
|
| 40 |
-
|
| 41 |
-
# ----------------------------- Ensure uv is available ---------------------
|
| 42 |
-
Write-Host "π§ Checking uv..."
|
| 43 |
-
|
| 44 |
-
if (Get-Command uv -ErrorAction SilentlyContinue) {
|
| 45 |
-
Write-Host " β
uv already available β skipping installation."
|
| 46 |
-
} else {
|
| 47 |
-
Write-Host " Installing uv package manager..."
|
| 48 |
-
Invoke-RestMethod -Uri https://astral.sh/uv/install.ps1 | Invoke-Expression
|
| 49 |
-
$env:Path += ";$HOME\.cargo\bin;$HOME\.local\bin"
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
# ----------------------------- Ephemeral venv for hf -----------------------
|
| 53 |
-
Write-Host "π§ Creating ephemeral venv for hf..."
|
| 54 |
-
|
| 55 |
-
$TempDir = [System.IO.Path]::GetTempPath()
|
| 56 |
-
$HfVenv = Join-Path $TempDir "hf-venv-$(New-Guid)"
|
| 57 |
-
|
| 58 |
-
# uv venv picks the correct current Python automatically
|
| 59 |
-
uv venv $HfVenv --quiet
|
| 60 |
-
|
| 61 |
-
# Install huggingface_hub (lighter than transformers) directly into the venv
|
| 62 |
-
uv pip install --python "$HfVenv\Scripts\python.exe" huggingface_hub --quiet
|
| 63 |
-
|
| 64 |
-
Write-Host " β
hf installed in ephemeral venv."
|
| 65 |
-
|
| 66 |
-
# ----------------------------- Download Files ------------------------------
|
| 67 |
-
Write-Host "π₯ Downloading base.dmg and mac15.qcow2 (large files) into $RepoName\mac15-image\ ..."
|
| 68 |
-
Write-Host " (This may take a while β progress bar will show)"
|
| 69 |
-
|
| 70 |
-
# Call the 'hf' command directly by its venv path for both files
|
| 71 |
-
& "$HfVenv\Scripts\hf.exe" download NullVoider/mac15-base base.dmg --local-dir $ImagePath
|
| 72 |
-
& "$HfVenv\Scripts\hf.exe" download NullVoider/mac15-base mac15.qcow2 --local-dir $ImagePath
|
| 73 |
-
|
| 74 |
-
# ----------------------------- Cleanup venv --------------------------------
|
| 75 |
-
Write-Host "π§Ή Cleaning up ephemeral venv..."
|
| 76 |
-
Remove-Item -Recurse -Force $HfVenv
|
| 77 |
-
|
| 78 |
-
# ----------------------------- Final message -------------------------------
|
| 79 |
-
Write-Host ""
|
| 80 |
-
Write-Host "β
SUCCESS!" -ForegroundColor Green
|
| 81 |
-
Write-Host " Repository cloned β $RepoName\"
|
| 82 |
-
Write-Host " Images ready at: $RepoName\mac15-image\"
|
| 83 |
-
Write-Host ""
|
| 84 |
-
Write-Host " Next time just run: cd $RepoName ; git pull"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|