-
-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows support #2
Comments
This did the trick on msys64:
|
@msenturk interesting! thanks :D |
Maybe generating a iwr https://gobinaries.com/rakyll/hey?ps1=1 -useb | iex |
Here is an example for Windows installation. iwr https://deno.land/x/install/install.ps1 -useb | iex https://deno.land/x/[email protected]/install.ps1 I think it can be used in Golang with a little modification The user does not need to install other additional tools. |
Here is an adaptation I made for powershell taking inspiration in the Deno installation script as in @axetroy comment. #!/usr/bin/env pwsh
function Log-Info($message) {
Write-Output "`e[38;5;61m ==>`e[0;00m $message"
}
function Log-Critical($message) {
[Console]::Error.WriteLine("")
[Console]::Error.WriteLine(" `e[38;5;125m$message`e[0;00m")
[Console]::Error.WriteLine("")
}
function Get-OS() {
if ($IsWindows) {
return "windows"
} else {
Log-Critical("Operating system not supported yet")
Exit 0
}
return "unknown"
}
function Get-Architecture() {
return "$env:PROCESSOR_ARCHITECTURE".ToLower()
}
$OS = Get-OS
$Arch = Get-Architecture
# API endpoint such as "http://localhost:3000"
$API = "https://gobinaries.com"
# package such as "github.com/tj/triage/cmd/triage"
$Pkg = "github.com/rakyll/hey"
# binary name such as "hello"
$Bin ="hey"
# original_version such as "master"
$OriginalVersion="master"
# version such as "master"
$Version="v0.1.4"
$GoBinariesDir = $env:GOBINARIES_DIR
$BinDir = If ($GoBinariesDir) {
"$GoBinariesDir\bin"
} else {
"$Home\.gobinaries\bin"
}
$TempExe = "$env:TEMP\$Bin.exe"
$TargetExe = "$BinDir\$Bin.exe"
If ($OriginalVersion -ne $Version) {
Log-Info("Resolved version $OriginalVersion to $Version")
}
# GitHub requires TLS 1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Log-Info("Downloading binary for $OS $arch")
$DownloadUrl = "${API}/binary/${Pkg}?os=${OS}&arch=${Arch}&version=${Version}"
Invoke-WebRequest $DownloadUrl -OutFile $TempExe -UseBasicParsing
If (!(Test-Path $BinDir)) {
New-Item $BinDir -ItemType Directory | Out-Null
}
Copy-Item -Path $TempExe -Destination $TargetExe
If (Test-Path $TempExe) {
Remove-Item $TempExe
}
$User = [EnvironmentVariableTarget]::User
$Path = [Environment]::GetEnvironmentVariable('Path', $User)
If (!(";$Path;".ToLower() -like "*;$BinDir;*".ToLower())) {
[Environment]::SetEnvironmentVariable('Path', "$Path;$BinDir", $User)
$Env:Path += ";$BinDir"
}
Log-Info("Installation complete") |
Since this issue seems stall, I created a demo pull request (#40) with my embrionary script (above) |
I don't think it works right now, probably need to chuck an
.exe
on there at least.The text was updated successfully, but these errors were encountered: