mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-29 20:23:41 +08:00
2ed44b4546
* Cherry-pick https://github.com/microsoft/vcpkg/pull/15598 * Hook deploy-inteloneapi into create-vmss.ps1. * Add script to resolve https://github.com/microsoft/vcpkg/issues/17521 * Move tls settings deployment to the front and respond to script triggering a reboot. * Go back to provisioning an extra disk to workaround https://github.com/microsoft/vcpkg/issues/18379 * Disallow public access to blob storage and require TLS 1.2. * Update Pools. * Update tool to 2021-06-19 * [simage] Skip simage on uwp platforms as it appears broken by 16.10. * [tensorflow-cc] Skip because changes in our MacOS hardware broke the port.
61 lines
2.1 KiB
PowerShell
61 lines
2.1 KiB
PowerShell
# Copyright (c) Microsoft Corporation.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# REPLACE WITH UTILITY-PREFIX.ps1
|
|
|
|
<#
|
|
.SYNOPSIS
|
|
Partitions a new physical disk.
|
|
.DESCRIPTION
|
|
Takes the disk $DiskNumber, turns it on, then partitions it for use with label
|
|
$Label and drive letter $Letter.
|
|
.PARAMETER DiskNumber
|
|
The number of the disk to set up.
|
|
.PARAMETER Letter
|
|
The drive letter at which to mount the disk.
|
|
.PARAMETER Label
|
|
The label to give the disk.
|
|
#>
|
|
Function New-PhysicalDisk {
|
|
Param(
|
|
[int]$DiskNumber,
|
|
[string]$Letter,
|
|
[string]$Label
|
|
)
|
|
if ($Letter.Length -ne 1) {
|
|
throw "Bad drive letter $Letter, expected only one letter. (Did you accidentially add a : ?)"
|
|
}
|
|
|
|
try {
|
|
Write-Host "Attempting to online physical disk $DiskNumber"
|
|
[string]$diskpartScriptPath = Get-TempFilePath -Extension 'txt'
|
|
[string]$diskpartScriptContent =
|
|
"SELECT DISK $DiskNumber`r`n" +
|
|
"ONLINE DISK`r`n"
|
|
|
|
Write-Host "Writing diskpart script to $diskpartScriptPath with content:"
|
|
Write-Host $diskpartScriptContent
|
|
Set-Content -Path $diskpartScriptPath -Value $diskpartScriptContent
|
|
Write-Host 'Invoking DISKPART...'
|
|
& diskpart.exe /s $diskpartScriptPath
|
|
|
|
Write-Host "Provisioning physical disk $DiskNumber as drive $Letter"
|
|
[string]$diskpartScriptContent =
|
|
"SELECT DISK $DiskNumber`r`n" +
|
|
"ATTRIBUTES DISK CLEAR READONLY`r`n" +
|
|
"CREATE PARTITION PRIMARY`r`n" +
|
|
"FORMAT FS=NTFS LABEL=`"$Label`" QUICK`r`n" +
|
|
"ASSIGN LETTER=$Letter`r`n"
|
|
Write-Host "Writing diskpart script to $diskpartScriptPath with content:"
|
|
Write-Host $diskpartScriptContent
|
|
Set-Content -Path $diskpartScriptPath -Value $diskpartScriptContent
|
|
Write-Host 'Invoking DISKPART...'
|
|
& diskpart.exe /s $diskpartScriptPath
|
|
}
|
|
catch {
|
|
Write-Error "Failed to provision physical disk $DiskNumber as drive $Letter! $($_.Exception.Message)"
|
|
}
|
|
}
|
|
|
|
New-PhysicalDisk -DiskNumber 1 -Letter 'E' -Label 'install disk'
|