Created
August 7, 2022 22:01
-
-
Save rkitover/e11cf176e5fe38a15625e37031aceb8a to your computer and use it in GitHub Desktop.
PowerShell script to do a full MSYS2 upgrade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$erroractionpreference = 'stop' | |
if (-not (new-object security.principal.windowsprincipal( | |
[security.principal.windowsidentity]::getcurrent() | |
)).isinrole([security.principal.windowsbuiltinrole]::administrator)) { | |
write-error "Must be elevated." | |
} | |
$bash = resolve-path /tools/msys64/usr/bin/bash.exe | |
function bash_cmd { | |
$cmd = ($args | %{ "'$_'" }) -join " " | |
&$bash -l -c $cmd | |
} | |
do { | |
bash_cmd pacman --noconfirm -Syuu --overwrite '*' | |
taskkill /f /FI 'MODULES eq msys-2.0.dll' | |
} while (bash_cmd pacman -Qu) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment