-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.ps1
More file actions
29 lines (23 loc) · 984 Bytes
/
install.ps1
File metadata and controls
29 lines (23 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
$ErrorActionPreference = "Stop"
$Repo = "Quackster/KeplerC"
$Asset = "Kepler-windows.zip"
$InstallDir = "$HOME\KeplerC"
$TempZip = "$env:TEMP\$Asset"
Write-Host "Fetching latest release..."
$Release = Invoke-RestMethod "https://api.github.com/repos/$Repo/releases/latest"
$Url = ($Release.assets | Where-Object { $_.name -eq $Asset }).browser_download_url
if (-not $Url) {
Write-Error "Failed to find download URL for $Asset"
exit 1
}
Write-Host "Downloading $Asset..."
Invoke-WebRequest -Uri $Url -OutFile $TempZip
Write-Host "Extracting to $InstallDir..."
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
Expand-Archive -Path $TempZip -DestinationPath $InstallDir -Force
Get-ChildItem "$InstallDir\Kepler\*" | Move-Item -Destination $InstallDir -Force
Remove-Item "$InstallDir\Kepler" -Recurse -ErrorAction SilentlyContinue
Remove-Item $TempZip
Write-Host ""
Write-Host "Installed to $InstallDir"
Write-Host "Run it with: cd $InstallDir; .\Kepler.exe"