Skip to content

Commit

Permalink
chore: update powershell script
Browse files Browse the repository at this point in the history
  • Loading branch information
lincolnthalles committed Oct 13, 2023
1 parent c6b0877 commit 2ae12de
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion git.io.ps1
Expand Up @@ -120,7 +120,9 @@ if ($null -eq $?) {
Exit 1
}

Unblock-File -Path $GoBrewDownloadPath -ErrorAction SilentlyContinue
if ($IsWindows) {
Unblock-File -Path $GoBrewDownloadPath -ErrorAction SilentlyContinue
}

if (![IO.File]::Exists($GoBrewDownloadPath)) {
Write-Host "Failed to download gobrew to: $GoBrewBinPath" -f Red
Expand Down Expand Up @@ -150,6 +152,27 @@ else {
}
}

if (!$IsWindows) {
Write-Host "Setting executable permissions for: $GoBrewBinPath" -f Cyan
Set-ItemProperty -Path $GoBrewBinPath -Name IsReadOnly -Value $false -ErrorAction SilentlyContinue
&chmod +x $GoBrewBinPath

Write-Host "For a better experience, you should set the following environment variables in your shell profile:" -f Yellow
foreach ($key in $AddEnvVars.Keys) {
$value = $AddEnvVars[$key]
Write-Host "$key=$value" -f Yellow
Set-Item "Env:$key" -Value $value
}

Write-Host "You should add the following paths to your PATH:" -f Yellow
foreach ($path in $AddUserPaths) {
Write-Host "$path" -f Yellow
}

$env:PATH += ";$HOME/go/bin;$HOME/.gobrew/bin;$HOME/.gobrew/current/bin"
Exit 0
}

# Add paths to user PATH
$UserEnvVars = [Environment]::GetEnvironmentVariables('User')
$userPath = $UserEnvVars.Path.Split(';');
Expand Down Expand Up @@ -179,3 +202,4 @@ foreach ($key in $AddEnvVars.Keys) {
}
Set-Item "Env:$key" -Value $value
}
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/lincolnthalles/gobrew/powershell-install-script/git.io.ps1'))

0 comments on commit 2ae12de

Please sign in to comment.