]> vilimpoc.org git repositories - dotfiles/blobdiff - setup-windows-plan.ps1
dotfiles: register UI.Xaml 2.8 for the account before installing Terminal
[dotfiles] / setup-windows-plan.ps1
index add6305e708760ca8e2b95412c450b66387830c5..41dff110f08ea82b802ce18a5e5e31eb5d0f1b7c 100644 (file)
@@ -18,6 +18,7 @@
   Run it on its own to preview the plan for another kind of box:
 
       powershell -File .\setup-windows-plan.ps1 -WhatIf -HostArch ARM64 -Elevation NOLUA
+      powershell -File .\setup-windows-plan.ps1 -WhatIf -VirtualMachine Hyper-V
 
   The steps, and where each one is unavailable and why, come from
   setup-windows-steps.ps1; this script only presents them and records the
@@ -44,6 +45,9 @@ param(
     # here the same way when this script is run on its own.
     [string]   $HostArch,
     [ValidateSet('ALREADY', 'PROMPT', 'NOLUA')] [string] $Elevation,
+    # The hypervisor this Windows is a guest of, or 'none' for physical
+    # hardware. Detected when not given; setup-windows.bat leaves it to that.
+    [string]   $VirtualMachine,
     [string]   $OutFile
 )
 
@@ -110,6 +114,7 @@ function Show-Plan {
     Write-Host ''
     Write-Host 'Setup plan - nothing has been done yet' -ForegroundColor Cyan
     Write-Host "  host:      $ArchLabel"
+    Write-Host "  machine:   $VmLabel"
     Write-Host "  elevation: $ElevLabel"
     foreach ($g in $groups.Keys) {
         $head = " $g  $($groups[$g])"
@@ -210,6 +215,17 @@ if (-not $Elevation) {
     }
 }
 
+# A guest VM is not somewhere to put a hypervisor of its own: VirtualBox, for
+# one, is for the test VMs, which belong on the physical host. Detected once
+# here; the steps that care are -NotInVM in setup-windows-steps.ps1.
+if (-not $VirtualMachine) { $VirtualMachine = Get-SetupVirtualMachine }
+if ($VirtualMachine -eq 'none') { $VirtualMachine = $null }
+$VmLabel = if ($VirtualMachine) {
+    "virtual machine ($VirtualMachine) - steps meant for the physical host are marked [-]"
+} else {
+    'physical hardware'
+}
+
 $ArchLabel = switch ($HostArch) {
     'ARM64' { 'ARM64 - the lean build box, one C/C++ compiler; x64-only steps are marked [-]' }
     'AMD64' { 'x64 - the full workstation' }
@@ -234,7 +250,7 @@ $onlyGiven = $PSBoundParameters.ContainsKey('Only')
 try {
     $plan = @(Resolve-SetupSelection -Steps (Get-SetupCatalog -IsArm64 $IsArm64) `
                 -Only $(if ($onlyGiven) { $Only } else { $null }) -Skip $Skip `
-                -IsArm64 $IsArm64 -Elevation $Elevation)
+                -IsArm64 $IsArm64 -Elevation $Elevation -VirtualMachine $VirtualMachine)
 } catch {
     # A mistyped -Only / -Skip. Said plainly, and no hand-off file, so the batch
     # file stops before doing anything.