forked from git-for-windows/build-extra
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.iss
1894 lines (1672 loc) · 73.2 KB
/
install.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
; Uncomment the line below to be able to compile the script from within the IDE.
;#define COMPILE_FROM_IDE
#include "config.iss"
#if !defined(APP_VERSION) || !defined(BITNESS)
#error "config.iss should define APP_VERSION and BITNESS"
#endif
#define APP_NAME 'Git'
#ifdef COMPILE_FROM_IDE
#undef APP_VERSION
#define APP_VERSION 'Snapshot'
#endif
#define MINGW_BITNESS 'mingw'+BITNESS
#define APP_CONTACT_URL 'https://github.com/git-for-windows/git/wiki/Contact'
#define APP_URL 'https://git-for-windows.github.io/'
#define APP_BUILTINS 'share\git\builtins.txt'
#define APP_BINDIMAGE 'share\git\bindimage.txt'
#define PLINK_PATH_ERROR_MSG 'Please enter a valid path to a Plink executable.'
#define DROP_HANDLER_GUID '{{60254CA5-953B-11CF-8C96-00AA00B8708C}'
[Setup]
; Compiler-related
Compression=lzma2/ultra64
LZMAUseSeparateProcess=yes
#ifdef OUTPUT_TO_TEMP
OutputBaseFilename={#APP_VERSION}
OutputDir={#GetEnv('TEMP')}
#else
OutputBaseFilename={#APP_NAME+'-'+APP_VERSION}-{#BITNESS}-bit
OutputDir={#GetEnv('USERPROFILE')}
#endif
SolidCompression=yes
SourceDir={#SourcePath}\..\..\..\..
#if BITNESS=='64'
ArchitecturesInstallIn64BitMode=x64
#endif
#ifdef SIGNTOOL
SignTool=signtool
#endif
; Installer-related
AllowNoIcons=yes
AppName={#APP_NAME}
AppPublisher=The Git Development Community
AppPublisherURL={#APP_URL}
AppSupportURL={#APP_CONTACT_URL}
AppVersion={#APP_VERSION}
ChangesAssociations=yes
ChangesEnvironment=yes
CloseApplications=no
DefaultDirName={pf}\{#APP_NAME}
DisableDirPage=auto
DefaultGroupName={#APP_NAME}
DisableProgramGroupPage=auto
DisableReadyPage=yes
InfoBeforeFile={#SourcePath}\gpl-2.0.rtf
#ifdef OUTPUT_TO_TEMP
PrivilegesRequired=lowest
#else
PrivilegesRequired=none
#endif
UninstallDisplayIcon={app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
#ifndef COMPILE_FROM_IDE
#if Pos('-',APP_VERSION)>0
VersionInfoVersion={#Copy(APP_VERSION,1,Pos('-',APP_VERSION)-1)}
#else
VersionInfoVersion={#APP_VERSION}
#endif
#endif
; Cosmetic
SetupIconFile={#SourcePath}\git.ico
WizardImageBackColor=clWhite
WizardImageStretch=no
WizardImageFile={#SourcePath}\git.bmp
WizardSmallImageFile={#SourcePath}\gitsmall.bmp
MinVersion=0,5.01sp3
[Types]
; Define a custom type to avoid getting the three default types.
Name: default; Description: Default installation; Flags: iscustom
[Components]
Name: icons; Description: Additional icons
Name: icons\quicklaunch; Description: In the Quick Launch; Check: not IsAdminLoggedOn
Name: icons\desktop; Description: On the Desktop
Name: ext; Description: Windows Explorer integration; Types: default
Name: ext\shellhere; Description: Git Bash Here; Types: default
Name: ext\guihere; Description: Git GUI Here; Types: default
Name: assoc; Description: Associate .git* configuration files with the default text editor; Types: default
Name: assoc_sh; Description: Associate .sh files to be run with Bash; Types: default
Name: consolefont; Description: Use a TrueType font in all console windows
[Files]
; Install files that might be in use during setup under a different name.
#include "file-list.iss"
Source: {#SourcePath}\ReleaseNotes.html; DestDir: {app}; Flags: isreadme replacesameversion; AfterInstall: DeleteFromVirtualStore
Source: {#SourcePath}\LICENSE.txt; DestDir: {app}; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore
Source: {#SourcePath}\NOTICE.txt; DestDir: {app}; Flags: replacesameversion; AfterInstall: DeleteFromVirtualStore; Check: ParamIsSet('VSNOTICE')
Source: {#SourcePath}\edit-git-bash.dll; Flags: dontcopy
[Dirs]
Name: "{app}\tmp"
[Icons]
Name: {group}\Git GUI; Filename: {app}\cmd\git-gui.exe; Parameters: ""; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
Name: {group}\Git Bash; Filename: {app}\git-bash.exe; Parameters: "--cd-to-home"; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
Name: {group}\Git CMD; Filename: {app}\git-cmd.exe; Parameters: "--cd-to-home"; WorkingDir: %HOMEDRIVE%%HOMEPATH%; IconFilename: {app}\{#MINGW_BITNESS}\share\git\git-for-windows.ico
[Messages]
BeveledLabel={#APP_URL}
SetupAppTitle={#APP_NAME} {#APP_VERSION} Setup
SetupWindowTitle={#APP_NAME} {#APP_VERSION} Setup
[Registry]
; Aides installing third-party (credential, remote, etc) helpers
Root: HKLM; Subkey: Software\GitForWindows; ValueType: string; ValueName: CurrentVersion; ValueData: {#APP_VERSION}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn
Root: HKLM; Subkey: Software\GitForWindows; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn
Root: HKLM; Subkey: Software\GitForWindows; ValueType: string; ValueName: LibexecPath; ValueData: {app}\{#MINGW_BITNESS}\libexec\git-core; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn
Root: HKCU; Subkey: Software\GitForWindows; ValueType: string; ValueName: CurrentVersion; ValueData: {#APP_VERSION}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: Software\GitForWindows; ValueType: string; ValueName: InstallPath; ValueData: {app}; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn
Root: HKCU; Subkey: Software\GitForWindows; ValueType: string; ValueName: LibexecPath; ValueData: {app}\{#MINGW_BITNESS}\libexec\git-core; Flags: uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn
; There is no "Console" key in HKLM.
Root: HKCU; Subkey: Console; ValueType: string; ValueName: FaceName; ValueData: Lucida Console; Flags: uninsclearvalue; Components: consolefont
Root: HKCU; Subkey: Console; ValueType: dword; ValueName: FontFamily; ValueData: $00000036; Components: consolefont
Root: HKCU; Subkey: Console; ValueType: dword; ValueName: FontSize; ValueData: $000e0000; Components: consolefont
Root: HKCU; Subkey: Console; ValueType: dword; ValueName: FontWeight; ValueData: $00000190; Components: consolefont
Root: HKCU; Subkey: Console\Git Bash; ValueType: string; ValueName: FaceName; ValueData: Lucida Console; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git Bash; ValueType: dword; ValueName: FontFamily; ValueData: $00000036; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git Bash; ValueType: dword; ValueName: FontSize; ValueData: $000e0000; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git Bash; ValueType: dword; ValueName: FontWeight; ValueData: $00000190; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: string; ValueName: FaceName; ValueData: Lucida Console; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: dword; ValueName: FontFamily; ValueData: $00000036; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: dword; ValueName: FontSize; ValueData: $000e0000; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
Root: HKCU; Subkey: Console\Git CMD; ValueType: dword; ValueName: FontWeight; ValueData: $00000190; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty
; Note that we write the Registry values below either to HKLM or to HKCU depending on whether the user running the installer
; is a member of the local Administrators group or not (see the "Check" argument).
; File associations for configuration files that may be contained in a repository (so this does not include ".gitconfig").
Root: HKLM; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitattributes; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitignore; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitignore; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitignore; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKLM; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueData: txtfile; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: Content Type; ValueData: text/plain; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
Root: HKCU; Subkey: Software\Classes\.gitmodules; ValueType: string; ValueName: PerceivedType; ValueData: text; Flags: createvalueifdoesntexist uninsdeletevalue uninsdeletekeyifempty; Check: not IsAdminLoggedOn; Components: assoc
; Associate .sh extension with sh.exe so those files are double-clickable,
; startable from cmd.exe, and when files are dropped on them they are passed
; as arguments to the script.
; Install under HKEY_LOCAL_MACHINE if an administrator is installing.
Root: HKLM; Subkey: Software\Classes\.sh; ValueType: string; ValueData: sh_auto_file; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file; ValueType: string; ValueData: "Shell Script"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file\shell\open\command; ValueType: string; ValueData: """{app}\git-bash.exe"" --no-cd ""%L"" %*"; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file\DefaultIcon; ValueType: string; ValueData: "%SystemRoot%\System32\shell32.dll,-153"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
Root: HKLM; Subkey: Software\Classes\sh_auto_file\ShellEx\DropHandler; ValueType: string; ValueData: {#DROP_HANDLER_GUID}; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: IsAdminLoggedOn; Components: assoc_sh
; Install under HKEY_CURRENT_USER if a non-administrator is installing.
Root: HKCU; Subkey: Software\Classes\.sh; ValueType: string; ValueData: sh_auto_file; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file; ValueType: string; ValueData: "Shell Script"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file\shell\open\command; ValueType: string; ValueData: """{app}\git-bash.exe"" --no-cd ""%L"" %*"; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file\DefaultIcon; ValueType: string; ValueData: "%SystemRoot%\System32\shell32.dll,-153"; Flags: createvalueifdoesntexist uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
Root: HKCU; Subkey: Software\Classes\sh_auto_file\ShellEx\DropHandler; ValueType: string; ValueData: {#DROP_HANDLER_GUID}; Flags: uninsdeletekeyifempty uninsdeletevalue; Check: not IsAdminLoggedOn; Components: assoc_sh
[UninstallDelete]
; Delete the built-ins.
Type: files; Name: {app}\{#MINGW_BITNESS}\bin\git-*.exe
Type: files; Name: {app}\{#MINGW_BITNESS}\libexec\git-core\git-*.exe
Type: files; Name: {app}\{#MINGW_BITNESS}\libexec\git-core\git.exe
; Delete copied *.dll files
Type: files; Name: {app}\{#MINGW_BITNESS}\libexec\git-core\*.dll
; Delete the dynamical generated MSYS2 files
Type: files; Name: {app}\etc\hosts
Type: files; Name: {app}\etc\mtab
Type: files; Name: {app}\etc\networks
Type: files; Name: {app}\etc\protocols
Type: files; Name: {app}\etc\services
Type: files; Name: {app}\dev\fd
Type: files; Name: {app}\dev\stderr
Type: files; Name: {app}\dev\stdin
Type: files; Name: {app}\dev\stdout
Type: dirifempty; Name: {app}\dev\mqueue
Type: dirifempty; Name: {app}\dev\shm
Type: dirifempty; Name: {app}\dev
; Delete any manually created shortcuts.
Type: files; Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\Git Bash.lnk
Type: files; Name: {code:GetShellFolder|desktop}\Git Bash.lnk
Type: files; Name: {app}\Git Bash.lnk
; Delete a home directory inside the Git for Windows directory.
Type: dirifempty; Name: {app}\home\{username}
Type: dirifempty; Name: {app}\home
#if BITNESS=='32'
; Delete the files required for rebaseall
Type: files; Name: {app}\bin\msys-2.0.dll
Type: files; Name: {app}\bin\rebase.exe
Type: dirifempty; Name: {app}\bin
Type: files; Name: {app}\etc\rebase.db.i386
Type: dirifempty; Name: {app}\etc
#endif
; Delete recorded install options
Type: files; Name: {app}\etc\install-options.txt
Type: dirifempty; Name: {app}\etc
[Code]
#include "helpers.inc.iss"
#include "environment.inc.iss"
#include "putty.inc.iss"
#include "modules.inc.iss"
procedure LogError(Msg:String);
begin
SuppressibleMsgBox(Msg,mbError,MB_OK,IDOK);
Log(Msg);
end;
function ParamIsSet(Key:String):Boolean;
begin
Result:=CompareStr('0',ExpandConstant('{param:'+Key+'|0}'))<>0;
end;
function CreateHardLink(lpFileName,lpExistingFileName:String;lpSecurityAttributes:Integer):Boolean;
#ifdef UNICODE
external '[email protected] stdcall delayload setuponly';
#else
external '[email protected] stdcall delayload setuponly';
#endif
function EditGitBash(ExePath:WideString;Resource:WideString):Integer;
external 'edit_git_bash@files:edit-git-bash.dll stdcall delayload setuponly';
function OverrideGitBashCommandLine(GitBashPath:String;CommandLine:String):Integer;
var
Msg:String;
begin
Result:=EditGitBash(GitBashPath,CommandLine);
if Result<>0 then begin
if Result=1 then begin
Msg:='Unable to edit '+GitBashPath+' (out of memory).';
end else if Result=2 then begin
Msg:='Unable to open '+GitBashPath+' for editing.';
end else if Result=3 then begin
Msg:='Unable to edit the command-line of '+GitBashPath+'.';
end else if Result=4 then begin
Msg:='Unable to close '+GitBashPath+' after editing.';
end;
LogError(Msg);
end;
end;
function BindImageEx(Flags:DWORD;ImageName,DllPath,SymbolPath:AnsiString;StatusRoutine:Integer):Boolean;
external '[email protected] stdcall delayload setuponly';
const
// Git Path options.
GP_BashOnly = 1;
GP_Cmd = 2;
GP_CmdTools = 3;
// Git SSH options.
GS_OpenSSH = 1;
GS_Plink = 2;
// Git line ending conversion options.
GC_LFOnly = 1;
GC_CRLFAlways = 2;
GC_CRLFCommitAsIs = 3;
// Git Bash terminal settings.
GB_MinTTY = 1;
GB_ConHost = 2;
// Extra options
GP_FSCache = 1;
GP_GCM = 2;
// BindImageEx API constants.
BIND_NO_BOUND_IMPORTS = $00000001;
BIND_NO_UPDATE = $00000002;
BIND_ALL_IMAGES = $00000004;
BIND_CACHE_IMPORT_DLLS = $00000008;
var
// The options chosen at install time, to be written to /etc/install-options.txt
ChosenOptions:String;
// Wizard page and variables for the Path options.
PathPage:TWizardPage;
RdbPath:array[GP_BashOnly..GP_CmdTools] of TRadioButton;
// Wizard page and variables for the SSH options.
PuTTYPage:TWizardPage;
RdbSSH:array[GS_OpenSSH..GS_Plink] of TRadioButton;
EdtPlink:TEdit;
// Wizard page and variables for the line ending conversion options.
CRLFPage:TWizardPage;
RdbCRLF:array[GC_LFOnly..GC_CRLFCommitAsIs] of TRadioButton;
// Wizard page and variables for the terminal emulator settings.
BashTerminalPage:TWizardPage;
RdbBashTerminal:array[GB_MinTTY..GB_ConHost] of TRadioButton;
// Wizard page and variables for the extra options.
ExtraOptionsPage:TWizardPage;
RdbExtraOptions:array[GP_FSCache..GP_GCM] of TCheckBox;
// Wizard page and variables for the processes page.
SessionHandle:DWORD;
Processes:ProcessList;
ProcessesPage:TWizardPage;
ProcessesListBox:TListBox;
ProcessesRefresh,ContinueButton:TButton;
PageIDBeforeInstall:Integer;
#ifdef DEBUG_WIZARD_PAGE
DebugWizardPage:Integer;
#endif
{
Specific helper functions
}
procedure BrowseForPuTTYFolder(Sender:TObject);
var
Name:String;
begin
if GetOpenFileName(
'Please select a Plink executable'
, Name
, ExtractFilePath(EdtPlink.Text)
, 'Executable Files|*.exe'
, 'exe'
)
then begin
if IsPlinkExecutable(Name) then begin
EdtPlink.Text:=Name;
RdbSSH[GS_Plink].Checked:=True;
end else begin
// This message box only gets triggered on interactive use, so it
// does not need to be suppressible for silent installations.
MsgBox('{#PLINK_PATH_ERROR_MSG}',mbError,MB_OK);
end;
end;
end;
procedure DeleteContextMenuEntries;
var
AppDir,Command:String;
RootKey,i:Integer;
Keys:TArrayOfString;
begin
AppDir:=ExpandConstant('{app}');
if IsAdminLoggedOn then begin
RootKey:=HKEY_LOCAL_MACHINE;
end else begin
RootKey:=HKEY_CURRENT_USER;
end;
SetArrayLength(Keys,4);
Keys[0]:='SOFTWARE\Classes\Directory\shell\git_shell';
Keys[1]:='SOFTWARE\Classes\Directory\Background\shell\git_shell';
Keys[2]:='SOFTWARE\Classes\Directory\shell\git_gui';
Keys[3]:='SOFTWARE\Classes\Directory\Background\shell\git_gui';
for i:=0 to Length(Keys)-1 do begin
Command:='';
RegQueryStringValue(RootKey,Keys[i]+'\command','',Command);
if Pos(AppDir,Command)>0 then begin
if not RegDeleteKeyIncludingSubkeys(RootKey,Keys[i]) then begin
LogError('Line {#__LINE__}: Unable to remove "Git Bash / GUI Here" shell extension.');
end;
end;
end;
end;
procedure RefreshProcessList(Sender:TObject);
var
Version:TWindowsVersion;
Modules:TArrayOfString;
ProcsCloseRequired,ProcsCloseOptional:ProcessList;
i:Longint;
Caption:String;
ManualClosingRequired:Boolean;
begin
GetWindowsVersionEx(Version);
// Use the Restart Manager API when installing the shell extension on Windows Vista and above.
if Version.Major>=6 then begin
SetArrayLength(Modules,7);
Modules[0]:=ExpandConstant('{app}\usr\bin\msys-2.0.dll');
Modules[1]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl85.dll');
Modules[2]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk85.dll');
Modules[3]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl86.dll');
Modules[4]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk86.dll');
Modules[5]:=ExpandConstant('{app}\git-cheetah\git_shell_ext.dll');
Modules[6]:=ExpandConstant('{app}\git-cheetah\git_shell_ext64.dll');
SessionHandle:=FindProcessesUsingModules(Modules,Processes);
end else begin
SetArrayLength(Modules,5);
Modules[0]:=ExpandConstant('{app}\usr\bin\msys-2.0.dll');
Modules[1]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl85.dll');
Modules[2]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk85.dll');
Modules[3]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tcl86.dll');
Modules[4]:=ExpandConstant('{app}\{#MINGW_BITNESS}\bin\tk86.dll');
SessionHandle:=FindProcessesUsingModules(Modules,ProcsCloseRequired);
SetArrayLength(Modules,2);
Modules[0]:=ExpandConstant('{app}\git-cheetah\git_shell_ext.dll');
Modules[1]:=ExpandConstant('{app}\git-cheetah\git_shell_ext64.dll');
SessionHandle:=FindProcessesUsingModules(Modules,ProcsCloseOptional) or SessionHandle;
// Misuse the "Restartable" flag to indicate which processes are required
// to be closed before setup can continue, and which just should be closed
// in order to make changes take effect immediately.
SetArrayLength(Processes,GetArrayLength(ProcsCloseRequired)+GetArrayLength(ProcsCloseOptional));
for i:=0 to GetArrayLength(ProcsCloseRequired)-1 do begin
Processes[i]:=ProcsCloseRequired[i];
Processes[i].Restartable:=False;
end;
for i:=0 to GetArrayLength(ProcsCloseOptional)-1 do begin
Processes[GetArrayLength(ProcsCloseRequired)+i]:=ProcsCloseOptional[i];
Processes[GetArrayLength(ProcsCloseRequired)+i].Restartable:=True;
end;
end;
ManualClosingRequired:=False;
ProcessesListBox.Items.Clear;
if (Sender=NIL) or (SessionHandle>0) then begin
for i:=0 to GetArrayLength(Processes)-1 do begin
Caption:=Processes[i].Name+' (PID '+IntToStr(Processes[i].ID);
if Processes[i].Restartable then begin
Caption:=Caption+', closing is optional';
end else begin
Caption:=Caption+', closing is required';
ManualClosingRequired:=True;
end;
Caption:=Caption+')';
ProcessesListBox.Items.Append(Caption);
end;
end;
if ContinueButton<>NIL then begin
ContinueButton.Enabled:=not ManualClosingRequired;
end;
end;
procedure SetAndMarkEnvString(Name,Value:String;Expandable:Boolean);
var
Env:TArrayOfString;
FileName:String;
begin
SetArrayLength(Env,1);
Env[0]:=Value;
// Try to set the variable as specified by the user.
if not SetEnvStrings(Name,Env,Expandable,IsAdminLoggedOn,True) then
LogError('Line {#__LINE__}: Unable to set the '+Name+' environment variable.')
else begin
// Mark that we have changed the variable by writing its value to a file.
FileName:=ExpandConstant('{app}')+'\setup.ini';
if not SetIniString('Environment',Name,Value,FileName) then
LogError('Line {#__LINE__}: Unable to write to file "'+FileName+'".');
end;
end;
procedure DeleteMarkedEnvString(Name:String);
var
Env:TArrayOfString;
FileName:String;
begin
Env:=GetEnvStrings(Name,IsAdminLoggedOn);
FileName:=ExpandConstant('{app}')+'\setup.ini';
if (GetArrayLength(Env)=1) and
(CompareStr(RemoveQuotes(Env[0]),GetIniString('Environment',Name,'',FileName))=0) then begin
if not SetEnvStrings(Name,[],False,IsAdminLoggedOn,True) then
LogError('Line {#__LINE__}: Unable to delete the '+Name+' environment variable.');
end;
end;
{
Setup event functions
}
function InitializeSetup:Boolean;
begin
UpdateInfFilenames;
#if BITNESS=='32'
Result:=True;
#else
if not IsWin64 then begin
LogError('The 64-bit version of Git requires a 64-bit Windows. Aborting.');
Result:=False;
end else begin
Result:=True;
end;
#endif
end;
procedure RecordChoice(PreviousDataKey:Integer;Key,Data:String);
begin
ChosenOptions:=ChosenOptions+Key+': '+Data+#13#10;
SetPreviousData(PreviousDataKey,Key,Data);
if ShouldSaveInf then begin
// .inf files do not like keys with spaces.
StringChangeEx(Key,' ','',True);
SaveInfString('Setup',Key,Data);
end;
end;
function ReplayChoice(Key,Default:String):String;
var
NoSpaces:String;
begin
NoSpaces:=Key;
StringChangeEx(NoSpaces,' ','',True);
// Interpret /o:PathOption=Cmd and friends
Result:=ExpandConstant('{param:o:'+NoSpaces+'| }');
if Result<>' ' then
Log('Parameter '+Key+'='+Result+' set via command-line')
else if ShouldLoadInf then
// Use settings from the user provided INF.
// .inf files do not like keys with spaces.
Result:=LoadInfString('Setup',NoSpaces,Default)
else
// Restore the settings chosen during a previous install.
Result:=GetPreviousData(Key,Default);
end;
function DetectNetFxVersion:Cardinal;
begin
// We are only interested in version v4.5.1 or later, therefore it
// is enough to only use the 4.5 method described in
// https://msdn.microsoft.com/en-us/library/hh925568
if not RegQueryDWordValue(HKEY_LOCAL_MACHINE,'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full','Release',Result) then
Result:=0;
end;
procedure OpenGCMHomepage(Sender:TObject);
var
ExitStatus:Integer;
begin
ShellExec('','https://github.com/Microsoft/Git-Credential-Manager-for-Windows','','',SW_SHOW,ewNoWait,ExitStatus);
end;
function GetTextWidth(Text:String;Font:TFont):Integer;
var
DummyBitmap:TBitmap;
begin
DummyBitmap:=TBitmap.Create();
DummyBitmap.Canvas.Font.Assign(Font);
Result:=DummyBitmap.Canvas.TextWidth(Text);
DummyBitmap.Free();
end;
procedure InitializeWizard;
var
PrevPageID:Integer;
LblGitBash,LblGitCmd,LblGitCmdTools,LblGitCmdToolsWarn:TLabel;
LblOpenSSH,LblPlink:TLabel;
PuTTYSessions,EnvSSH:TArrayOfString;
LblLFOnly,LblCRLFAlways,LblCRLFCommitAsIs:TLabel;
LblMinTTY,LblConHost:TLabel;
LblFSCache,LblGCM,LblGCMLink:TLabel;
BtnPlink:TButton;
Data:String;
begin
ChosenOptions:='';
PrevPageID:=wpSelectProgramGroup;
(*
* Create a custom page for modifying the environment.
*)
PathPage:=CreateCustomPage(
PrevPageID
, 'Adjusting your PATH environment'
, 'How would you like to use Git from the command line?'
);
PrevPageID:=PathPage.ID;
// 1st choice
RdbPath[GP_BashOnly]:=TRadioButton.Create(PathPage);
with RdbPath[GP_BashOnly] do begin
Parent:=PathPage.Surface;
Caption:='Use Git from Git Bash only';
Left:=ScaleX(4);
Top:=ScaleY(8);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=0;
Checked:=True;
end;
LblGitBash:=TLabel.Create(PathPage);
with LblGitBash do begin
Parent:=PathPage.Surface;
Caption:=
'This is the safest choice as your PATH will not be modified at all. You will only be' + #13 +
'able to use the Git command line tools from Git Bash.';
Left:=ScaleX(28);
Top:=ScaleY(32);
Width:=ScaleX(405);
Height:=ScaleY(26);
end;
// 2nd choice
RdbPath[GP_Cmd]:=TRadioButton.Create(PathPage);
with RdbPath[GP_Cmd] do begin
Parent:=PathPage.Surface;
Caption:='Use Git from the Windows Command Prompt';
Left:=ScaleX(4);
Top:=ScaleY(76);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=1;
end;
LblGitCmd:=TLabel.Create(PathPage);
with LblGitCmd do begin
Parent:=PathPage.Surface;
Caption:=
'This option is considered safe as it only adds some minimal Git wrappers to your' + #13 +
'PATH to avoid cluttering your environment with optional Unix tools. You will be' + #13 +
'able to use Git from both Git Bash and the Windows Command Prompt.';
Left:=ScaleX(28);
Top:=ScaleY(100);
Width:=ScaleX(405);
Height:=ScaleY(39);
end;
// 3rd choice
RdbPath[GP_CmdTools]:=TRadioButton.Create(PathPage);
with RdbPath[GP_CmdTools] do begin
Parent:=PathPage.Surface;
Caption:='Use Git and optional Unix tools from the Windows Command Prompt';
Left:=ScaleX(4);
Top:=ScaleY(152);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=2;
end;
LblGitCmdTools:=TLabel.Create(PathPage);
with LblGitCmdTools do begin
Parent:=PathPage.Surface;
Caption:='Both Git and the optional Unix tools will be added to your PATH.';
Left:=ScaleX(28);
Top:=ScaleY(176);
Width:=ScaleX(405);
Height:=ScaleY(13);
end;
LblGitCmdToolsWarn:=TLabel.Create(PathPage);
with LblGitCmdToolsWarn do begin
Parent:=PathPage.Surface;
Caption:=
'Warning: This will override Windows tools like "find" and "sort". Only' + #13 +
'use this option if you understand the implications.';
Left:=ScaleX(28);
Top:=ScaleY(192);
Width:=ScaleX(405);
Height:=ScaleY(26);
Font.Color:=255;
Font.Style:=[fsBold];
end;
// Restore the setting chosen during a previous install.
Data:=ReplayChoice('Path Option','BashOnly');
if Data='BashOnly' then begin
RdbPath[GP_BashOnly].Checked:=True;
end else if Data='Cmd' then begin
RdbPath[GP_Cmd].Checked:=True;
end else if Data='CmdTools' then begin
RdbPath[GP_CmdTools].Checked:=True;
end;
(*
* Create a custom page for using (Tortoise)Plink instead of OpenSSH
* if at least one PuTTY session is found in the Registry.
*)
if RegGetSubkeyNames(HKEY_CURRENT_USER,'Software\SimonTatham\PuTTY\Sessions',PuTTYSessions) and (GetArrayLength(PuTTYSessions)>0) then begin
PuTTYPage:=CreateCustomPage(
PrevPageID
, 'Choosing the SSH executable'
, 'Which Secure Shell client program would you like Git to use?'
);
PrevPageID:=PuTTYPage.ID;
// 1st choice
RdbSSH[GS_OpenSSH]:=TRadioButton.Create(PuTTYPage);
with RdbSSH[GS_OpenSSH] do begin
Parent:=PuTTYPage.Surface;
Caption:='Use OpenSSH';
Left:=ScaleX(4);
Top:=ScaleY(8);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=0;
Checked:=True;
end;
LblOpenSSH:=TLabel.Create(PuTTYPage);
with LblOpenSSH do begin
Parent:=PuTTYPage.Surface;
Caption:=
'This uses ssh.exe that comes with Git. The GIT_SSH and SVN_SSH' + #13 +
'environment variables will not be modified.';
Left:=ScaleX(28);
Top:=ScaleY(32);
Width:=ScaleX(405);
Height:=ScaleY(26);
end;
// 2nd choice
RdbSSH[GS_Plink]:=TRadioButton.Create(PuTTYPage);
with RdbSSH[GS_Plink] do begin
Parent:=PuTTYPage.Surface;
Caption:='Use (Tortoise)Plink';
Left:=ScaleX(4);
Top:=ScaleY(76);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=1;
end;
LblPlink:=TLabel.Create(PuTTYPage);
with LblPlink do begin
Parent:=PuTTYPage.Surface;
Caption:=
'PuTTY sessions were found in your Registry. You may specify the path' + #13 +
'to an existing copy of (Tortoise)Plink.exe from the TortoiseGit/SVN/CVS' + #13 +
'or PuTTY applications. The GIT_SSH and SVN_SSH environment' + #13 +
'variables will be adjusted to point to the following executable:';
Left:=ScaleX(28);
Top:=ScaleY(100);
Width:=ScaleX(405);
Height:=ScaleY(52);
end;
EdtPlink:=TEdit.Create(PuTTYPage);
with EdtPlink do begin
Parent:=PuTTYPage.Surface;
EnvSSH:=GetEnvStrings('GIT_SSH',IsAdminLoggedOn);
if (GetArrayLength(EnvSSH)=1) and IsPlinkExecutable(EnvSSH[0]) then begin
Text:=EnvSSH[0];
end;
if not FileExists(Text) then begin
Text:=GetPreviousData('Plink Path','');
end;
if not FileExists(Text) then begin
Text:=GuessPlinkExecutable;
end;
if not FileExists(Text) then begin
Text:='';
end;
Left:=ScaleX(28);
Top:=ScaleY(161);
Width:=ScaleX(316);
Height:=ScaleY(13);
end;
BtnPlink:=TButton.Create(PuTTYPage);
with BtnPlink do begin
Parent:=PuTTYPage.Surface;
Caption:='...';
OnClick:=@BrowseForPuTTYFolder;
Left:=ScaleX(348);
Top:=ScaleY(161);
Width:=ScaleX(21);
Height:=ScaleY(21);
end;
// Restore the setting chosen during a previous install.
Data:=ReplayChoice('SSH Option','OpenSSH');
if Data='OpenSSH' then begin
RdbSSH[GS_OpenSSH].Checked:=True;
end else if Data='Plink' then begin
RdbSSH[GS_Plink].Checked:=True;
end;
end else begin
PuTTYPage:=NIL;
end;
(*
* Create a custom page for the core.autocrlf setting.
*)
CRLFPage:=CreateCustomPage(
PrevPageID
, 'Configuring the line ending conversions'
, 'How should Git treat line endings in text files?'
);
PrevPageID:=CRLFPage.ID;
// 1st choice
RdbCRLF[GC_CRLFAlways]:=TRadioButton.Create(CRLFPage);
with RdbCRLF[GC_CRLFAlways] do begin
Parent:=CRLFPage.Surface;
Caption:='Checkout Windows-style, commit Unix-style line endings';
Left:=ScaleX(4);
Top:=ScaleY(8);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=0;
Checked:=True;
end;
LblCRLFAlways:=TLabel.Create(CRLFPage);
with LblCRLFAlways do begin
Parent:=CRLFPage.Surface;
Caption:=
'Git will convert LF to CRLF when checking out text files. When committing' + #13 +
'text files, CRLF will be converted to LF. For cross-platform projects,' + #13 +
'this is the recommended setting on Windows ("core.autocrlf" is set to "true").';
Left:=ScaleX(28);
Top:=ScaleY(32);
Width:=ScaleX(405);
Height:=ScaleY(47);
end;
// 2nd choice
RdbCRLF[GC_LFOnly]:=TRadioButton.Create(CRLFPage);
with RdbCRLF[GC_LFOnly] do begin
Parent:=CRLFPage.Surface;
Caption:='Checkout as-is, commit Unix-style line endings';
Left:=ScaleX(4);
Top:=ScaleY(80);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=1;
Checked:=False;
end;
LblLFOnly:=TLabel.Create(CRLFPage);
with LblLFOnly do begin
Parent:=CRLFPage.Surface;
Caption:=
'Git will not perform any conversion when checking out text files. When' + #13 +
'committing text files, CRLF will be converted to LF. For cross-platform projects,' + #13 +
'this is the recommended setting on Unix ("core.autocrlf" is set to "input").';
Left:=ScaleX(28);
Top:=ScaleY(104);
Width:=ScaleX(405);
Height:=ScaleY(47);
end;
// 3rd choice
RdbCRLF[GC_CRLFCommitAsIs]:=TRadioButton.Create(CRLFPage);
with RdbCRLF[GC_CRLFCommitAsIs] do begin
Parent:=CRLFPage.Surface;
Caption:='Checkout as-is, commit as-is';
Left:=ScaleX(4);
Top:=ScaleY(152);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=2;
Checked:=False;
end;
LblCRLFCommitAsIs:=TLabel.Create(CRLFPage);
with LblCRLFCommitAsIs do begin
Parent:=CRLFPage.Surface;
Caption:=
'Git will not perform any conversions when checking out or committing' + #13 +
'text files. Choosing this option is not recommended for cross-platform' + #13 +
'projects ("core.autocrlf" is set to "false").';
Left:=ScaleX(28);
Top:=ScaleY(176);
Width:=ScaleX(405);
Height:=ScaleY(47);
end;
// Restore the setting chosen during a previous install.
Data:=ReplayChoice('CRLF Option','CRLFAlways');
if Data='LFOnly' then begin
RdbCRLF[GC_LFOnly].Checked:=True;
end else if Data='CRLFAlways' then begin
RdbCRLF[GC_CRLFAlways].Checked:=True;
end else if Data='CRLFCommitAsIs' then begin
RdbCRLF[GC_CRLFCommitAsIs].Checked:=True;
end;
(*
* Create a custom page for Git Bash's terminal emulator setting.
*)
BashTerminalPage:=CreateCustomPage(
PrevPageID
, 'Configuring the terminal emulator to use with Git Bash'
, 'Which terminal emulator do you want to use with your Git Bash?'
);
PrevPageID:=BashTerminalPage.ID;
// 1st choice
RdbBashTerminal[GB_MinTTY]:=TRadioButton.Create(BashTerminalPage);
with RdbBashTerminal[GB_MinTTY] do begin
Parent:=BashTerminalPage.Surface;
Caption:='Use MinTTY (the default terminal of MSYS2)';
Left:=ScaleX(4);
Top:=ScaleY(8);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=0;
Checked:=True;
end;
LblMinTTY:=TLabel.Create(BashTerminalPage);
with LblMinTTY do begin
Parent:=BashTerminalPage.Surface;
Caption:=
'Git Bash will use MinTTY as terminal emulator, which sports a resizable window,' + #13 +
'non-rectangular selections and a Unicode font. Windows console programs (such' + #13 +
'as interactive Python) must be launched via `winpty` to work in MinTTY.';
Left:=ScaleX(28);
Top:=ScaleY(32);
Width:=ScaleX(405);
Height:=ScaleY(47);
end;
// 2nd choice
RdbBashTerminal[GB_ConHost]:=TRadioButton.Create(BashTerminalPage);
with RdbBashTerminal[GB_ConHost] do begin
Parent:=BashTerminalPage.Surface;
Caption:='Use Windows'' default console window';
Left:=ScaleX(4);
Top:=ScaleY(80);
Width:=ScaleX(405);
Height:=ScaleY(17);
Font.Style:=[fsBold];
TabOrder:=1;
Checked:=False;
end;
LblConHost:=TLabel.Create(BashTerminalPage);
with LblConHost do begin
Parent:=BashTerminalPage.Surface;
Caption:=
'Git will use the default console window of Windows ("cmd.exe"), which works well' + #13 +
'with Win32 console programs such as interactive Python or node.js, but has a' + #13 +
'very limited default scroll-back, needs to be configured to use a Unicode font in' + #13 +
'order to display non-ASCII characters correctly, and prior to Windows 10 its' + #13 +
'window was not freely resizable and it only allowed rectangular text selections.';
Left:=ScaleX(28);
Top:=ScaleY(104);
Width:=ScaleX(405);
Height:=ScaleY(67);
end;
// Restore the setting chosen during a previous install.
Data:=ReplayChoice('Bash Terminal Option','MinTTY');
if Data='MinTTY' then begin
RdbBashTerminal[GB_MinTTY].Checked:=True;
end else if Data='ConHost' then begin
RdbBashTerminal[GB_ConHost].Checked:=True;
end;
(*
* Create a custom page for extra options.
*)
ExtraOptionsPage:=CreateCustomPage(
PrevPageID
, 'Configuring extra options'
, 'Which features would you like to enable?'