forked from cmorty/lejos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleJOS_NXJ_Installer.iss
216 lines (195 loc) · 8.26 KB
/
leJOS_NXJ_Installer.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
#preproc ispp
#if VER < EncodeVer(5,4,3)
#error Use Inno Setup 5.4.3(unicode) or newer
#endif
#ifndef UNICODE
#error Use the unicode build of Inno Setup
#endif
#ifndef MyAppVersion
#define MyAppVersion "0.9.1beta-2"
#endif
#define MinFantomVersion "1,1,3"
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
#define MyAppID "253252E2-EFAE-4AA8-96B6-0828619E536C"
[Setup]
AppId={{{#MyAppID}}
AppName=leJOS NXJ
AppVersion={#MyAppVersion}
AppVerName=leJOS NXJ {#MyAppVersion}
OutputBaseFilename=leJOS_NXJ_{#MyAppVersion}_win32_setup
AppPublisher=The leJOS Team
AppPublisherURL=http://www.lejos.org/
AppSupportURL=http://www.lejos.org/
AppUpdatesURL=http://www.lejos.org/
SetupIconFile=../org.lejos.website/htdocs/lejos.ico
DefaultDirName={pf}\leJOS NXJ
DefaultGroupName=leJOS NXJ
AllowNoIcons=true
SolidCompression=yes
Compression=lzma2/max
OutputDir=.
ChangesEnvironment=yes
MinVersion=0,5.0
WizardImageFile=img\WizardImage.bmp
WizardImageStretch=no
WizardImageBackColor=clWhite
WizardSmallImageFile=img\WizardSmallImage.bmp
UninstallFilesDir={app}\uninst
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[CustomMessages]
LaunchProgram=Launch NXJ Flash utility
JDKSelectCaption=Select a Java Development Kit
JDKSelectDescription=Select a Java Development Kit for use with leJOS NXJ
[Types]
Name: "compact"; Description: "Compact installation"
Name: "minimal"; Description: "Minimal installation"
Name: "full"; Description: "Full installation"
Name: "custom"; Description: "Custom installation"; Flags: iscustom
[Components]
Name: "main"; Description: "leJOS Development Kit"; Types: full compact minimal custom; Flags: fixed disablenouninstallwarning
Name: "docs"; Description: "Documentation"; Types: full compact; Flags: disablenouninstallwarning
Name: "docs\apinxt"; Description: "API Documentation (NXT)"; Types: full compact; Flags: disablenouninstallwarning
Name: "docs\apipc"; Description: "API Documentation (PC)"; Types: full compact; Flags: disablenouninstallwarning
Name: "extras"; Description: "Additional Sources"; Types: full; Flags: disablenouninstallwarning
Name: "extras\samples"; Description: "Sample and Example Projects"; Types: full; Flags: disablenouninstallwarning
Name: "extras\sources"; Description: "Sources of leJOS Development Kit"; Types: full; Flags: disablenouninstallwarning
[Files]
; Extract helper script to {app}, since {tmp} refers to the temp folder of the admin, and might
; not even be accessible by the original user when using postinstall/runasoriginaluser in [Run]
Source: "scripts\startNxjFlash.bat"; DestDir: "{app}"; Flags: deleteafterinstall
Source: "..\release\build\bin_windows\*"; DestDir: "{app}"; Excludes: "docs"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: main
Source: "..\release\build\bin_windows\docs\pc\*"; DestDir: "{app}\docs\pc"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: docs\apipc
Source: "..\release\build\bin_windows\docs\nxt\*"; DestDir: "{app}\docs\nxt"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: docs\apinxt
Source: "..\release\build\samples\*"; DestDir: "{code:ExtrasDirPage_GetSamplesFolder}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: extras\samples
Source: "..\release\build\source\*"; DestDir: "{code:ExtrasDirPage_GetSourcesFolder}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: extras\sources
[Icons]
Name: "{group}\API Documentation (PC)"; Filename: "{app}\docs\pc\index.html"; Components: docs\apipc
Name: "{group}\API Documentation (NXT)"; Filename: "{app}\docs\nxt\index.html"; Components: docs\apinxt
Name: "{group}\NXJ Flash"; Filename: "{app}\bin\nxjflashg.bat"; Flags: closeonexit runminimized
Name: "{group}\NXJ Browse"; Filename: "{app}\bin\nxjbrowse.bat"; Flags: closeonexit runminimized
Name: "{group}\NXJ Charting Logger"; Filename: "{app}\bin\nxjchartinglogger.bat"; Flags: closeonexit runminimized
Name: "{group}\NXJ Control"; Filename: "{app}\bin\nxjcontrol.bat"; Flags: closeonexit runminimized
Name: "{group}\NXJ Console Viewer"; Filename: "{app}\bin\nxjconsoleviewer.bat"; Flags: closeonexit runminimized
Name: "{group}\NXJ Data Viewer"; Filename: "{app}\bin\nxjdataviewer.bat"; Flags: closeonexit runminimized
Name: "{group}\NXJ Image Convertor"; Filename: "{app}\bin\nxjimage.bat"; Flags: closeonexit runminimized
Name: "{group}\NXJ Map Command"; Filename: "{app}\bin\nxjmapcommand.bat"; Flags: closeonexit runminimized
Name: "{group}\NXJ Monitor"; Filename: "{app}\bin\nxjmonitor.bat"; Flags: closeonexit runminimized
Name: "{group}\Uninstall LeJOS"; Filename: "{uninstallexe}"
[Registry]
; Delete LEJOS_NXT_JAVA_HOME and NXJ_HOME value for current user and set new value globally
Root: HKCU; Subkey: "Environment"; ValueType: none; ValueName: "NXJ_HOME"; Flags: deletevalue
Root: HKCU; Subkey: "Environment"; ValueType: none; ValueName: "LEJOS_NXT_JAVA_HOME"; Flags: deletevalue
[Run]
; startNxjFlash.bat will terminate immediately, and hence we don't use the nowait flag.
; Not using the nowait flag also makes sure that the batch file can be deleted successfully.
WorkingDir: "{app}"; Filename: "{app}\startNxjFlash.bat"; Parameters: "{code:JDKSelect_GetSelectionQuoted}"; Description: "{cm:LaunchProgram}"; Flags: postinstall skipifsilent runhidden
#include "include\Tools.iss"
#include "include\Fantom.iss"
#include "include\ModPath.iss"
#include "include\JDKSelect.iss"
#include "include\ExtrasDirPage.iss"
#include "include\UnInstall.iss"
[Code]
function JDKSelect_GetSelectionQuoted(Param: String): String;
begin
Result := AddQuotes(JDKSelect_GetSelection(Param));
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
Data: String;
begin
if CurStep = ssPostInstall then
begin
try
GetEnvVar('Path', Data);
SetExpEnvVar('Path', ModPath_Append(Data, ExpandConstant('{app}\bin')));
except
ShowExceptionMessage;
end;
try
SetEnvVar('NXJ_HOME', ExpandConstant('{app}'));
except
ShowExceptionMessage;
end;
try
SetEnvVar('LEJOS_NXT_JAVA_HOME', JDKSelect_GetSelection('dummy param'));
except
ShowExceptionMessage;
end;
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
var
Data: String;
begin
if CurUninstallStep = usUninstall then
begin
try
GetEnvVar('Path', Data);
SetEnvVar('Path', ModPath_Delete(Data, ExpandConstant('{app}\bin')));
except
ShowExceptionMessage;
end;
try
DeleteEnvVar('NXJ_HOME');
except
ShowExceptionMessage;
end;
try
DeleteEnvVar('LEJOS_NXT_JAVA_HOME');
except
ShowExceptionMessage;
end;
end;
end;
function NextButtonClick(curPageID: Integer): Boolean;
var
ID : String;
begin
if curPageID = wpWelcome then
begin
Result := DetectOutdatedFantom({#MinFantomVersion});
if not Result then Exit;
end;
if curPageID = wpReady then
begin
ID := '{#MyAppID}'
Result := UninstallInstallJammer(ID);
if not Result then Exit;
Result := UninstallInnoSetup(ID);
if not Result then Exit;
end;
Result := true;
end;
function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
begin
Result := MemoDirInfo + NewLine;
if IsComponentSelected('extras\samples') then
begin
Result := Result + Space + ExtrasDirPage_GetSamplesFolder('') + NewLine;
end;
if IsComponentSelected('extras\sources') then
begin
Result := Result + Space + ExtrasDirPage_GetSourcesFolder('') + NewLine;
end;
if MemoGroupInfo > '' then
begin
Result := Result + NewLine;
Result := Result + MemoGroupInfo + NewLine;
end;
Result := Result + NewLine;
Result := Result + MemoTypeInfo + NewLine;
Result := Result + NewLine;
Result := Result + MemoComponentsInfo + NewLine;
// Result := Result + NewLine;
// Result := Result + MemoTasksInfo + NewLine;
end;
procedure InitializeWizard();
begin
JDKSelect_CreatePage(wpUserInfo);
ExtrasDirPage_CreatePage(wpSelectComponents);
end;
//#expr SaveToFile("debug.iss")