-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from inkadnb/windows_install_scripts
Windows install scripts
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@echo off | ||
pushd %USERPROFILE%\.cypher\dist & dotnet TGMNode.dll %* & popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Create a temporary folder to download to. | ||
$tempFolder = Join-Path $env:TEMP "cypher" | ||
New-Item $tempFolder -ItemType Directory -Force | ||
|
||
# Get the latest release | ||
$latestRelease = Invoke-WebRequest "https://api.github.com/repos/cypher-network/cypher/releases/latest" | | ||
ConvertFrom-Json | | ||
Select-Object tag_name | ||
$tag_name = $latestRelease.tag_name | ||
|
||
# Download the zip | ||
Write-Host "Downloading latest version ($tag_name)" | ||
$client = New-Object "System.Net.WebClient" | ||
$url = "https://github.com/cypher-network/cypher/releases/download/$tag_name/cypher.$tag_name.zip" | ||
$zipFile = Join-Path $tempFolder "cypher.zip" | ||
$client.DownloadFile($url,$zipFile) | ||
|
||
$installationFolder = Join-Path $env:USERPROFILE ".cypher" | ||
Microsoft.PowerShell.Archive\Expand-Archive $zipFile -DestinationPath $installationFolder -Force | ||
Remove-Item $tempFolder -Recurse -Force | ||
|
||
$binFolder = Join-Path $installationFolder "bin" | ||
$runner = Join-Path $installationFolder "dist\Runners" | ||
$runner = Join-Path $runner "cypnode.cmd" | ||
|
||
If (!(Test-Path $binFolder)) | ||
{ | ||
New-Item -Path $binFolder -ItemType "directory" | ||
} | ||
Copy-Item $runner -Destination $binFolder -Force | ||
|
||
$path = [System.Environment]::GetEnvironmentVariable("path", [System.EnvironmentVariableTarget]::User); | ||
$paths = $path.Split(";") -inotlike $binFolder | ||
# Add the bin folder to the path | ||
$paths += $binFolder | ||
# Create the new path string | ||
$path = $paths -join ";" | ||
|
||
[System.Environment]::SetEnvironmentVariable("path", $path, [System.EnvironmentVariableTarget]::User) | ||
Write-Host "cypher was installed successfully!" |