HttpSysServer 251 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. commit 14aec22cda2c0c81b369b08c7d260afffae20c9d
  2. Author: Ryan Brandenburg <[email protected]>
  3. Date: Fri Dec 1 10:24:09 2017 -0800
  4. Update bootstrappers
  5. diff --git a/run.ps1 b/run.ps1
  6. index 49c28998564..27dcf848f84 100644
  7. --- a/run.ps1
  8. +++ b/run.ps1
  9. @@ -29,6 +29,9 @@ Updates KoreBuild to the latest version even if a lock file is present.
  10. .PARAMETER ConfigFile
  11. The path to the configuration file that stores values. Defaults to korebuild.json.
  12. +.PARAMETER ToolsSourceSuffix
  13. +The Suffix to append to the end of the ToolsSource. Useful for query strings in blob stores.
  14. +
  15. .PARAMETER Arguments
  16. Arguments to be passed to the command
  17. @@ -51,7 +54,7 @@ Example config file:
  18. #>
  19. [CmdletBinding(PositionalBinding = $false)]
  20. param(
  21. - [Parameter(Mandatory=$true, Position = 0)]
  22. + [Parameter(Mandatory = $true, Position = 0)]
  23. [string]$Command,
  24. [string]$Path = $PSScriptRoot,
  25. [Alias('c')]
  26. @@ -63,6 +66,7 @@ param(
  27. [Alias('u')]
  28. [switch]$Update,
  29. [string]$ConfigFile,
  30. + [string]$ToolsSourceSuffix,
  31. [Parameter(ValueFromRemainingArguments = $true)]
  32. [string[]]$Arguments
  33. )
  34. @@ -79,7 +83,7 @@ function Get-KoreBuild {
  35. $lockFile = Join-Path $Path 'korebuild-lock.txt'
  36. if (!(Test-Path $lockFile) -or $Update) {
  37. - Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile
  38. + Get-RemoteFile "$ToolsSource/korebuild/channels/$Channel/latest.txt" $lockFile $ToolsSourceSuffix
  39. }
  40. $version = Get-Content $lockFile | Where-Object { $_ -like 'version:*' } | Select-Object -first 1
  41. @@ -96,7 +100,7 @@ function Get-KoreBuild {
  42. try {
  43. $tmpfile = Join-Path ([IO.Path]::GetTempPath()) "KoreBuild-$([guid]::NewGuid()).zip"
  44. - Get-RemoteFile $remotePath $tmpfile
  45. + Get-RemoteFile $remotePath $tmpfile $ToolsSourceSuffix
  46. if (Get-Command -Name 'Expand-Archive' -ErrorAction Ignore) {
  47. # Use built-in commands where possible as they are cross-plat compatible
  48. Expand-Archive -Path $tmpfile -DestinationPath $korebuildPath
  49. @@ -124,7 +128,7 @@ function Join-Paths([string]$path, [string[]]$childPaths) {
  50. return $path
  51. }
  52. -function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) {
  53. +function Get-RemoteFile([string]$RemotePath, [string]$LocalPath, [string]$RemoteSuffix) {
  54. if ($RemotePath -notlike 'http*') {
  55. Copy-Item $RemotePath $LocalPath
  56. return
  57. @@ -134,7 +138,7 @@ function Get-RemoteFile([string]$RemotePath, [string]$LocalPath) {
  58. while ($retries -gt 0) {
  59. $retries -= 1
  60. try {
  61. - Invoke-WebRequest -UseBasicParsing -Uri $RemotePath -OutFile $LocalPath
  62. + Invoke-WebRequest -UseBasicParsing -Uri $($RemotePath + $RemoteSuffix) -OutFile $LocalPath
  63. return
  64. }
  65. catch {
  66. @@ -161,7 +165,8 @@ if (Test-Path $ConfigFile) {
  67. if (!($Channel) -and (Get-Member -Name 'channel' -InputObject $config)) { [string] $Channel = $config.channel }
  68. if (!($ToolsSource) -and (Get-Member -Name 'toolsSource' -InputObject $config)) { [string] $ToolsSource = $config.toolsSource}
  69. }
  70. - } catch {
  71. + }
  72. + catch {
  73. Write-Warning "$ConfigFile could not be read. Its settings will be ignored."
  74. Write-Warning $Error[0]
  75. }
  76. diff --git a/run.sh b/run.sh
  77. index c278423accb..834961fc3a5 100755
  78. --- a/run.sh
  79. +++ b/run.sh
  80. @@ -17,6 +17,7 @@ update=false
  81. repo_path="$DIR"
  82. channel=''
  83. tools_source=''
  84. +tools_source_suffix=''
  85. #
  86. # Functions
  87. @@ -29,13 +30,14 @@ __usage() {
  88. echo " <Arguments>... Arguments passed to the command. Variable number of arguments allowed."
  89. echo ""
  90. echo "Options:"
  91. - echo " --verbose Show verbose output."
  92. - echo " -c|--channel <CHANNEL> The channel of KoreBuild to download. Overrides the value from the config file.."
  93. - echo " --config-file <FILE> The path to the configuration file that stores values. Defaults to korebuild.json."
  94. - echo " -d|--dotnet-home <DIR> The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet."
  95. - echo " --path <PATH> The directory to build. Defaults to the directory containing the script."
  96. - echo " -s|--tools-source|-ToolsSource <URL> The base url where build tools can be downloaded. Overrides the value from the config file."
  97. - echo " -u|--update Update to the latest KoreBuild even if the lock file is present."
  98. + echo " --verbose Show verbose output."
  99. + echo " -c|--channel <CHANNEL> The channel of KoreBuild to download. Overrides the value from the config file.."
  100. + echo " --config-file <FILE> The path to the configuration file that stores values. Defaults to korebuild.json."
  101. + echo " -d|--dotnet-home <DIR> The directory where .NET Core tools will be stored. Defaults to '\$DOTNET_HOME' or '\$HOME/.dotnet."
  102. + echo " --path <PATH> The directory to build. Defaults to the directory containing the script."
  103. + echo " -s|--tools-source|-ToolsSource <URL> The base url where build tools can be downloaded. Overrides the value from the config file."
  104. + echo " --tools-source-suffix|-ToolsSourceSuffix <SUFFIX> The suffix to append to tools-source. Useful for query strings."
  105. + echo " -u|--update Update to the latest KoreBuild even if the lock file is present."
  106. echo ""
  107. echo "Description:"
  108. echo " This function will create a file \$DIR/korebuild-lock.txt. This lock file can be committed to source, but does not have to be."
  109. @@ -50,7 +52,7 @@ get_korebuild() {
  110. local version
  111. local lock_file="$repo_path/korebuild-lock.txt"
  112. if [ ! -f "$lock_file" ] || [ "$update" = true ]; then
  113. - __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file"
  114. + __get_remote_file "$tools_source/korebuild/channels/$channel/latest.txt" "$lock_file" "$tools_source_suffix"
  115. fi
  116. version="$(grep 'version:*' -m 1 "$lock_file")"
  117. if [[ "$version" == '' ]]; then
  118. @@ -66,7 +68,7 @@ get_korebuild() {
  119. local remote_path="$tools_source/korebuild/artifacts/$version/korebuild.$version.zip"
  120. tmpfile="$(mktemp)"
  121. echo -e "${MAGENTA}Downloading KoreBuild ${version}${RESET}"
  122. - if __get_remote_file "$remote_path" "$tmpfile"; then
  123. + if __get_remote_file "$remote_path" "$tmpfile" "$tools_source_suffix"; then
  124. unzip -q -d "$korebuild_path" "$tmpfile"
  125. fi
  126. rm "$tmpfile" || true
  127. @@ -98,6 +100,7 @@ __machine_has() {
  128. __get_remote_file() {
  129. local remote_path=$1
  130. local local_path=$2
  131. + local remote_path_suffix=$3
  132. if [[ "$remote_path" != 'http'* ]]; then
  133. cp "$remote_path" "$local_path"
  134. @@ -106,14 +109,14 @@ __get_remote_file() {
  135. local failed=false
  136. if __machine_has wget; then
  137. - wget --tries 10 --quiet -O "$local_path" "$remote_path" || failed=true
  138. + wget --tries 10 --quiet -O "$local_path" "${remote_path}${remote_path_suffix}" || failed=true
  139. else
  140. failed=true
  141. fi
  142. if [ "$failed" = true ] && __machine_has curl; then
  143. failed=false
  144. - curl --retry 10 -sSL -f --create-dirs -o "$local_path" "$remote_path" || failed=true
  145. + curl --retry 10 -sSL -f --create-dirs -o "$local_path" "${remote_path}${remote_path_suffix}" || failed=true
  146. fi
  147. if [ "$failed" = true ]; then
  148. @@ -164,6 +167,11 @@ while [[ $# -gt 0 ]]; do
  149. tools_source="${1:-}"
  150. [ -z "$tools_source" ] && __usage
  151. ;;
  152. + --tools-source-suffix|-ToolsSourceSuffix)
  153. + shift
  154. + tools_source_suffix="${1:-}"
  155. + [ -z "$tools_source_suffix" ] && __usage
  156. + ;;
  157. -u|--update|-Update)
  158. update=true
  159. ;;