summaryrefslogtreecommitdiff
path: root/dotnet-download.ps1
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2017-04-13 14:17:19 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2017-04-13 14:17:19 +0900
commita56e30c8d33048216567753d9d3fefc2152af8ac (patch)
tree7e5d979695fc4a431740982eb1cfecc2898b23a5 /dotnet-download.ps1
parent4b11dc566a5bbfa1378d6266525c281b028abcc8 (diff)
downloadcoreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.gz
coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.tar.bz2
coreclr-a56e30c8d33048216567753d9d3fefc2152af8ac.zip
Imported Upstream version 2.0.0.11353upstream/2.0.0.11353
Diffstat (limited to 'dotnet-download.ps1')
-rw-r--r--dotnet-download.ps137
1 files changed, 37 insertions, 0 deletions
diff --git a/dotnet-download.ps1 b/dotnet-download.ps1
new file mode 100644
index 0000000000..ef5808f2a2
--- /dev/null
+++ b/dotnet-download.ps1
@@ -0,0 +1,37 @@
+param(
+ [parameter(Mandatory=$true)]$DotnetRemotePath,
+ [parameter(Mandatory=$true)]$DotnetLocalPath,
+ [parameter(Mandatory=$true)]$DotnetPath
+)
+
+$retryCount = 0
+$success = $false
+
+do {
+ try {
+ Write-Output "Downloading from $DotnetRemotePath"
+ (New-Object Net.WebClient).DownloadFile($DotnetRemotePath, $DotnetLocalPath)
+ $success = $true
+ } catch {
+ if ($retryCount -ge 6) {
+ Write-Output "Maximum of 5 retries exceeded. Aborting"
+ throw
+ }
+ else {
+ $retryCount++
+ $retryTime = 5 * $retryCount
+ Write-Output "Download failed. Retrying in $retryTime seconds"
+ Start-Sleep -Seconds (5 * $retryCount)
+ }
+ }
+} while ($success -eq $false)
+
+Write-Output "Download finished"
+Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors
+
+if ($AddTypeErrors.Count -eq 0) {
+ [System.IO.Compression.ZipFile]::ExtractToDirectory($DotnetLocalPath, $DotnetPath)
+}
+else {
+ (New-Object -com shell.application).namespace($DotnetPath).CopyHere((new-object -com shell.application).namespace($DotnetLocalPath).Items(), 16)
+} \ No newline at end of file