| 1 |
# mingw-prepare.ps1: Prepare the msys2 environment in GitLab CI |
| 2 |
|
| 3 |
# Make sure powershell exists on errors |
| 4 |
$ErrorActionPreference = "Stop" |
| 5 |
|
| 6 |
# Disable progress bar to speed up download |
| 7 |
$ProgressPreference = "SilentlyContinue" |
| 8 |
|
| 9 |
# Install msys2 |
| 10 |
$msys2_installer = "msys2-x86_64-latest.sfx.exe" |
| 11 |
Invoke-WebRequest https://repo.msys2.org/distrib/$msys2_installer -OutFile $env:TEMP\$msys2_installer |
| 12 |
Invoke-Expression "$env:TEMP/$msys2_installer -y -oC:\" |
| 13 |
|
| 14 |
# Update base packages and package database |
| 15 |
# From https://github.com/msys2/setup-msys2/blob/main/main.js |
| 16 |
C:\msys64\msys2_shell.cmd -defterm -here -no-start -l -c "pacman-key --init && pacman-key --populate msys2 && pacman-key --refresh-keys || echo errors ignored" |
| 17 |
C:\msys64\msys2_shell.cmd -defterm -here -no-start -l -c "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf" |
| 18 |
C:\msys64\msys2_shell.cmd -defterm -here -no-start -l -c "pacman -Syuu --noconfirm || echo errors ignored" |
| 19 |
taskkill.exe /F /FI "MODULES eq msys-2.0.dll" |
| 20 |
C:\msys64\msys2_shell.cmd -defterm -here -no-start -l -c "pacman -Syuu --noconfirm" |