2015-11-28 12:43:32 +00:00
|
|
|
; Script generated by the Inno Script Studio Wizard.
|
|
|
|
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
|
|
|
|
|
|
|
|
#define MyAppName "Git LFS"
|
2016-04-14 13:33:47 +00:00
|
|
|
#define MyAppVersion "1.2.0"
|
2015-11-28 12:43:32 +00:00
|
|
|
#define MyAppPublisher "GitHub, Inc"
|
|
|
|
#define MyAppURL "https://git-lfs.github.com/"
|
2016-01-28 14:38:07 +00:00
|
|
|
#define MyAppFilePrefix "git-lfs-windows"
|
2015-11-28 12:43:32 +00:00
|
|
|
|
|
|
|
[Setup]
|
|
|
|
; NOTE: The value of AppId uniquely identifies this application.
|
|
|
|
; Do not use the same AppId value in installers for other applications.
|
|
|
|
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
|
|
|
|
AppId={{286391DE-F778-44EA-9375-1B21AAA04FF0}
|
|
|
|
AppName={#MyAppName}
|
|
|
|
AppVersion={#MyAppVersion}
|
|
|
|
;AppVerName={#MyAppName} {#MyAppVersion}
|
|
|
|
AppPublisher={#MyAppPublisher}
|
|
|
|
AppPublisherURL={#MyAppURL}
|
|
|
|
AppSupportURL={#MyAppURL}
|
|
|
|
AppUpdatesURL={#MyAppURL}
|
|
|
|
LicenseFile=..\..\LICENSE.md
|
2015-12-01 11:15:23 +00:00
|
|
|
OutputBaseFilename={#MyAppFilePrefix}-{#MyAppVersion}
|
2015-11-28 13:03:08 +00:00
|
|
|
OutputDir=..\..\
|
2015-11-28 12:43:32 +00:00
|
|
|
Compression=lzma
|
|
|
|
SolidCompression=yes
|
2016-01-28 14:38:07 +00:00
|
|
|
DefaultDirName={pf}\{#MyAppName}
|
2015-11-28 12:43:32 +00:00
|
|
|
UsePreviousAppDir=no
|
|
|
|
DirExistsWarning=no
|
2016-02-04 22:24:35 +00:00
|
|
|
DisableReadyPage=True
|
2016-01-28 14:38:07 +00:00
|
|
|
ArchitecturesInstallIn64BitMode=x64
|
|
|
|
ChangesEnvironment=yes
|
2015-11-28 12:43:32 +00:00
|
|
|
|
|
|
|
[Languages]
|
|
|
|
Name: "english"; MessagesFile: "compiler:Default.isl"
|
|
|
|
|
2016-01-28 14:38:07 +00:00
|
|
|
[Run]
|
|
|
|
; Uninstalls the old Git LFS version that used a different installer in a different location:
|
|
|
|
; If we don't do this, Git will prefer the old version as it is in the same directory as it.
|
|
|
|
Filename: "{code:GetExistingGitInstallation}\git-lfs-uninstaller.exe"; Parameters: "/S"; Flags: skipifdoesntexist
|
|
|
|
|
2015-11-28 12:43:32 +00:00
|
|
|
[Files]
|
2016-01-28 14:38:07 +00:00
|
|
|
Source: ..\..\git-lfs-x64.exe; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-lfs.exe"; AfterInstall: InstallGitLFS; Check: Is64BitInstallMode
|
|
|
|
Source: ..\..\git-lfs-x86.exe; DestDir: "{app}"; Flags: ignoreversion; DestName: "git-lfs.exe"; AfterInstall: InstallGitLFS; Check: not Is64BitInstallMode
|
|
|
|
|
|
|
|
[Registry]
|
|
|
|
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Check: NeedsAddPath('{app}')
|
2016-04-13 22:43:35 +00:00
|
|
|
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: string; ValueName: "GIT_LFS_PATH"; ValueData: "{app}"
|
2015-11-28 12:43:32 +00:00
|
|
|
|
|
|
|
[Code]
|
2016-01-28 14:38:07 +00:00
|
|
|
// Uses cmd to parse and find the location of Git through the env vars.
|
|
|
|
// Currently only used to support running the uninstaller for the old Git LFS version.
|
2015-11-28 12:43:32 +00:00
|
|
|
function GetExistingGitInstallation(Value: string): string;
|
|
|
|
var
|
|
|
|
TmpFileName: String;
|
|
|
|
ExecStdOut: AnsiString;
|
|
|
|
ResultCode: integer;
|
|
|
|
|
2016-04-13 22:43:35 +00:00
|
|
|
begin
|
2015-11-28 12:43:32 +00:00
|
|
|
TmpFileName := ExpandConstant('{tmp}') + '\git_location.txt';
|
2016-04-13 22:43:35 +00:00
|
|
|
|
2015-11-28 12:43:32 +00:00
|
|
|
Exec(
|
|
|
|
ExpandConstant('{cmd}'),
|
2016-04-13 22:43:35 +00:00
|
|
|
'/C "for %i in (git.exe) do @echo. %~$PATH:i > "' + TmpFileName + '"',
|
2015-11-28 12:56:14 +00:00
|
|
|
'', SW_HIDE, ewWaitUntilTerminated, ResultCode
|
|
|
|
);
|
2015-11-28 12:43:32 +00:00
|
|
|
|
|
|
|
if LoadStringFromFile(TmpFileName, ExecStdOut) then begin
|
|
|
|
if not (Pos('Git\cmd', ExtractFilePath(ExecStdOut)) = 0) then begin
|
|
|
|
// Proxy Git path detected
|
2016-05-04 12:52:35 +00:00
|
|
|
Result := ExpandConstant('{pf}')+'\Git\mingw64\bin';
|
2015-11-28 12:43:32 +00:00
|
|
|
end else begin
|
|
|
|
Result := ExtractFilePath(ExecStdOut);
|
|
|
|
end;
|
|
|
|
|
|
|
|
DeleteFile(TmpFileName);
|
|
|
|
end;
|
|
|
|
end;
|
2015-11-28 12:56:14 +00:00
|
|
|
|
2016-01-28 14:38:07 +00:00
|
|
|
// Checks to see if we need to add the dir to the env PATH variable.
|
|
|
|
function NeedsAddPath(Param: string): boolean;
|
|
|
|
var
|
|
|
|
OrigPath: string;
|
|
|
|
ParamExpanded: string;
|
|
|
|
begin
|
|
|
|
//expand the setup constants like {app} from Param
|
|
|
|
ParamExpanded := ExpandConstant(Param);
|
|
|
|
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
|
|
|
|
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
|
|
|
|
'Path', OrigPath)
|
|
|
|
then begin
|
|
|
|
Result := True;
|
|
|
|
exit;
|
|
|
|
end;
|
|
|
|
// look for the path with leading and trailing semicolon and with or without \ ending
|
|
|
|
// Pos() returns 0 if not found
|
2016-04-13 22:43:35 +00:00
|
|
|
Result := Pos(';' + UpperCase(ParamExpanded) + ';', ';' + UpperCase(OrigPath) + ';') = 0;
|
2016-01-28 14:38:07 +00:00
|
|
|
if Result = True then
|
2016-04-13 22:43:35 +00:00
|
|
|
Result := Pos(';' + UpperCase(ParamExpanded) + '\;', ';' + UpperCase(OrigPath) + ';') = 0;
|
2016-01-28 14:38:07 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
// Runs the lfs initialization.
|
2015-11-28 12:56:14 +00:00
|
|
|
procedure InstallGitLFS();
|
|
|
|
var
|
|
|
|
ResultCode: integer;
|
|
|
|
begin
|
|
|
|
Exec(
|
|
|
|
ExpandConstant('{cmd}'),
|
2016-04-13 22:43:35 +00:00
|
|
|
ExpandConstant('/C ""{app}\git-lfs.exe" install"'),
|
2015-11-28 12:56:14 +00:00
|
|
|
'', SW_HIDE, ewWaitUntilTerminated, ResultCode
|
|
|
|
);
|
2016-04-13 22:43:35 +00:00
|
|
|
if not ResultCode = 1 then
|
|
|
|
MsgBox(
|
|
|
|
'Git LFS was not able to automatically initialize itself. ' +
|
|
|
|
'Please run "git lfs install" from the commandline.', mbInformation, MB_OK);
|
2015-11-28 12:56:14 +00:00
|
|
|
end;
|
2015-11-29 20:56:19 +00:00
|
|
|
|
2016-04-14 13:33:47 +00:00
|
|
|
// Event function automatically called when uninstalling:
|
|
|
|
function InitializeUninstall(): Boolean;
|
2015-11-29 20:56:19 +00:00
|
|
|
var
|
|
|
|
ResultCode: integer;
|
|
|
|
begin
|
|
|
|
Exec(
|
|
|
|
ExpandConstant('{cmd}'),
|
2016-04-13 22:43:35 +00:00
|
|
|
ExpandConstant('/C ""{app}\git-lfs.exe" uninstall"'),
|
2015-11-29 20:56:19 +00:00
|
|
|
'', SW_HIDE, ewWaitUntilTerminated, ResultCode
|
|
|
|
);
|
|
|
|
Result := True;
|
|
|
|
end;
|
2016-04-13 22:43:35 +00:00
|
|
|
|