WinGit (Inno): lauch git-gui directly, without cmd window
[git/jnareb-git.git] / share / WinGit-InnoSetup / install.iss
blob53f695a0585209440e92281f43aff4c1959dc217
1 #define APP_NAME 'Git'
2 #define APP_VERSION '%APPVERSION%'
3 #define APP_URL 'http://code.google.com/p/msysgit/'
4 #define APP_BUILTINS 'etc\fileList-builtins.txt'
6 [Setup]
7 ; Compiler-related
8 OutputBaseFilename={#emit APP_NAME+'-'+APP_VERSION}
9 OutputDir=%OUTPUTDIR%
10 SolidCompression=yes
12 ; Installer-related
13 AllowNoIcons=yes
14 AppName={#emit APP_NAME}
15 AppPublisherURL={#emit APP_URL}
16 AppVersion={#emit APP_VERSION}
17 AppVerName={#emit APP_NAME+' '+APP_VERSION}
18 DefaultDirName={pf}\{#emit APP_NAME}
19 DefaultGroupName={#emit APP_NAME}
20 DisableReadyPage=yes
21 LicenseFile=gpl-2.0.txt
23 ; Cosmetic
24 SetupIconFile=etc\git.ico
25 WizardSmallImageFile=install.bmp
27 [Tasks]
28 Name: quicklaunchicon; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: checkedonce
29 Name: desktopicon; Description: "Create a &Desktop icon"; GroupDescription: "Additional icons:"; Flags: checkedonce
30 Name: shellextension; Description: "Add ""Git Shell Here"" "; GroupDescription: "Shell extensions:"; Flags: checkedonce
31 Name: guiextension; Description: "Add ""Git GUI Here"" "; GroupDescription: "Shell extensions:"; Flags: checkedonce
33 [Files]
34 Source: "*"; DestDir: "{app}"; Excludes: "\*.txt, \install.*, \tmp.*, \bin\*install*"; Flags: recursesubdirs
36 [Icons]
37 Name: "{group}\Git GUI"; Filename: "{app}\bin\wish.exe"; Parameters: "{app}\bin\git-gui"; WorkingDir: "%APPDATA%\Git"; IconFilename: "{app}\etc\git.ico"
38 Name: "{group}\Git Shell"; Filename: "{app}\bin\sh.exe"; Parameters: "--login -i"; WorkingDir: "%APPDATA%\Git"; IconFilename: "{app}\etc\git.ico"
39 Name: "{group}\Uninstall Git"; Filename: "{uninstallexe}"
40 Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Git Shell"; Filename: "{app}\bin\sh.exe"; Parameters: "--login -i"; WorkingDir: "%APPDATA%\Git"; IconFilename: "{app}\etc\git.ico"; Tasks: quicklaunchicon
41 Name: "{userdesktop}\Git Shell"; Filename: "{app}\bin\sh.exe"; Parameters: "--login -i"; WorkingDir: "%APPDATA%\Git"; IconFilename: "{app}\etc\git.ico"; Tasks: desktopicon
43 [Messages]
44 BeveledLabel={#emit APP_URL}
46 [Registry]
47 Root: HKLM; Subkey: "SOFTWARE\Classes\Directory\shell\git_shell"; ValueType: string; ValueData: "Git &Shell Here"; Flags: uninsdeletevalue uninsdeletekeyifempty; Tasks: shellextension
48 Root: HKLM; Subkey: "SOFTWARE\Classes\Directory\shell\git_shell\command"; ValueType: string; ValueData: "cmd.exe /c ""pushd ""%1"" && ""{app}\bin\sh.exe"" --login -i"""; Flags: uninsdeletevalue uninsdeletekeyifempty; Tasks: shellextension
49 Root: HKLM; Subkey: "SOFTWARE\Classes\Directory\shell\git_gui"; ValueType: string; ValueData: "Git &GUI Here"; Flags: uninsdeletevalue uninsdeletekeyifempty; Tasks: guiextension
50 Root: HKLM; Subkey: "SOFTWARE\Classes\Directory\shell\git_gui\command"; ValueType: string; ValueData: """{app}\bin\wish.exe"" ""{app}\bin\git-gui"""; Flags: uninsdeletevalue uninsdeletekeyifempty; Tasks: guiextension
52 [UninstallDelete]
53 Type: files; Name: "{app}\bin\git-*.exe"
54 Type: dirifempty; Name: "{app}\home\{username}"
55 Type: dirifempty; Name: "{app}\home"
57 [Code]
58 procedure InitializeWizard;
59 begin
60 // Use a mono spaced font in the license dialog. NOTE: This might be too small.
61 WizardForm.LicenseMemo.Font.Name:='Lucida Console';
62 WizardForm.LicenseMemo.Font.Size:=7;
63 end;
65 function CreateHardLink(lpFileName,lpExistingFileName:string;lpSecurityAttributes:Integer):Boolean;
66 external 'CreateHardLinkA@Kernel32.dll';
68 procedure CurStepChanged(CurStep:TSetupStep);
69 var
70 ListFile,AppDir:string;
71 BuiltIns:TArrayOfString;
72 i:Longint;
73 IsNTFS:Boolean;
74 begin
75 if CurStep<>ssDone then begin
76 Exit;
77 end;
79 // Load the built-ins from a text file.
80 ListFile:=ExpandConstant('{app}\'+'{#emit APP_BUILTINS}');
81 if not LoadStringsFromFile(ListFile,BuiltIns) then begin
82 MsgBox('Unable to read file "{#emit APP_BUILTINS}".', mbError, MB_OK);
83 Exit;
84 end;
86 AppDir:=ExpandConstant('{app}');
88 // Check if we are running on NTFS.
89 IsNTFS:=False;
90 if SetNTFSCompression(AppDir+'\bin\git.exe',true) then begin
91 IsNTFS:=SetNTFSCompression(AppDir+'\bin\git.exe',false);
92 end;
94 // Map the built-ins to git.exe.
95 if IsNTFS then begin
96 for i:=0 to GetArrayLength(BuiltIns)-1 do begin
97 // On non-NTFS partitions, create hard links.
98 CreateHardLink(AppDir+'\'+BuiltIns[i],AppDir+'\bin\git.exe',0);
99 end;
100 end else begin
101 for i:=0 to GetArrayLength(BuiltIns)-1 do begin
102 // On non-NTFS partitions, copy simply the files.
103 FileCopy(AppDir+'\bin\git.exe',AppDir+'\'+BuiltIns[i],false);
104 end;
105 end;
106 end;