forked from analogdevicesinc/scopy-mingw-build-deps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmsys_mirrors.sh
24 lines (22 loc) · 911 Bytes
/
msys_mirrors.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/bash.exe
PACMAN_INIT="$1"
export PATH=/bin:/usr/bin:/${MINGW_VERSION}/bin:/c/Program\ Files/Git/cmd:/c/Windows/System32
mirrorlist=$( cat /etc/pacman.d/mirrorlist.msys | grep "Server = " | cut -d ' ' -f3 | /c/msys64/usr/bin/rev | cut -d '/' -f4- | /c/msys64/usr/bin/rev )
for m in $mirrorlist
do
response=$(curl -Is $m | grep HTTP | cut -d ' ' -f2)
if [[ $response != "" ]]
then
MSYS_MIRROR=$m
break
fi
done
export MSYS_MIRROR=$MSYS_MIRROR
if [ "$PACMAN_INIT" == "true" ] ; then
pacman --noconfirm -U $MSYS_MIRROR/msys/x86_64/pacman-5.2.2-1-x86_64.pkg.tar.xz
curl -O $MSYS_MIRROR/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
curl -O $MSYS_MIRROR/msys/x86_64/msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz.sig
pacman-key --verify msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz{.sig,}
pacman-key --populate
pacman --noconfirm -U msys2-keyring-r21.b39fb11-1-any.pkg.tar.xz
fi