Skip to content

Commit e37f415

Browse files
committed
sdk-installer: support NTLM proxies
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]>
1 parent eb38165 commit e37f415

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

sdk-installer/release.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ OPTS7="-m0=lzma -mx=9 -md=64M"
3434
TMPPACK=/tmp.7z
3535
SCRIPT_PATH="$(cd "$(dirname "$0")" && pwd)"
3636

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

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

47+
cp /usr/bin/dash.exe "$FAKEROOTDIR/usr/bin/sh.exe" &&
48+
sed -e 's/^#\(XferCommand.*curl\).*/\1 --anyauth -C - -s -L -f %u >%o/' \
49+
</etc/pacman.conf >"$FAKEROOTDIR/etc/pacman.conf.proxy" ||
50+
die "Could not copy extra files into fake root"
51+
4752
fileList="$(cd / && echo \
4853
etc/pacman.* \
49-
usr/bin/gpg.exe \
5054
usr/bin/pacman.exe \
51-
$(ldd /usr/bin/gpg.exe |
52-
sed -n 's/.* \/\(usr\/bin\/.*\.dll\) .*/\1/p') \
53-
usr/bin/msys-crypto-*.dll \
54-
usr/bin/msys-ssl-*.dll \
55+
usr/bin/curl.exe \
56+
usr/bin/gpg.exe \
57+
$(ldd /usr/bin/gpg.exe /usr/bin/curl.exe |
58+
sed -n 's/.* \/\(usr\/bin\/.*\.dll\) .*/\1/p' |
59+
sort |
60+
uniq) \
5561
usr/ssl/certs/ca-bundle.crt \
5662
var/lib/pacman)
57-
$FAKEROOTDIR/setup-git-sdk.bat"
63+
$FAKEROOTDIR/setup-git-sdk.bat $FAKEROOTDIR/etc $FAKEROOTDIR/usr"
5864

5965
type 7za ||
6066
pacman -Sy --noconfirm p7zip ||

sdk-installer/setup-git-sdk.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
@IF NOT "%proxy%" == "" @(
3636
@SET http_proxy=%proxy%
3737
@SET https_proxy=%proxy%
38+
@IF %counter% EQU 2 @(
39+
@COPY "%cwd%"\etc\pacman.conf.proxy "%cwd%"\etc\pacman.conf
40+
)
3841
)
3942

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

0 commit comments

Comments
 (0)