Skip to content

Commit

Permalink
sdk-installer: support NTLM proxies
Browse files Browse the repository at this point in the history
When Pacman needs to be told to use a proxy, it actually needs to use a
helper because Pacman's HTTP support has no clues about authentication:
the proxy might require NTLM (or other) authentication.

So let's ship with cURL, and fall back to using it with the `--anyauth`
option.

This fixes git-for-windows/git#309

Signed-off-by: Johannes Schindelin <[email protected]>
  • Loading branch information
dscho committed Aug 26, 2015
1 parent eb38165 commit e37f415
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
20 changes: 13 additions & 7 deletions sdk-installer/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ OPTS7="-m0=lzma -mx=9 -md=64M"
TMPPACK=/tmp.7z
SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd)"

mkdir -p "$FAKEROOTDIR" ||
mkdir -p "$FAKEROOTDIR/usr/bin" "$FAKEROOTDIR/etc" ||
die "Could not create fake root directory"

sed -e "s|@@ARCH@@|$ARCH|g" \
Expand All @@ -44,17 +44,23 @@ sed -e "s|@@ARCH@@|$ARCH|g" \
<"$SCRIPT_PATH"/setup-git-sdk.bat >"$FAKEROOTDIR"/setup-git-sdk.bat ||
die "Could not generate setup script"

cp /usr/bin/dash.exe "$FAKEROOTDIR/usr/bin/sh.exe" &&
sed -e 's/^#\(XferCommand.*curl\).*/\1 --anyauth -C - -s -L -f %u >%o/' \
</etc/pacman.conf >"$FAKEROOTDIR/etc/pacman.conf.proxy" ||
die "Could not copy extra files into fake root"

fileList="$(cd / && echo \
etc/pacman.* \
usr/bin/gpg.exe \
usr/bin/pacman.exe \
$(ldd /usr/bin/gpg.exe |
sed -n 's/.* \/\(usr\/bin\/.*\.dll\) .*/\1/p') \
usr/bin/msys-crypto-*.dll \
usr/bin/msys-ssl-*.dll \
usr/bin/curl.exe \
usr/bin/gpg.exe \
$(ldd /usr/bin/gpg.exe /usr/bin/curl.exe |
sed -n 's/.* \/\(usr\/bin\/.*\.dll\) .*/\1/p' |
sort |
uniq) \
usr/ssl/certs/ca-bundle.crt \
var/lib/pacman)
$FAKEROOTDIR/setup-git-sdk.bat"
$FAKEROOTDIR/setup-git-sdk.bat $FAKEROOTDIR/etc $FAKEROOTDIR/usr"

type 7za ||
pacman -Sy --noconfirm p7zip ||
Expand Down
3 changes: 3 additions & 0 deletions sdk-installer/setup-git-sdk.bat
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
@IF NOT "%proxy%" == "" @(
@SET http_proxy=%proxy%
@SET https_proxy=%proxy%
@IF %counter% EQU 2 @(
@COPY "%cwd%"\etc\pacman.conf.proxy "%cwd%"\etc\pacman.conf
)
)

@REM update the Pacman package indices first, then force-install msys2-runtime
Expand Down

0 comments on commit e37f415

Please sign in to comment.