Skip to content

Commit 783f742

Browse files
committed
net installer: ask for an HTTP proxy upon pacman failure
Ideally, we would test for a good indicator that a proxy is required before we ask for an HTTP proxy. Alas, this developer has no access to a setup that requires a proxy to access the web, and was unable to get ahold of that information otherwise. So let's just simply always ask for an HTTP proxy when pacman failed to synchronize and/or update the msys2-runtime package. For good measure, add a script to etc/profile.d/ that will configure the proxy for Git Bash sessions, but only when we set the environment variables ourselves; If the http_proxy variable was set appropriately already outside of the installation script, we do not need to tell the Bash to set them. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 143a81c commit 783f742

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

net-installer/setup-git-sdk.bat

+25
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@
2222
@EXIT 1
2323
)
2424

25+
@REM Maybe we need a proxy?
26+
@IF %counter% GEQ 2 (
27+
@ECHO.
28+
@ECHO There was a problem accessing the MSys2 repositories
29+
@ECHO If your setup requires an HTTP proxy to access the web,
30+
@ECHO please specify it here, otherwise leave it empty.
31+
@ECHO.
32+
@SET /p proxy= "HTTP proxy: "
33+
)
34+
@REM Check the proxy variable here because of delayed expansion
35+
@IF NOT "%proxy%" == "" (
36+
@SET http_proxy=%proxy%
37+
@SET https_proxy=%proxy%
38+
)
39+
2540
@REM update the Pacman package indices first, then force-install msys2-runtime
2641
@REM (we ship with a stripped-down msys2-runtime, gpg and pacman), so that
2742
@REM pacman's post-install scripts run without complaining about heap problems
@@ -71,6 +86,16 @@
7186
CALL %cwd%\autorebase.bat
7287
)
7388

89+
@REM If an HTTP proxy is requires, configure it for Git Bash sessions,
90+
@REM but only if the environment variable was not already set globally
91+
@IF DEFINED proxy (
92+
@ECHO http_proxy=%proxy% > etc\profile.d\proxy.sh
93+
@ECHO https_proxy=%proxy% >> etc\profile.d\proxy.sh
94+
@ECHO export http_proxy https_proxy >> etc\profile.d\proxy.sh
95+
@ECHO.
96+
@ECHO Installed /etc/profile.d/proxy.sh to set proxy in Git Bash
97+
)
98+
7499
@REM Install shortcut on the desktop
75100
@bash --login -c 'SHORTCUT="$HOME/Desktop/Git SDK @@BITNESS@@-bit.lnk"; test -f "$SHORTCUT" ^|^| create-shortcut.exe --icon-file /msys2.ico --work-dir / /mingw@@BITNESS@@_shell.bat "$SHORTCUT"'
76101

0 commit comments

Comments
 (0)