Skip to content

Commit

Permalink
net installer: ask for an HTTP proxy upon pacman failure
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dscho committed Mar 28, 2015
1 parent 143a81c commit 783f742
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions net-installer/setup-git-sdk.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@
@EXIT 1
)

@REM Maybe we need a proxy?
@IF %counter% GEQ 2 (
@ECHO.
@ECHO There was a problem accessing the MSys2 repositories
@ECHO If your setup requires an HTTP proxy to access the web,
@ECHO please specify it here, otherwise leave it empty.
@ECHO.
@SET /p proxy= "HTTP proxy: "
)
@REM Check the proxy variable here because of delayed expansion
@IF NOT "%proxy%" == "" (
@SET http_proxy=%proxy%
@SET https_proxy=%proxy%
)

@REM update the Pacman package indices first, then force-install msys2-runtime
@REM (we ship with a stripped-down msys2-runtime, gpg and pacman), so that
@REM pacman's post-install scripts run without complaining about heap problems
Expand Down Expand Up @@ -71,6 +86,16 @@
CALL %cwd%\autorebase.bat
)

@REM If an HTTP proxy is requires, configure it for Git Bash sessions,
@REM but only if the environment variable was not already set globally
@IF DEFINED proxy (
@ECHO http_proxy=%proxy% > etc\profile.d\proxy.sh
@ECHO https_proxy=%proxy% >> etc\profile.d\proxy.sh
@ECHO export http_proxy https_proxy >> etc\profile.d\proxy.sh
@ECHO.
@ECHO Installed /etc/profile.d/proxy.sh to set proxy in Git Bash
)

@REM Install shortcut on the desktop
@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"'

Expand Down

0 comments on commit 783f742

Please sign in to comment.