-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
34 lines (27 loc) · 1.24 KB
/
Copy pathinstall.ps1
File metadata and controls
34 lines (27 loc) · 1.24 KB
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
30
31
32
33
34
# Overtrust Windows Installer
# Downloads latest release from GitHub
# Usage: powershell -c "irm https://raw.githubusercontent.com/cheese-cakee/overtrust/master/install.ps1 | iex"
param(
[string]$Version = "latest",
[string]$InstallDir = "$env:LOCALAPPDATA\overtrust"
)
$repo = "cheese-cakee/overtrust"
if ($Version -eq "latest") {
$url = "https://github.com/$repo/releases/latest/download/overtrust.exe"
} else {
$url = "https://github.com/$repo/releases/download/$Version/overtrust.exe"
}
Write-Host ":: Installing overtrust..." -ForegroundColor Cyan
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
$dest = "$InstallDir\overtrust.exe"
Write-Host " Downloading $url" -ForegroundColor Gray
Invoke-WebRequest -Uri $url -OutFile $dest
# Add to user PATH if not already there
$userPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -notlike "*$InstallDir*") {
[Environment]::SetEnvironmentVariable("Path", "$userPath;$InstallDir", "User")
$env:Path += ";$InstallDir"
Write-Host " Added to PATH" -ForegroundColor Green
}
Write-Host ":: Done! Run 'overtrust' from any terminal." -ForegroundColor Green
Write-Host " (Restart your terminal if the command isn't found)" -ForegroundColor Gray