OLD | NEW |
1 @echo off | 1 @echo off |
2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 :: Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 :: Use of this source code is governed by a BSD-style license that can be | 3 :: Use of this source code is governed by a BSD-style license that can be |
4 :: found in the LICENSE file. | 4 :: found in the LICENSE file. |
5 | 5 |
6 :: This script will try to find if svn and python are accessible and it not, | 6 :: This script will try to find if svn and python are accessible and it not, |
7 :: it will try to download it and 'install' it in depot_tools. | 7 :: it will try to download it and 'install' it in depot_tools. |
8 | 8 |
9 :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly | 9 :: Sadly, we can't use SETLOCAL here otherwise it ERRORLEVEL is not correctly |
10 :: returned. | 10 :: returned. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 :: Clean up any release which doesn't match the one we want. | 82 :: Clean up any release which doesn't match the one we want. |
83 for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do ( | 83 for /d %%i in ("%WIN_TOOLS_ROOT_DIR%\git-*_bin") do ( |
84 if not "%%i" == "%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin" ( | 84 if not "%%i" == "%WIN_TOOLS_ROOT_DIR%\git-%GIT_VERSION%_bin" ( |
85 echo Cleaning old git installation %%i | 85 echo Cleaning old git installation %%i |
86 rmdir /s /q "%%i" | 86 rmdir /s /q "%%i" |
87 ) | 87 ) |
88 ) | 88 ) |
89 | 89 |
90 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL | 90 if "%WIN_TOOLS_FORCE%" == "1" goto :GIT_INSTALL |
91 | 91 |
92 if exist "%GIT_EXE_PATH%" ( | 92 if not exist "%GIT_EXE_PATH%" goto :GIT_INSTALL |
93 call "%GIT_EXE_PATH%" --version 2>nul 1>nul | 93 |
94 if errorlevel 1 goto :GIT_INSTALL | 94 call "%GIT_EXE_PATH%" --version 2>nul 1>nul |
95 rem Several git versions can live side-by-side; check the top-level | 95 if errorlevel 1 goto :GIT_INSTALL |
96 rem batch script to make sure it points to the desired version. | 96 |
97 find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\git.bat" 2>nul 1>nul | 97 :: Several git versions can live side-by-side; check the top-level |
| 98 :: batch script to make sure it points to the desired version. |
| 99 for %%f in (git.bat gitk.bat ssh.bat ssh-keygen.bat git-bash) do ( |
| 100 find "%GIT_BIN_DIR%" "%WIN_TOOLS_ROOT_DIR%\%%f" 2>nul 1>nul |
98 if errorlevel 1 goto :GIT_MAKE_BATCH_FILES | 101 if errorlevel 1 goto :GIT_MAKE_BATCH_FILES |
99 goto :SYNC_GIT_HELP_FILES | |
100 ) | 102 ) |
| 103 goto :SYNC_GIT_HELP_FILES |
101 | 104 |
102 :GIT_INSTALL | 105 :GIT_INSTALL |
103 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... | 106 echo Installing git %GIT_VERSION% (avg 1-2 min download) ... |
104 | 107 |
105 if exist "%GIT_DOWNLOAD_PATH%" del "%GIT_DOWNLOAD_PATH%" | 108 if exist "%GIT_DOWNLOAD_PATH%" del "%GIT_DOWNLOAD_PATH%" |
106 echo Fetching from %GIT_FETCH_URL% | 109 echo Fetching from %GIT_FETCH_URL% |
107 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_FETCH_URL% "%GIT_DOWNLOAD_P
ATH%" | 110 cscript //nologo //e:jscript "%~dp0get_file.js" %GIT_FETCH_URL% "%GIT_DOWNLOAD_P
ATH%" |
108 if errorlevel 1 goto :GIT_FAIL | 111 if errorlevel 1 goto :GIT_FAIL |
109 :: Cleanup git directory if it already exists. | 112 :: Cleanup git directory if it already exists. |
110 if exist "%GIT_INST_DIR%\." rd /q /s "%GIT_INST_DIR%" | 113 if exist "%GIT_INST_DIR%\." rd /q /s "%GIT_INST_DIR%" |
111 | 114 |
112 :: run PortableGit self-extractor | 115 :: run PortableGit self-extractor |
113 :: -y : Be Quiet ("yes") | 116 :: -y : Be Quiet ("yes") |
114 :: -sd1 : Self delete SFX archive | 117 :: -sd1 : Self delete SFX archive |
115 :: -InstallPath : Where to put the files | 118 :: -InstallPath : Where to put the files |
116 :: -Directory : Run the post-extract program with this current-working-directory | 119 :: -Directory : Run the post-extract program with this current-working-directory |
117 call "%GIT_DOWNLOAD_PATH%" -y -sd1 -InstallPath="%GIT_INST_DIR%" -Directory="%GI
T_INST_DIR%" | 120 call "%GIT_DOWNLOAD_PATH%" -y -sd1 -InstallPath="%GIT_INST_DIR%" -Directory="%GI
T_INST_DIR%" |
118 if errorlevel 1 goto :GIT_FAIL | 121 if errorlevel 1 goto :GIT_FAIL |
119 | 122 |
120 del "%GIT_DOWNLOAD_PATH%" | 123 del "%GIT_DOWNLOAD_PATH%" |
121 if not exist "%GIT_INST_DIR%\." goto :GIT_FAIL | 124 if not exist "%GIT_INST_DIR%\." goto :GIT_FAIL |
122 | 125 |
123 :GIT_MAKE_BATCH_FILES | 126 :GIT_MAKE_BATCH_FILES |
124 :: Create the batch files. | 127 :: Create the batch files. |
125 set GIT_TEMPL=%~dp0git.template.bat | 128 set GIT_TEMPL=%~dp0git.template.bat |
126 set SED=%GIT_INST_DIR%\usr\bin\sed.exe | 129 set SED=%GIT_INST_DIR%\usr\bin\sed.exe |
127 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/cmd\\\\git.exe/
" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\git.bat" | 130 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/GIT_PROGRAM/cmd\\\\git.exe
/g" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\git.bat" |
128 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/cmd\\\\gitk.exe
/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\gitk.bat" | 131 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/GIT_PROGRAM/cmd\\\\gitk.ex
e/g" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\gitk.bat" |
129 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/usr\\\\bin\\\\s
sh.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh.bat" | 132 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/GIT_PROGRAM/usr\\\\bin\\\\
ssh.exe/g" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh.bat" |
130 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/" -e "s/GIT_PROGRAM/usr\\\\bin\\\\s
sh-keygen.exe/" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh-keygen.bat" | 133 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/GIT_PROGRAM/usr\\\\bin\\\\
ssh-keygen.exe/g" < %GIT_TEMPL% > "%WIN_TOOLS_ROOT_DIR%\ssh-keygen.bat" |
| 134 call "%SED%" -e "s/GIT_BIN_DIR/%GIT_BIN_DIR%/g" -e "s/PYTHON_BIN_DIR/python276_b
in/g" -e "s/SVN_BIN_DIR/svn_bin/g" < %~dp0git-bash.template.sh > "%WIN_TOOLS_ROO
T_DIR%\git-bash" |
131 | 135 |
132 :: Ensure various git configurations are set correctly at they system level. | 136 :: Ensure various git configurations are set correctly at they system level. |
133 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false | 137 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.autocrlf false |
134 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.filemode false | 138 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.filemode false |
135 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.preloadindex true | 139 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.preloadindex true |
136 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.fscache true | 140 call "%WIN_TOOLS_ROOT_DIR%\git.bat" config --system core.fscache true |
137 | 141 |
138 :SYNC_GIT_HELP_FILES | 142 :SYNC_GIT_HELP_FILES |
139 :: Copy all the depot_tools docs into the mingw64 git docs root. | 143 :: Copy all the depot_tools docs into the mingw64 git docs root. |
140 :: /i : Make sure xcopy knows that the destination names a folder, not a file | 144 :: /i : Make sure xcopy knows that the destination names a folder, not a file |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 goto :END | 196 goto :END |
193 | 197 |
194 | 198 |
195 :returncode | 199 :returncode |
196 set WIN_TOOLS_ROOT_URL= | 200 set WIN_TOOLS_ROOT_URL= |
197 set WIN_TOOLS_ROOT_DIR= | 201 set WIN_TOOLS_ROOT_DIR= |
198 exit /b %ERRORLEVEL% | 202 exit /b %ERRORLEVEL% |
199 | 203 |
200 :END | 204 :END |
201 call :returncode %ERRORLEVEL% | 205 call :returncode %ERRORLEVEL% |
OLD | NEW |