forked from marticliment/UniGetUI
-
Notifications
You must be signed in to change notification settings - Fork 1
/
WingetUI.iss
269 lines (242 loc) · 11.4 KB
/
WingetUI.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "WingetUI"
#define MyAppVersion "3.0-beta0"
#define MyAppPublisher "Martí Climent"
#define MyAppURL "https://github.com/marticliment/WingetUI"
#define MyAppExeName "WingetUI.exe"
[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.)
UninstallDisplayName="WingetUI"
AppId={{889610CC-4337-4BDB-AC3B-4F21806C0BDE}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL='https://www.marticliment.com/'
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
VersionInfoVersion=3.0.0.0
DefaultDirName="{autopf64}\WingetUI"
DisableProgramGroupPage=yes
DisableDirPage=no
DirExistsWarning=no
CloseApplications=no
; Remove the following line to run in administrative install mode (install for all users.)
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputBaseFilename=WingetUI Installer
OutputDir=.
MinVersion=10.0
SetupIconFile=src\wingetui\Assets\Images\icon.ico
UninstallDisplayIcon={app}\WingetUI.exe
Compression=lzma
SolidCompression=yes
WizardStyle=classic
WizardImageFile=InstallerExtras\INSTALLER.BMP
WizardSmallImageFile=src\wingetui\Assets\Images\icon.bmp
DisableWelcomePage=no
AllowUNCPath=no
UsePreviousTasks=yes
UsePreviousPrivileges=yes
UsePreviousAppDir=yes
ChangesEnvironment=yes
RestartIfNeededByRun=no
Uninstallable=IsTaskSelected('regularinstall')
[Languages]
Name: "English"; MessagesFile: "compiler:Default.isl"
Name: "Armenian"; MessagesFile: "compiler:Languages\Armenian.isl"
Name: "BrazilianPortuguese"; MessagesFile: "compiler:Languages\BrazilianPortuguese.isl"
Name: "Catalan"; MessagesFile: "compiler:Languages\Catalan.isl"
Name: "Corsican"; MessagesFile: "compiler:Languages\Corsican.isl"
Name: "Czech"; MessagesFile: "compiler:Languages\Czech.isl"
Name: "Danish"; MessagesFile: "compiler:Languages\Danish.isl"
Name: "Dutch"; MessagesFile: "compiler:Languages\Dutch.isl"
Name: "Finnish"; MessagesFile: "compiler:Languages\Finnish.isl"
Name: "French"; MessagesFile: "compiler:Languages\French.isl"
Name: "German"; MessagesFile: "compiler:Languages\German.isl"
Name: "Hebrew"; MessagesFile: "compiler:Languages\Hebrew.isl"
Name: "Icelandic"; MessagesFile: "compiler:Languages\Icelandic.isl"
Name: "Italian"; MessagesFile: "compiler:Languages\Italian.isl"
Name: "Japanese"; MessagesFile: "compiler:Languages\Japanese.isl"
Name: "Korean"; MessagesFile: "compiler:Languages\Korean.isl"
Name: "Norwegian"; MessagesFile: "compiler:Languages\Norwegian.isl"
Name: "Polish"; MessagesFile: "compiler:Languages\Polish.isl"
Name: "Portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "Russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "Slovenian"; MessagesFile: "compiler:Languages\Slovenian.isl"
Name: "Spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "Turkish"; MessagesFile: "compiler:Languages\Turkish.isl"
Name: "Ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
; Include installer's messages
#include "InstallerExtras\CustomMessages.iss"
[InstallDelete]
Type: filesandordirs; Name: "{app}\*.pyc"; BeforeInstall: TripleKill('WingetUI.exe', 'winget.exe', 'choco.exe');
Type: filesandordirs; Name: "{app}\PySide6\*"; BeforeInstall: TripleKill('WingetUI.exe', 'winget.exe', 'choco.exe');
Type: filesandordirs; Name: "{app}\wingetui\*";
Type: filesandordirs; Name: "{app}\toasts_winrt\*";
Type: filesandordirs; Name: "{app}\shiboken6\*";
Type: filesandordirs; Name: "{app}\pythonnet\*";
Type: filesandordirs; Name: "{app}\clr_loader\*";
Type: filesandordirs; Name: "{app}\markupsafe\*";
Type: filesandordirs; Name: "{app}\flask*\*";
Type: filesandordirs; Name: "{app}\yaml\*";
Type: filesandordirs; Name: "{app}\pip-23.0.dist-info";
Type: filesandordirs; Name: "{app}\pip-23.1.2.dist-info";
Type: filesandordirs; Name: "{app}\setuptools-65.5.0.dist-info";
Type: filesandordirs; Name: "{app}\*.dll";
Type: filesandordirs; Name: "{app}\*.pyd";
Type: filesandordirs; Name: "{app}\*.zip";
Type: filesandordirs; Name: "{app}\sudo";
Type: filesandordirs; Name: "{app}\winget-cli\*";
Type: filesandordirs; Name: "{app}\:\*";
[UninstallDelete]
Type: filesandordirs; Name: "{userpf}\WingetUI\*"; BeforeInstall: TripleKill('WingetUI.exe', 'winget.exe', 'choco.exe');
Type: filesandordirs; Name: "{app}\*"; BeforeInstall: TripleKill('WingetUI.exe', 'winget.exe', 'choco.exe');
Type: filesandordirs; Name: "{app}\*.pyc"; BeforeInstall: TripleKill('WingetUI.exe', 'winget.exe', 'choco.exe');
Type: filesandordirs; Name: "{app}\PySide6\*"; BeforeInstall: TripleKill('WingetUI.exe', 'winget.exe', 'choco.exe');
Type: filesandordirs; Name: "{app}\wingetui\*";
Type: filesandordirs; Name: "{app}\toasts_winrt\*";
Type: filesandordirs; Name: "{app}\shiboken6\*";
Type: filesandordirs; Name: "{app}\pythonnet\*";
Type: filesandordirs; Name: "{app}\clr_loader\*";
Type: filesandordirs; Name: "{app}\markupsafe\*";
Type: filesandordirs; Name: "{app}\flask*\*";
Type: filesandordirs; Name: "{app}\yaml\*";
Type: filesandordirs; Name: "{app}\pip-23.0.dist-info";
Type: filesandordirs; Name: "{app}\pip-23.1.2.dist-info";
Type: filesandordirs; Name: "{app}\setuptools-65.5.0.dist-info";
Type: filesandordirs; Name: "{app}\*.dll";
Type: filesandordirs; Name: "{app}\*.pyd";
Type: filesandordirs; Name: "{app}\*.zip";
Type: filesandordirs; Name: "{app}\sudo";
Type: filesandordirs; Name: "{app}\winget-cli\*";
Type: filesandordirs; Name: "{app}\:\*";
[Code]
procedure InitializeWizard;
begin
WizardForm.Bevel.Visible := False;
WizardForm.Bevel1.Visible := True;
end;
procedure TaskKill(FileName: String);
var
ResultCode: Integer;
begin
Exec('taskkill.exe', '/f /im ' + '"' + FileName + '"', '', SW_HIDE,
ewWaitUntilTerminated, ResultCode);
end;
procedure TripleKill(FileName1: String; FileName2: String; FileName3: String);
var
ResultCode: Integer;
begin
Exec('taskkill.exe', '/f /im ' + '"' + FileName1 + '"', '', SW_HIDE,
ewWaitUntilTerminated, ResultCode);
Exec('taskkill.exe', '/f /im ' + '"' + FileName2 + '"', '', SW_HIDE,
ewWaitUntilTerminated, ResultCode);
Exec('taskkill.exe', '/f /im ' + '"' + FileName3 + '"', '', SW_HIDE,
ewWaitUntilTerminated, ResultCode);
end;
function VCRedistNeedsInstall: Boolean;
var
status: Cardinal;
begin
if RegQueryDwordValue(HKEY_LOCAL_MACHINE,
'SOFTWARE\Microsoft\VisualStudio\14.0\VC\Runtimes\x64', 'Installed',
status) then
begin
// Is the installed version at least 14.14 ?
Log('VC Redist check');
Log(IntToStr(status));
Result := (status<=0);
end
else
begin
// Not even an old version installed
Result := True;
end;
if (Result) then
begin
ExtractTemporaryFile('vcredist.exe');
end;
end;
function CmdLineParamExists(const Value: string): Boolean;
var
I: Integer;
begin
Result := False;
for I := 1 to ParamCount do
if CompareText(ParamStr(I), Value) = 0 then
begin
Result := True;
Exit;
end;
end;
var CustomExitCode: integer;
procedure ExitProcess(exitCode:integer);
external 'ExitProcess@kernel32.dll stdcall';
procedure DeinitializeSetup();
begin
if (CustomExitCode <> 0) then
begin
DelTree(ExpandConstant('{tmp}'), True, True, True);
ExitProcess(0);
end;
end;
function IsCharValid(Value: Char): Boolean;
begin
Result := Ord(Value) <= $007F;
end;
function IsDirNameValid(const Value: string): Boolean;
var
I: Integer;
begin
Result := False;
for I := 1 to Length(Value) do
if not IsCharValid(Value[I]) then
Exit;
Result := True;
end;
function NextButtonClick(CurPageID: Integer): Boolean;
begin
Result := True;
if (CurPageID = wpSelectDir) and
not IsDirNameValid(WizardForm.DirEdit.Text) then
begin
Result := False;
MsgBox('There is an invalid character in the selected install location. ' +
'Install location cannot contain special characters. ' +
'Please input a valid path to continue, such as '+ExpandConstant('{commonpf64}')+'\WingetUI', mbError, MB_OK);
end;
end;
[Tasks]
Name: "portableinstall"; Description: "{cm:PortInst}"; GroupDescription: "{cm:InstallType}"; Flags: unchecked exclusive
Name: "regularinstall"; Description: "{cm:RegInst}"; GroupDescription: "{cm:InstallType}"; Flags: exclusive
Name: "regularinstall\startmenuicon"; Description: "{cm:RegStartMmenuIcon}"; GroupDescription: "{cm:ShCuts}";
Name: "regularinstall\desktopicon"; Description: "{cm:RegDesktopIcon}"; GroupDescription: "{cm:ShCuts}";
[Registry]
Root: HKCU; Subkey: "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; ValueName: "WingetUI"; ValueData: """{app}\WingetUI.exe"" --daemon"; Flags: uninsdeletevalue; Tasks: regularinstall
[Files]
Source: "src\wingetui\bin\x64\Release\net8.0-windows10.0.19041.0\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; BeforeInstall: TripleKill('WingetUI.exe', 'winget.exe', 'choco.exe');
Source: "src\wingetui\bin\x64\Release\net8.0-windows10.0.19041.0\*"; DestDir: "{app}"; Flags: createallsubdirs ignoreversion recursesubdirs;
Source: "src\wingetui\bin\x64\Release\net8.0-windows10.0.19041.0\choco-cli\*"; DestDir: "{userpf}\WingetUI\choco-cli"; Flags: createallsubdirs ignoreversion recursesubdirs uninsneveruninstall; Tasks: regularinstall
; MSVC++ redistributable runtime. Extracted by VC2017RedistNeedsInstall(), if needed.
Source: "InstallerExtras\vcredist.exe"; DestDir: {tmp}; Flags: deleteafterinstall
Source: "InstallerExtras\appsdk.exe"; DestDir: {tmp}; Flags: deleteafterinstall
Source: "InstallerExtras\net8.exe"; DestDir: {tmp}; Flags: deleteafterinstall
Source: "InstallerExtras\SegUIVar.ttf"; DestDir: "{autofonts}"; FontInstall: "Segoe UI Variable"; Flags: onlyifdoesntexist uninsneveruninstall
[Icons]
; Yes, they do have a space. This has been done in purpose for the updater to handle properly the new shortcuts
Name: "{autostartmenu}\{#MyAppName} "; Filename: "{app}\{#MyAppExeName}"; Tasks: regularinstall\startmenuicon
Name: "{autodesktop}\{#MyAppName} "; Filename: "{app}\{#MyAppExeName}"; Tasks: regularinstall\desktopicon
[Run]
Filename: "{tmp}\vcredist.exe"; Flags: runhidden; Parameters: "/install /norestart /passive"; StatusMsg: "Installing Microsoft Visual C++ Redistributables (x64)"; Check: VCRedistNeedsInstall;
Filename: "{tmp}\net8.exe"; Flags: runhidden; Parameters: "/silent"; StatusMsg: "Installing .NET 8 Runtime (x64)";
Filename: "{tmp}\appsdk.exe"; Flags: runhidden; Parameters: "--force"; StatusMsg: "Installing Windows App Sdk (x64)";
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: runasoriginaluser nowait postinstall;
; Check: not CmdLineParamExists('/NoAutoStart');
; Autostart is required to finish installation properly from an update, hence autostart will be obligatory
[UninstallRun]
; Remove WingetUI Notification registries
Filename: "{app}\{#MyAppExeName}"; Parameters: "--uninstall-wingetui"; Flags: skipifdoesntexist runhidden;
Filename: {sys}\taskkill.exe; Parameters: "/f /im WingetUI.exe"; Flags: skipifdoesntexist runhidden;