|
8 | 8 | @FOR /F "delims=" %%D in ("%~dp0") do @set cwd=%%~fD |
9 | 9 |
|
10 | 10 | @REM set PATH |
11 | | -@set PATH=%cwd%\usr\bin;%PATH% |
12 | | - |
13 | | -@REM set MSYSTEM so that MSYS2 starts up in the correct mode |
14 | | -@set MSYSTEM=MINGW@@BITNESS@@ |
15 | | - |
16 | | -@REM need to rebase just to make sure that it still works even with Windows 10 |
17 | | -@SET initialrebase=false |
18 | | -@FOR /F "tokens=4 delims=.[XP " %%i IN ('ver') DO @SET ver=%%i |
19 | | -@IF 10 LEQ %ver% @( |
20 | | - @SET initialrebase=true |
21 | | -) |
22 | | - |
23 | | -@IF %initialrebase% == true @( |
24 | | - @REM we copy `rebase.exe` because it links to `msys-2.0.dll`. |
25 | | - @IF NOT EXIST "%cwd%"\bin\rebase.exe @( |
26 | | - @IF NOT EXIST "%cwd%"\bin @MKDIR "%cwd%"\bin |
27 | | - @COPY "%cwd%"\usr\bin\rebase.exe "%cwd%"\bin\rebase.exe |
28 | | - ) |
29 | | - @IF NOT EXIST bin\msys-2.0.dll @( |
30 | | - @COPY usr\bin\msys-2.0.dll bin\msys-2.0.dll |
31 | | - ) |
32 | | - @"%cwd%"\bin\rebase.exe -b 0x63000000 "%cwd%"\usr\bin\msys-2.0.dll |
33 | | -) |
34 | | - |
35 | | -@SET /A counter=0 |
36 | | -:INSTALL_RUNTIME |
37 | | -@SET /A counter+=1 |
38 | | -@IF %counter% GEQ 5 @( |
39 | | - @ECHO Could not install msys2-runtime |
40 | | - @PAUSE |
41 | | - @EXIT 1 |
42 | | -) |
43 | | - |
44 | | -@REM Maybe we need a proxy? |
45 | | -@IF %counter% GEQ 2 @( |
46 | | - @ECHO. |
47 | | - @ECHO There was a problem accessing the MSYS2 repositories |
48 | | - @ECHO If your setup requires an HTTP proxy to access the web, |
49 | | - @ECHO please specify it here, otherwise leave it empty. |
50 | | - @ECHO. |
51 | | - @SET /p proxy= "HTTP proxy: " |
52 | | -) |
53 | | -@REM Check the proxy variable here because of delayed expansion |
54 | | -@IF NOT "%proxy%" == "" @( |
55 | | - @SET http_proxy=%proxy% |
56 | | - @SET https_proxy=%proxy% |
57 | | - @IF %counter% EQU 2 @( |
58 | | - @COPY "%cwd%"\etc\pacman.conf.proxy "%cwd%"\etc\pacman.conf |
59 | | - ) |
60 | | -) |
61 | | - |
62 | | -@REM update the Pacman package indices first, then force-install msys2-runtime |
63 | | -@REM (we ship with a stripped-down msys2-runtime, gpg and pacman), so that |
64 | | -@REM pacman's post-install scripts run without complaining about heap problems |
65 | | -@"%cwd%"\usr\bin\pacman -Sy --needed --force --noconfirm msys2-runtime |
66 | | - |
67 | | -@REM need to rebase just to make sure that it still works even with Windows 10 |
68 | | -@IF %initialrebase% == true @( |
69 | | - @"%cwd%"\bin\rebase.exe -b 0x63000000 "%cwd%"\usr\bin\msys-2.0.dll |
70 | | -) |
71 | | - |
72 | | -@IF ERRORLEVEL 1 GOTO INSTALL_RUNTIME |
73 | | - |
74 | | -@SET /A counter=0 |
75 | | -:INSTALL_BASH |
76 | | -@SET /A counter+=1 |
77 | | -@IF %counter% GEQ 5 @( |
78 | | - @ECHO Could not install bash |
79 | | - @PAUSE |
80 | | - @EXIT 1 |
81 | | -) |
82 | | - |
83 | | -@REM next, force update bash |
84 | | -@"%cwd%"\usr\bin\pacman -S --needed --force --noconfirm bash |
85 | | - |
86 | | -@SET /A counter=0 |
87 | | -:INSTALL_INFO |
88 | | -@SET /A counter+=1 |
89 | | -@IF %counter% GEQ 5 @( |
90 | | - @ECHO Could not install info |
91 | | - @PAUSE |
92 | | - @EXIT 1 |
93 | | -) |
94 | | - |
95 | | -@REM we need a /tmp directory, just for the time being |
96 | | -@MKDIR "%cwd%"\tmp |
97 | | - |
98 | | -@REM next, initialize pacman's keyring |
99 | | -@"%cwd%"\usr\bin\bash.exe -l -c '/usr/bin/bash /usr/bin/pacman-key --init' |
100 | | -@IF ERRORLEVEL 1 PAUSE |
101 | | - |
102 | | -@REM next, force update info |
103 | | -@"%cwd%"\usr\bin\pacman -S --needed --force --noconfirm info |
104 | | - |
105 | | -@IF ERRORLEVEL 1 GOTO INSTALL_INFO |
106 | | - |
107 | | -@SET /A counter=0 |
108 | | -:INSTALL_MSYS2_KEYRING |
109 | | -@SET /A counter+=1 |
110 | | -@IF %counter% GEQ 5 @( |
111 | | - @ECHO Could not install msys2-keyring |
112 | | - @PAUSE |
113 | | - @EXIT 1 |
114 | | -) |
115 | | - |
116 | | -@REM next, force update msys2-keyring |
117 | | -@"%cwd%"\usr\bin\pacman -S --needed --force --noconfirm gnupg msys2-keyring |
118 | | - |
119 | | -@IF ERRORLEVEL 1 GOTO INSTALL_MSYS2_KEYRING |
120 | | - |
121 | | -@REM now, add Git for Windows' keyring |
122 | | -@"%cwd%"\usr\bin\bash.exe -l -c ^ |
123 | | - '/usr/bin/bash /usr/bin/pacman-key --populate git-for-windows' |
124 | | -@IF ERRORLEVEL 1 PAUSE |
125 | | - |
126 | | -@SET /A counter=0 |
127 | | -:INSTALL_PACMAN |
128 | | -@SET /A counter+=1 |
129 | | -@IF %counter% GEQ 5 @( |
130 | | - @ECHO Could not install pacman |
131 | | - @PAUSE |
132 | | - @EXIT 1 |
133 | | -) |
134 | | - |
135 | | -@REM next, force update pacman |
136 | | -@"%cwd%"\usr\bin\pacman -S --needed --force --noconfirm pacman |
137 | | - |
138 | | -@IF ERRORLEVEL 1 GOTO INSTALL_PACMAN |
139 | | - |
140 | | -@SET /A counter=0 |
141 | | -:INSTALL_REST |
142 | | -@SET /A counter+=1 |
143 | | -@IF %counter% GEQ 5 @( |
144 | | - @ECHO Could not install the remaining packages |
145 | | - @PAUSE |
146 | | - @EXIT 1 |
147 | | -) |
148 | | - |
149 | | -@REM now update the rest |
150 | | -@"%cwd%"\usr\bin\pacman -S --needed --force --noconfirm ^ |
151 | | - base python less openssh patch make tar diffutils ca-certificates ^ |
152 | | - git perl-Error perl perl-Authen-SASL perl-libwww perl-MIME-tools ^ |
153 | | - perl-Net-SMTP-SSL perl-TermReadKey dos2unix asciidoc xmlto ^ |
154 | | - subversion mintty vim git-extra p7zip markdown winpty ^ |
155 | | - mingw-w64-@@ARCH@@-git-doc-html ^ |
156 | | - mingw-w64-@@ARCH@@-git mingw-w64-@@ARCH@@-toolchain ^ |
157 | | - mingw-w64-@@ARCH@@-curl mingw-w64-@@ARCH@@-expat ^ |
158 | | - mingw-w64-@@ARCH@@-openssl mingw-w64-@@ARCH@@-tcl ^ |
159 | | - mingw-w64-@@ARCH@@-pcre mingw-w64-@@ARCH@@-connect ^ |
160 | | - git-flow ssh-pageant tig |
161 | | - |
162 | | -@IF ERRORLEVEL 1 GOTO INSTALL_REST |
| 11 | +@set PATH=%cwd%\mini\mingw@@BITNESS@@\bin;%PATH% |
| 12 | + |
| 13 | +@ECHO Cloning the Git for Windows SDK... |
| 14 | +@git init |
| 15 | +@IF ERRORLEVEL 1 GOTO DIE |
| 16 | +@git config http.sslbackend schannel |
| 17 | +@IF ERRORLEVEL 1 GOTO DIE |
| 18 | +@git remote add origin @@GIT_SDK_URL@@ |
| 19 | +@IF ERRORLEVEL 1 GOTO DIE |
| 20 | +@git fetch --depth 1 origin |
| 21 | +@IF ERRORLEVEL 1 GOTO DIE |
| 22 | +@git checkout -t origin/master |
| 23 | +@IF ERRORLEVEL 1 GOTO DIE |
| 24 | + |
| 25 | +@REM Cleaning up temporary git.exe |
| 26 | +@RMDIR /Q /S %cwd%\mini |
| 27 | +@IF ERRORLEVEL 1 GOTO DIE |
163 | 28 |
|
164 | 29 | @REM Avoid overlapping address ranges |
165 | | -@IF MINGW32 == %MSYSTEM% @( |
| 30 | +@IF 32 == @@BITNESS@@ @( |
166 | 31 | ECHO Auto-rebasing .dll files |
167 | 32 | CALL "%cwd%"\autorebase.bat |
168 | 33 | ) |
169 | 34 |
|
170 | | -@REM If an HTTP proxy is required, configure it for Git Bash sessions, |
171 | | -@REM but only if the environment variable was not already set globally |
172 | | -@IF DEFINED proxy @( |
173 | | - @ECHO http_proxy=%proxy% > etc\profile.d\proxy.sh |
174 | | - @ECHO https_proxy=%proxy% >> etc\profile.d\proxy.sh |
175 | | - @ECHO export http_proxy https_proxy >> etc\profile.d\proxy.sh |
176 | | - @ECHO. |
177 | | - @ECHO Installed /etc/profile.d/proxy.sh to set proxy in Git Bash |
178 | | -) |
179 | | - |
180 | 35 | @REM Before running a shell, let's prevent complaints about "permission denied" |
181 | 36 | @REM from MSYS2's /etc/post-install/01-devices.post |
182 | 37 | @MKDIR "%cwd%"\dev\shm 2> NUL |
183 | 38 | @MKDIR "%cwd%"\dev\mqueue 2> NUL |
184 | 39 |
|
185 | | -@IF NOT DEFINED JENKINS_URL @( |
186 | | - @REM Install shortcut on the desktop |
187 | | - @ECHO. |
188 | | - @ECHO Installing the 'Git SDK @@BITNESS@@-bit' shortcut on the Desktop |
189 | | - @bash --login -c 'SHORTCUT="$HOME/Desktop/Git SDK @@BITNESS@@-bit.lnk"; test -f "$SHORTCUT" ^|^| create-shortcut.exe --icon-file /msys2.ico --work-dir / /git-bash.exe "$SHORTCUT"' |
| 40 | +@START /B %cwd%\git-bash.exe |
| 41 | +@EXIT /B 0 |
190 | 42 |
|
191 | | - @REM now clone the Git sources, build it, and start an interactive shell |
192 | | - @bash --login -c "mkdir -p /usr/src && cd /usr/src && for project in MINGW-packages MSYS2-packages build-extra; do test ! -d $project && mkdir -p $project && (cd $project && git init && git config core.autocrlf false && git remote add origin https://github.com/git-for-windows/$project); done; if test ! -d git; then git clone -b @@GIT_BRANCH@@ -c core.autocrlf=false --depth 1 https://github.com/git-for-windows/git; fi && cd git && make install" |
| 43 | +:DIE |
| 44 | +@ECHO Installation of Git for Windows' SDK failed! |
| 45 | +@PAUSE |
| 46 | +@EXIT /B 1 |
193 | 47 |
|
194 | | - @IF ERRORLEVEL 1 PAUSE |
195 | | - |
196 | | - @start mintty -i /msys2.ico -t "Git SDK @@BITNESS@@-bit" bash --login -i |
197 | | -) |
0 commit comments