diff options
| author | TitanSnow <[email protected]> | 2017-04-22 10:12:49 +0800 |
|---|---|---|
| committer | TitanSnow <[email protected]> | 2017-04-22 10:21:31 +0800 |
| commit | 24ef8db3b6cadda0244b284f87fd934e9823e48d (patch) | |
| tree | 693d90d14b1cd72fca6d6a595bd24a40ea1fbf11 /scripts | |
| parent | 1c2132e3456d2f022024f6ee64ed19bc86d2833c (diff) | |
more note in installation
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/get.ps1 | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/scripts/get.ps1 b/scripts/get.ps1 index 539a0d7b4..aec656a69 100644 --- a/scripts/get.ps1 +++ b/scripts/get.ps1 @@ -3,10 +3,36 @@ # Invoke-Expression (Invoke-Webrequest <my location> -UseBasicParsing).Content $outfile=($env:TMP,$env:TEMP,'.' -ne $null)[0]+"\$pid-xmake-installer.exe" +try{ + Write-Output "$pid"|Out-File -FilePath "$outfile" + Remove-Item "$outfile" +}catch{ + Write-Host 'Cannot write to temp path' + Write-Host 'Please set environment var "TMP" to another path' + Exit 1 +} $ver='v2.1.3' -Invoke-Webrequest "https://github.com/tboox/xmake/releases/download/$ver/xmake-$ver.exe" -OutFile "$outfile" -Start-Process -FilePath "$outfile" -ArgumentList '/S /D=C:\xmake' -Wait +Write-Host 'Start downloading... Hope amazon S3 is not broken again' +try{ + Invoke-Webrequest "https://github.com/tboox/xmake/releases/download/$ver/xmake-$ver.exe" -OutFile "$outfile" +}catch{ + Write-Host 'Download failed!' + Write-Host 'Check your network or... the news of S3 break' + Exit 1 +} +Write-Host 'Start installation... Hope your antivirus doesn''t trouble' +$installdir=$HOME+'\xmake' +Write-Host "Install to $installdir" +try{ + Start-Process -FilePath "$outfile" -ArgumentList "/S /D=$installdir" -Wait +}catch{ + Remove-Item "$outfile" + Write-Host 'Install failed!' + Write-Host 'Close your antivirus then try again' + Exit 1 +} Remove-Item "$outfile" -$env:Path+=";C:\xmake" -[Environment]::SetEnvironmentVariable("Path",[Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::User)+";C:\xmake",[System.EnvironmentVariableTarget]::User) +Write-Host 'Adding to PATH... almost done' +$env:Path+=";$installdir" +[Environment]::SetEnvironmentVariable("Path",[Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::User)+";$installdir",[System.EnvironmentVariableTarget]::User) # this step is optional because installer writes path to regedit xmake --version |
