]> vilimpoc.org git repositories - dotfiles/blob - setup-windows.bat
dotfiles: give git the ssh.exe that pushes at line rate
[dotfiles] / setup-windows.bat
1 @echo off\r
2 \r
3 @rem ---------------------------------------------------------------------------\r
4 @rem setup-windows.bat - provision a fresh Windows box for native development\r
5 @rem ---------------------------------------------------------------------------\r
6 \r
7 @rem --- Non-admin (per-user) winget installs ---\r
8 winget install Anthropic.ClaudeCode\r
9 winget install Git.Git\r
10 winget install Microsoft.PowerShell Microsoft.Sysinternals.ProcessExplorer Microsoft.Sysinternals.ProcessMonitor Microsoft.Sysinternals.SDelete Microsoft.VisualStudioCode Microsoft.WindowsTerminal\r
11 winget install Python.Python.3.13\r
12 winget install WinMerge.WinMerge\r
13 winget install WiXToolset.WiXCLI\r
14 \r
15 @rem OpenCppCoverage: native (PE) line coverage for the C++ binaries. run-coverage-occ.py drives the\r
16 @rem pytest suite under it to produce an HTML report (the binaries under test build with PDBs,\r
17 @rem which it reads). The installer elevates via UAC.\r
18 winget install OpenCppCoverage.OpenCppCoverage\r
19 \r
20 @rem ---------------------------------------------------------------------------\r
21 @rem No package manager needed for the Windows build\r
22 @rem\r
23 @rem Just:\r
24 @rem   cd windows && cmake -B build -G "Visual Studio 17 2022" -A x64 && cmake --build build --config Release\r
25 @rem ---------------------------------------------------------------------------\r
26 \r
27 @rem --- Elevated installs (VS2022, WDK, system tools) ---\r
28 @rem The elevated script runs in its own window and logs to setup-windows-uac.log.\r
29 @rem -PassThru + $p.ExitCode propagates its real exit code back through to ERRORLEVEL.\r
30 set "UAC_LOG=%~dp0setup-windows-uac.log"\r
31 if exist "%UAC_LOG%" del "%UAC_LOG%"\r
32 \r
33 powershell -NoProfile -Command "$p = Start-Process powershell -Verb RunAs -ArgumentList '-NoProfile','-ExecutionPolicy','Bypass','-File','""%~dp0setup-windows-with-uac.ps1""' -Wait -PassThru; exit $p.ExitCode"\r
34 set "UAC_RC=%ERRORLEVEL%"\r
35 \r
36 @rem --- Surface the elevated session's output (its window has already closed) ---\r
37 if exist "%UAC_LOG%" (\r
38     echo.\r
39     echo ===== elevated setup log ^(%UAC_LOG%^) =====\r
40     type "%UAC_LOG%"\r
41     echo ===== end of elevated setup log =====\r
42 ) else (\r
43     echo [setup-windows] WARNING: no elevated log found at "%UAC_LOG%".\r
44     echo [setup-windows] The elevated window may have been cancelled at the UAC prompt.\r
45 )\r
46 \r
47 @rem --- Non-elevated PowerShell half ---\r
48 @rem WinMerge on the user PATH, BinSkim, and the global git config (identity +\r
49 @rem core.sshCommand -> a Win32-OpenSSH client, so git shares the Windows\r
50 @rem ssh-agent). EDIT THE GIT IDENTITY at the top of setup-windows-no-uac.ps1\r
51 @rem before the first run.\r
52 @rem\r
53 @rem Deliberately NOT elevated: every step writes per-user state (the HKCU PATH,\r
54 @rem the .gitconfig under %USERPROFILE%), which the elevated half would write to\r
55 @rem the administrator profile instead.\r
56 @rem\r
57 @rem AFTER the elevated half on purpose: core.sshCommand prefers the ssh.exe that\r
58 @rem half unpacks beside rsync.exe - a push through the in-box client is capped\r
59 @rem at ~17MB/s - and it can only prefer it once it is on disk. Run either way,\r
60 @rem including when the elevated half failed above: nothing here depends on it,\r
61 @rem and the fallback is the in-box client that Windows already has.\r
62 @rem\r
63 @rem Non-fatal: these are conveniences, and the elevated half is the part worth\r
64 @rem the UAC prompt. A failure warns and provisioning continues.\r
65 powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0setup-windows-no-uac.ps1"\r
66 if not "%ERRORLEVEL%"=="0" echo [setup-windows] WARNING: setup-windows-no-uac.ps1 reported a failure ^(see above^); continuing.\r
67 \r
68 if not "%UAC_RC%"=="0" (\r
69     echo.\r
70     echo [setup-windows] ELEVATED SETUP FAILED ^(exit code %UAC_RC%^). See log above.\r
71     exit /b %UAC_RC%\r
72 )\r
73 echo.\r
74 echo [setup-windows] Elevated setup completed successfully.\r
75 \r
76 @rem Removed: this doesn't work as well as I hoped, maybe try again later\r
77 @rem -- Install Headroom ---\r
78 @rem py -m pip install "headroom-ai[all]"\r
79 @rem npm install headroom-ai\r
80 \r
81 py -m pip install Pillow