Download install_windows.ps1 from KLP2-PCD/KLP2: direct link, hf CLI and curl.
- Browser
- Download file 2.23 kB
-
https://huggingface.co/spaces/KLP2-PCD/KLP2/resolve/main/install_windows.ps1
- Command line
-
hf download hf://spaces/KLP2-PCD/KLP2/install_windows.ps1
-
curl -L -o install_windows.ps1 https://huggingface.co/spaces/KLP2-PCD/KLP2/resolve/main/install_windows.ps1
2.23 kB
| param( | |
| [string]$RepoId = "KLP2-PCD/KLP2", | |
| [string]$TargetDir = "", | |
| [switch]$SkipApps, | |
| [switch]$SkipContributorSetup | |
| ) | |
| $ErrorActionPreference = "Stop" | |
| function Write-Step { | |
| param([string]$Message) | |
| Write-Host "" | |
| Write-Host "==> $Message" -ForegroundColor Cyan | |
| } | |
| function Has-Command { | |
| param([string]$Name) | |
| return [bool](Get-Command $Name -ErrorAction SilentlyContinue) | |
| } | |
| function Install-WithWinget { | |
| param( | |
| [string]$PackageId, | |
| [string]$Name | |
| ) | |
| Write-Step "Install/cek $Name" | |
| winget install --id $PackageId --exact --accept-source-agreements --accept-package-agreements --silent | |
| } | |
| Write-Step "Bootstrap installer Windows" | |
| if (-not (Has-Command "winget")) { | |
| throw "winget tidak ditemukan. Install 'App Installer' dari Microsoft Store, lalu jalankan script ini lagi." | |
| } | |
| if (-not $SkipApps) { | |
| if (-not (Has-Command "git")) { | |
| Install-WithWinget -PackageId "Git.Git" -Name "Git for Windows" | |
| } else { | |
| Write-Host "Git sudah tersedia: $(& git --version)" | |
| } | |
| if (-not (Has-Command "python")) { | |
| Install-WithWinget -PackageId "Python.Python.3.10" -Name "Python 3.10" | |
| } else { | |
| Write-Host "Python sudah tersedia: $(& python --version)" | |
| } | |
| if (-not (Has-Command "code")) { | |
| Install-WithWinget -PackageId "Microsoft.VisualStudioCode" -Name "Visual Studio Code" | |
| } else { | |
| Write-Host "VS Code sudah tersedia." | |
| } | |
| } else { | |
| Write-Host "Skip install aplikasi karena parameter -SkipApps dipakai." | |
| } | |
| Write-Step "Refresh PATH untuk sesi PowerShell ini" | |
| $machinePath = [Environment]::GetEnvironmentVariable("Path", "Machine") | |
| $userPath = [Environment]::GetEnvironmentVariable("Path", "User") | |
| $env:Path = "$machinePath;$userPath" | |
| if ($SkipContributorSetup) { | |
| Write-Host "Bootstrap selesai. setup_contributor.ps1 tidak dijalankan karena -SkipContributorSetup dipakai." | |
| exit 0 | |
| } | |
| $setupScript = Join-Path $PSScriptRoot "setup_contributor.ps1" | |
| if (-not (Test-Path $setupScript)) { | |
| throw "setup_contributor.ps1 tidak ditemukan di folder yang sama dengan install_windows.ps1." | |
| } | |
| Write-Step "Jalankan setup kontributor project" | |
| & $setupScript -RepoId $RepoId -TargetDir $TargetDir | |