-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathEDMC_Installer_Config_template.txt
125 lines (115 loc) · 5.26 KB
/
EDMC_Installer_Config_template.txt
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
#define MyAppName "EDMarketConnector"
#define MyAppLongName "Elite Dangerous Market Connector"
#define MyAppVersion "$appver"
#define MyAppUpdateTime "$update_time"
#define MyAppPublisher "EDCD"
#define MyAppURL "https://edcd.github.io/"
#define SuppURL "https://github.com/EDCD/EDMarketConnector/"
#define MyAppExeName "EDMarketConnector.exe"
[Setup]
AppId={{5E9AD4D3-0365-41D5-9586-9368745DD109}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#SuppURL}
AppUpdatesURL={#SuppURL}
AppCopyright=Copyright (C) 2015-2019 Jonathan Harris, 2020-2024 EDCD
AllowUNCPath=no
AllowNetworkDrive=no
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
DirExistsWarning=yes
AllowNoIcons=yes
OutputBaseFilename=EDMarketConnector_Installer_{#MyAppVersion}
SetupIconFile=dist.win32\EDMarketConnector.ico
Compression=lzma2/max
SolidCompression=yes
WizardStyle=modern
InfoBeforeFile=dist.win32\Changelog.md
OutputDir=.
LicenseFile=LICENSE
AlwaysShowDirOnReadyPage=yes
UninstallDisplayIcon={app}\{#MyAppExeName}
MinVersion=6.2
ChangesAssociations = yes
UsedUserAreasWarning = no
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "dist.win32\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "dist.win32\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{autoprograms}\{#MyAppLongName}"; Filename: "{app}\{#MyAppExeName}"; Comment: "EDMC";
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon;
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
;Check if a WiX-based installation exists. If so, kill it with fire.
[Code]
function EndsWith(SubText, Text: AnsiString): Boolean;
var
EndStr: string;
begin
Log('Starting');
EndStr := Copy(Text, Length(Text) - Length(SubText) + 1, Length(SubText));
Log(EndStr);
{ Use SameStr, if you need a case-sensitive comparison }
Result := SameText(SubText, EndStr);
end;
// EDMC didn't keep a consistant GUID during previous history. Due to that, we have to do this tomfoolery.
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
Uninstall: String;
OldWiX: Boolean;
S: AnsiString;
PowerShellOutputFile: String;
begin
if (CurStep = ssInstall) then
begin
PowerShellOutputFile := ExpandConstant('{tmp}\PowershellOutput.txt');
// Construct the PowerShell command and capture output to a file
Exec('powershell.exe', '-NoProfile -ExecutionPolicy Bypass -Command "Get-WmiObject -Class Win32_Product | where Name -eq ''Elite Dangerous Market Connector'' | select-object -expandproperty IdentifyingNumber" | Out-File -Encoding ASCII "' + PowerShellOutputFile + '"', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
begin
if LoadStringFromFile(PowerShellOutputFile, S) then
S:= Trim(S);
Log(S);
begin
OldWiX:=EndsWith('}', S);
if (OldWiX = True) then
begin
MsgBox('Warning: an old version of EDMC is installed! Please close EDMC while we remove the old version!', mbInformation, MB_OK);
Uninstall := '/x ' + S;
Exec('MsiExec.exe', Uninstall, '', SW_SHOW, ewWaitUntilTerminated, ResultCode);
end;
end;
end;
end;
end;
[Registry]
; Create the main registry key under HKCR
Root: HKCR; Subkey: "edmc"; Flags: uninsdeletekey
; Create a default value under the "edmc" key
Root: HKCR; Subkey: "edmc"; ValueType: string; ValueName: ""; ValueData: "{#MyAppName}"; Flags: uninsdeletekey
; Create the "URL Protocol" value under the "edmc" key
Root: HKCR; Subkey: "edmc"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""; Flags: uninsdeletekey
; Create the "DefaultIcon" subkey under the "edmc" key
Root: HKCR; Subkey: "edmc\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\EDMarketConnector.exe,0"; Flags: uninsdeletekey
; Create the "shell" subkey under the "edmc" key
Root: HKCR; Subkey: "edmc\shell"; Flags: uninsdeletekey
; Create the "open" subkey under the "shell" subkey
Root: HKCR; Subkey: "edmc\shell\open"; Flags: uninsdeletekey
; Create the "command" subkey under the "open" subkey
Root: HKCR; Subkey: "edmc\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\EDMarketConnector.exe"" ""%1"""; Flags: uninsdeletekey
; Create the "ddeexec" subkey under the "open" subkey
Root: HKCR; Subkey: "edmc\shell\open\ddeexec"; ValueType: string; ValueName: ""; ValueData: "Open(""%1"")"; Flags: uninsdeletekey
; Create WinSparkle related keys for update values
Root: HKCU; Subkey: "Software\EDCD\EDMarketConnector"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\EDCD\EDMarketConnector\WinSparkle"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\EDCD\EDMarketConnector\WinSparkle"; ValueType: string; ValueName: "UpdateInterval"; ValueData: "{#MyAppUpdateTime}"; Flags: createvalueifdoesntexist
Root: HKCU; Subkey: "Software\EDCD\EDMarketConnector\WinSparkle"; ValueType: string; ValueName: "CheckForUpdates"; ValueData: "1"; Flags: createvalueifdoesntexist
[InstallDelete]
Type: filesandordirs; Name: "{app}"