-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Copy pathSetup.iss
132 lines (115 loc) · 4.4 KB
/
Setup.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
; This script requires Inno Setup Compiler 6.0.0 or later to compile
; The Inno Setup Compiler (and IDE) can be found at http://www.jrsoftware.org/isinfo.php
; General documentation on how to use InnoSetup scripts: http://www.jrsoftware.org/ishelp/index.php
; Ensure minimum Inno Setup tooling version
#if VER < EncodeVer(6,0,0)
#error Update your Inno Setup version (6.0.0 or newer)
#endif
#ifndef PayloadDir
#error Payload directory path property 'PayloadDir' must be specified
#endif
#ifndef InstallTarget
#error Installer target property 'InstallTarget' must be specifed
#endif
#ifndef GcmRuntimeIdentifier
#error GCM Runtime Identifier 'GcmRuntimeIdentifier' must be specifed (e.g. win-x64)
#endif
#if InstallTarget == "user"
#define GcmAppId "{{aa76d31d-432c-42ee-844c-bc0bc801cef3}}"
#define GcmLongName "Git Credential Manager (User)"
#define GcmSetupExe "gcmuser"
#define GcmConfigureCmdArgs ""
#elif InstallTarget == "system"
#define GcmAppId "{{fdfae50a-1bc1-4ead-9228-1e1c275e8d12}}"
#define GcmLongName "Git Credential Manager"
#define GcmSetupExe "gcm"
#define GcmConfigureCmdArgs "--system"
#else
#error Installer target property 'InstallTarget' must be 'user' or 'system'
#endif
; Define core properties
#define GcmShortName "Git Credential Manager"
#define GcmPublisher "GitHub"
#define GcmVersionInfoDescription "Secure, cross-platform Git credential manager."
#define GcmPublisherUrl "https://www.github.com"
#define GcmCopyright "Copyright (c) GitHub, Inc. and contributors"
#define GcmUrl "https://aka.ms/gcm"
#define GcmReadme "https://github.com/git-ecosystem/git-credential-manager/blob/main/README.md"
#define GcmRepoRoot "..\..\.."
#define GcmAssets GcmRepoRoot + "\assets"
#define GcmExe "git-credential-manager.exe"
#ifnexist PayloadDir + "\" + GcmExe
#error Payload files are missing
#endif
; Generate the GCM version version from the CLI executable
#define VerMajor
#define VerMinor
#define VerBuild
#define VerRevision
#expr GetVersionComponents(PayloadDir + "\" + GcmExe, VerMajor, VerMinor, VerBuild, VerRevision)
#define GcmVersionSimple str(VerMajor) + "." + str(VerMinor) + "." + str(VerBuild)
#define GcmVersion str(GcmVersionSimple) + "." + str(VerRevision)
[Setup]
AppId={#GcmAppId}
AppName={#GcmLongName}
AppVersion={#GcmVersion}
AppVerName={#GcmLongName} {#GcmVersion}
AppPublisher={#GcmPublisher}
AppPublisherURL={#GcmPublisherUrl}
AppSupportURL={#GcmUrl}
AppUpdatesURL={#GcmUrl}
AppContact={#GcmUrl}
AppCopyright={#GcmCopyright}
AppReadmeFile={#GcmReadme}
; Windows ARM64 supports installing and running x64 binaries, but not vice versa.
#if GcmRuntimeIdentifier=="win-x64"
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
#elif GcmRuntimeIdentifier=="win-arm64"
ArchitecturesAllowed=arm64
ArchitecturesInstallIn64BitMode=arm64
#endif
VersionInfoVersion={#GcmVersion}
LicenseFile={#GcmRepoRoot}\LICENSE
OutputBaseFilename={#GcmSetupExe}-{#GcmRuntimeIdentifier}-{#GcmVersionSimple}
DefaultDirName={autopf}\{#GcmShortName}
Compression=lzma2
SolidCompression=yes
MinVersion=6.1sp1
DisableDirPage=yes
UninstallDisplayIcon={app}\{#GcmExe}
SetupIconFile={#GcmAssets}\gcmicon.ico
WizardImageFile={#GcmAssets}\gcmicon128.bmp
WizardSmallImageFile={#GcmAssets}\gcmicon64.bmp
WizardStyle=modern
WizardImageStretch=no
WindowResizable=no
ChangesEnvironment=yes
#if InstallTarget == "user"
PrivilegesRequired=lowest
#endif
[Languages]
Name: english; MessagesFile: "compiler:Default.isl";
[Types]
Name: full; Description: "Full installation"; Flags: iscustom;
[Components]
; No individual components
[Run]
Filename: "{app}\{#GcmExe}"; Parameters: "configure {#GcmConfigureCmdArgs}"; Flags: runhidden
[UninstallRun]
Filename: "{app}\{#GcmExe}"; Parameters: "unconfigure {#GcmConfigureCmdArgs}"; Flags: runhidden; RunOnceId: "unconfigure"
[Files]
Source: "{#PayloadDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
[Code]
// Don't allow installing conflicting architectures
function InitializeSetup(): Boolean;
begin
Result := True;
#if InstallTarget == "user"
if not WizardSilent() and IsAdmin() then begin
if MsgBox('This User Installer is not meant to be run as an Administrator. If you would like to install Git Credential Manager for all users in this system, download the System Installer instead from https://aka.ms/gcm/latest. Are you sure you want to continue?', mbError, MB_OKCANCEL) = IDCANCEL then begin
Result := False;
end;
end;
#endif
end;