1 # Download new TLS certs from Windows Update 2 Write-Host "Updating TLS certificate store at:" 3 Get-Date 4 Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "_tlscerts" | Out-Null 5 $certdir = (New-Item -ItemType Directory -Name "_tlscerts") 6 certutil -syncwithWU "$certdir" 7 Foreach ($file in (Get-ChildItem -Path "$certdir\*" -Include "*.crt")) { 8 Import-Certificate -FilePath $file -CertStoreLocation Cert:\LocalMachine\Root | Out-Null 9 } 10 Remove-Item -Recurse -Path $certdir 11 12 Write-Host "Installing graphics tools (DirectX debug layer) at:" 13 Get-Date 14 Set-Service -Name wuauserv -StartupType Manual 15 if (!$?) { 16 Write-Host "Failed to enable Windows Update" 17 Exit 1 18 } 19 20 For ($i = 0; $i -lt 5; $i++) { 21 Dism /online /quiet /add-capability /capabilityname:Tools.Graphics.DirectX~~~~0.0.1.0 22 $graphics_tools_installed = $? 23 if ($graphics_tools_installed) { 24 Break 25 } 26 } 27 28 if (!$graphics_tools_installed) { 29 Write-Host "Failed to install graphics tools" 30 Get-Content C:\Windows\Logs\DISM\dism.log 31 Exit 1 32 } 33 34 Write-Host "Installing Chocolatey at:" 35 Get-Date 36 Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) 37 Import-Module "$env:ProgramData\chocolatey\helpers\chocolateyProfile.psm1" 38 # Add Chocolatey's native install path 39 Update-SessionEnvironment 40 Write-Host "Installing Chocolatey packages at:" 41 Get-Date 42 43 # Chocolatey tries to download winflexbison3 from github, which is not super reliable, and has no retry 44 # loop of its own - so we give it a helping hand here 45 For ($i = 0; $i -lt 5; $i++) { 46 choco install --no-progress -y python3 47 $python_install = $? 48 choco install --allow-empty-checksums --no-progress -y cmake git git-lfs ninja pkgconfiglite winflexbison3 --installargs "ADD_CMAKE_TO_PATH=System" 49 $other_install = $? 50 $choco_installed = $other_install -and $python_install 51 if ($choco_installed) { 52 Break 53 } 54 } 55 56 if (!$choco_installed) { 57 Write-Host "Couldn't install dependencies from Chocolatey" 58 Exit 1 59 } 60 61 # Add Chocolatey's newly installed package path 62 Update-SessionEnvironment 63 64 Start-Process -NoNewWindow -Wait git -ArgumentList 'config --global core.autocrlf false' 65 66 Write-Host "Upgrading pip at:" 67 Get-Date 68 python -m pip install --upgrade pip --progress-bar off 69 Write-Host "Installing python packages at:" 70 Get-Date 71 pip3 install packaging meson mako "numpy < 2.0" pyyaml --progress-bar off 72 if (!$?) { 73 Write-Host "Failed to install dependencies from pip" 74 Exit 1 75 } 76 Write-Host "Installing python packages finished at:" 77 Get-Date 78