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