Skip to content

Commit 4320842

Browse files
committed
net-installer: try harder to install packages
SourceForge -- which backs MSys2's own packages -- could be a little more reliable, meaning that Pacman sometimes errors out because packages could either not be downloaded at all, or downloads got interrupted, or just got too slow. To work around this issue, let's try up to five times to install packages, and if it still did not work, notify the user and give up. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent b9d2cba commit 4320842

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

net-installer/setup-git-sdk.bat

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,45 @@
1313
@REM set MSYSTEM so that MSys2 starts up in the correct mode
1414
@set MSYSTEM=MINGW@@BITNESS@@
1515

16+
@SET /A counter=0
17+
:INSTALL_RUNTIME
18+
@SET /A counter+=1
19+
@IF %counter% GEQ 5 (
20+
@ECHO "Could not install msys2-runtime"
21+
@PAUSE
22+
@EXIT 1
23+
)
24+
1625
@REM update the Pacman package indices first, then force-install msys2-runtime
1726
@REM (we ship with a stripped-down msys2-runtime, gpg and pacman), so that
1827
@REM pacman's post-install scripts run without complaining about heap problems
1928
@%cwd%\usr\bin\pacman -Sy --force --noconfirm msys2-runtime
2029

30+
@IF ERRORLEVEL 1 GOTO INSTALL_RUNTIME
31+
32+
@SET /A counter=0
33+
:INSTALL_PACMAN
34+
@SET /A counter+=1
35+
@IF %counter% GEQ 5 (
36+
@ECHO "Could not install pacman"
37+
@PAUSE
38+
@EXIT 1
39+
)
40+
2141
@REM next, force update pacman
2242
@%cwd%\usr\bin\pacman -S --force --noconfirm pacman
2343

44+
@IF ERRORLEVEL 1 GOTO INSTALL_PACMAN
45+
46+
@SET /A counter=0
47+
:INSTALL_REST
48+
@SET /A counter+=1
49+
@IF %counter% GEQ 5 (
50+
@ECHO "Could not install the remaining packages"
51+
@PAUSE
52+
@EXIT 1
53+
)
54+
2455
@REM now update the rest
2556
@%cwd%\usr\bin\pacman -S --force --noconfirm ^
2657
base python less openssh patch make tar diffutils ca-certificates ^
@@ -32,6 +63,8 @@
3263
mingw-w64-@@ARCH@@-openssl mingw-w64-@@ARCH@@-tcl ^
3364
mingw-w64-@@ARCH@@-pcre
3465

66+
@IF ERRORLEVEL 1 GOTO INSTALL_REST
67+
3568
@REM Avoid overlapping address ranges
3669
@IF MINGW32 == %MSYSTEM% (
3770
ECHO "Auto-rebasing .dll files"

0 commit comments

Comments
 (0)