Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
post-install.bat54 linesDownload Raw Back to git
1@REM This script is intended to be run after installation of Git for Windows
2@REM (including the portable version)
3
4@REM If run manually, it should be run via
5@REM   git-bash.exe --no-needs-console --hide --no-cd --command=post-install.bat
6@REM to hide the console.
7
8@REM Change to the directory in which this script lives.
9@REM https://technet.microsoft.com/en-us/library/bb490909.aspx says:
10@REM <percent>~dpI Expands <percent>I to a drive letter and path only.
11@REM <percent>~fI Expands <percent>I to a fully qualified path name.
12@FOR /F "delims=" %%D IN ("%~dp0") DO @CD %%~fD
13
14@SET /A "version=0" & FOR /F "tokens=2 delims=[]" %%i IN ('"VER"') DO @(
15	@FOR /F "tokens=2 delims=. " %%v IN ("%%~i") DO @(
16		@SET /A "version=%%~v + 0"
17	)
18)
19
20@REM If this is a 32-bit Git for Windows, adjust the DLL address ranges.
21@REM We cannot use %PROCESSOR_ARCHITECTURE% for this test because it is
22@REM allowed to install a 32-bit Git for Windows into a 64-bit system.
23@IF EXIST mingw32\bin\git.exe @(
24	@REM We need to rebase just to make sure that it still works even with
25	@REM 32-bit Windows 10
26	@IF %version% GEQ 10 @(
27		@REM We copy `rebase.exe` because it links to `msys-2.0.dll`
28		@REM (and @REM thus prevents modifying it). It is okay to
29		@REM execute `rebase.exe`, though, because the DLL base address
30		@REM problems only really show when other processes are
31		@REM `fork()`ed and `rebase.exe` does no such thing.
32		@IF NOT EXIST bin\rebase.exe @(
33			@IF NOT EXIST bin @MKDIR bin
34			@COPY usr\bin\rebase.exe bin\rebase.exe
35		)
36		@IF NOT EXIST bin\msys-2.0.dll @(
37			@COPY usr\bin\msys-2.0.dll bin\msys-2.0.dll
38		)
39		@bin\rebase.exe -b 0x64000000 usr\bin\msys-2.0.dll
40	)
41
42	usr\bin\dash.exe -c '/usr/bin/dash usr/bin/rebaseall -p'
43)
44
45@echo "running post-install"
46@REM Run the post-install scripts
47@usr\bin\bash.exe --norc -c "export PATH=/usr/bin:$PATH; export SYSCONFDIR=/etc; for p in $(export LC_COLLATE=C; echo /etc/post-install/*.post); do test -e \"$p\" && . \"$p\"; done"
48
49@REM Unset environment variables set by this script
50@SET "version="
51
52@REM Remove this script
53@DEL post-install.bat
54 
codekingpro/portable-devtools · Team Ai