@@ -236,42 +236,71 @@ if (-not $IsWinEnv) {
236
236
}
237
237
}
238
238
$tempDir = Join-Path ([System.IO.Path ]::GetTempPath()) ([System.IO.Path ]::GetRandomFileName())
239
- New-Item - ItemType Directory - Path $tempDir - Force - ErrorAction SilentlyContinue
239
+ $null = New-Item - ItemType Directory - Path $tempDir - Force - ErrorAction SilentlyContinue
240
240
try {
241
241
# Setting Tls to 12 to prevent the Invoke-WebRequest : The request was
242
242
# aborted: Could not create SSL/TLS secure channel. error.
243
243
$originalValue = [Net.ServicePointManager ]::SecurityProtocol
244
244
[Net.ServicePointManager ]::SecurityProtocol = [Net.ServicePointManager ]::SecurityProtocol -bor [Net.SecurityProtocolType ]::Tls12
245
245
246
246
if ($Daily ) {
247
- if (-not (Get-Module - Name PackageManagement - ListAvailable)) {
248
- throw " PackageManagement module is required to install daily PowerShell."
247
+ $metadata = Invoke-RestMethod https:// pscoretestdata.blob.core.windows.net/ buildinfo/ daily.json
248
+ $release = $metadata.ReleaseTag -replace ' ^v'
249
+ $blobName = $metadata.BlobName
250
+
251
+ if ($IsWinEnv ) {
252
+ if ($UseMSI ) {
253
+ $packageName = " PowerShell-${release} -win-${architecture} .msi"
254
+ } else {
255
+ $packageName = " PowerShell-${release} -win-${architecture} .zip"
256
+ }
257
+ } elseif ($IsLinuxEnv ) {
258
+ $packageName = " powershell-${release} -linux-${architecture} .tar.gz"
259
+ } elseif ($IsMacOSEnv ) {
260
+ $packageName = " powershell-${release} -osx-${architecture} .tar.gz"
249
261
}
250
262
251
263
if ($architecture -ne " x64" ) {
252
264
throw " The OS architecture is '$architecture '. However, we currently only support daily package for x64."
253
265
}
254
266
255
- # # Register source if not yet
256
- if (-not (Get-PackageSource - Name powershell- core- daily - ErrorAction SilentlyContinue)) {
257
- $packageSource = " https://powershell.myget.org/F/powershell-core-daily"
258
- Write-Verbose " Register powershell-core-daily package source '$packageSource ' with PackageManagement" - Verbose
259
- Register-PackageSource - Name powershell- core- daily - Location $packageSource - ProviderName nuget - Trusted - ErrorAction SilentlyContinue
267
+
268
+ $downloadURL = " https://pscoretestdata.blob.core.windows.net/${blobName} /${packageName} "
269
+ Write-Verbose " About to download package from '$downloadURL '" - Verbose
270
+
271
+ $packagePath = Join-Path - Path $tempDir - ChildPath $packageName
272
+ if (! $PSVersionTable.ContainsKey (' PSEdition' ) -or $PSVersionTable.PSEdition -eq " Desktop" ) {
273
+ # On Windows PowerShell, progress can make the download significantly slower
274
+ $oldProgressPreference = $ProgressPreference
275
+ $ProgressPreference = " SilentlyContinue"
260
276
}
261
277
262
- if ( $IsWinEnv ) {
263
- $packageName = " powershell-win-x64-win7-x64 "
264
- } elseif ( $IsLinuxEnv ) {
265
- $packageName = " powershell-linux-x64 "
266
- } elseif ( $IsMacOSEnv ) {
267
- $packageName = " powershell-osx-x64 "
278
+ try {
279
+ Invoke-WebRequest - Uri $downloadURL - OutFile $packagePath
280
+ } finally {
281
+ if ( ! $PSVersionTable .ContainsKey ( ' PSEdition ' ) -or $PSVersionTable .PSEdition -eq " Desktop " ) {
282
+ $ProgressPreference = $oldProgressPreference
283
+ }
268
284
}
269
285
270
- $package = Find-Package - Source powershell- core- daily - AllowPrereleaseVersions - Name $packageName
271
- Write-Verbose " Daily package found. Name: $packageName ; Version: $ ( $package.Version ) " - Verbose
286
+ $contentPath = Join-Path - Path $tempDir - ChildPath " new"
272
287
273
- Install-Package - InputObject $package - Destination $tempDir - ExcludeVersion - ErrorAction SilentlyContinue
274
- $contentPath = [System.IO.Path ]::Combine($tempDir , $packageName , " content" )
288
+ $null = New-Item - ItemType Directory - Path $contentPath - ErrorAction SilentlyContinue
289
+ if ($IsWinEnv ) {
290
+ if ($UseMSI -and $Quiet ) {
291
+ Write-Verbose " Performing quiet install"
292
+ $process = Start-Process msiexec - ArgumentList " /i" , $packagePath , " /quiet" - Wait - PassThru
293
+ if ($process.exitcode -ne 0 ) {
294
+ throw " Quiet install failed, please rerun install without -Quiet switch or ensure you have administrator rights"
295
+ }
296
+ } elseif ($UseMSI ) {
297
+ Start-Process $packagePath - Wait
298
+ } else {
299
+ Expand-ArchiveInternal - Path $packagePath - DestinationPath $contentPath
300
+ }
301
+ } else {
302
+ tar zxf $packagePath - C $contentPath
303
+ }
275
304
} else {
276
305
$metadata = Invoke-RestMethod https:// raw.githubusercontent.com / PowerShell/ PowerShell/ master/ tools/ metadata.json
277
306
if ($Preview ) {
@@ -312,7 +341,7 @@ try {
312
341
313
342
$contentPath = Join-Path - Path $tempDir - ChildPath " new"
314
343
315
- New-Item - ItemType Directory - Path $contentPath - ErrorAction SilentlyContinue
344
+ $null = New-Item - ItemType Directory - Path $contentPath - ErrorAction SilentlyContinue
316
345
if ($IsWinEnv ) {
317
346
if ($UseMSI -and $Quiet ) {
318
347
Write-Verbose " Performing quiet install"
@@ -350,7 +379,7 @@ try {
350
379
if (-not (Test-Path " ~/.rcedit/rcedit-x64.exe" )) {
351
380
Write-Verbose " Install RCEdit for modifying exe resources" - Verbose
352
381
$rceditUrl = " https://github.com/electron/rcedit/releases/download/v1.0.0/rcedit-x64.exe"
353
- New-Item - Path " ~/.rcedit" - Type Directory - Force - ErrorAction SilentlyContinue
382
+ $null = New-Item - Path " ~/.rcedit" - Type Directory - Force - ErrorAction SilentlyContinue
354
383
Invoke-WebRequest - OutFile " ~/.rcedit/rcedit-x64.exe" - Uri $rceditUrl
355
384
}
356
385
0 commit comments