Skip to content

Instantly share code, notes, and snippets.

@rkitover
Created August 7, 2022 22:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rkitover/e11cf176e5fe38a15625e37031aceb8a to your computer and use it in GitHub Desktop.
Save rkitover/e11cf176e5fe38a15625e37031aceb8a to your computer and use it in GitHub Desktop.
PowerShell script to do a full MSYS2 upgrade
$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