-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclonedeploysetup.iss
More file actions
380 lines (325 loc) · 18.8 KB
/
clonedeploysetup.iss
File metadata and controls
380 lines (325 loc) · 18.8 KB
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
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
#define MyAppName "CloneDeploy"
#define MyAppVersion "1.3.0"
#define MyAppPublisher "CloneDeploy"
#define MyAppURL "http://clonedeploy.org"
[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={{5B2CCC5E-D36F-4FEC-A785-5D6A70347714}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf32}\clonedeploy
DisableDirPage=true
DefaultGroupName={#MyAppName}
DisableProgramGroupPage=true
LicenseFile=package\pf32\License.txt
OutputBaseFilename=setup
Compression=lzma
SolidCompression=true
Uninstallable=true
VersionInfoVersion=1.3.0
VersionInfoCompany=CloneDeploy
VersionInfoDescription=CloneDeploy Server Setup
VersionInfoCopyright=2016
AlwaysRestart=false
RestartIfNeededByRun=false
AppContact=http://clonedeploy.org
UninstallDisplayName=CloneDeploy Server
AppVerName=1.3.0
AppComments=CloneDeploy
MinVersion=0,6.1
SetupLogging=yes
DisableWelcomePage=no
UninstallDisplayIcon={uninstallexe}
[Languages]
Name: english; MessagesFile: compiler:Default.isl
[Files]
Source: package\pf32\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs; AfterInstall: UpdateStrings
Source: package\appdata\*; DestDir: {userappdata}; Flags: ignoreversion recursesubdirs createallsubdirs
Source: CloneDeploy.url; DestDir: {userdesktop};
[Run]
;Create Shares
Filename: cmd; Parameters: "/c net user cd_share_ro {code:GetROPass} /add"; StatusMsg: "Creating Share Users";
Filename: cmd; Parameters: "/c net user cd_share_rw {code:GetRWPass} /add"; StatusMsg: "Creating Share Users";
Filename: cmd; Parameters: "/c WMIC USERACCOUNT WHERE ""Name='cd_share_ro'"" SET PasswordExpires=FALSE"; StatusMsg: "Creating Share Users";
Filename: cmd; Parameters: "/c WMIC USERACCOUNT WHERE ""Name='cd_share_rw'"" SET PasswordExpires=FALSE"; StatusMsg: "Creating Share Users";
Filename: cmd; Parameters: "/c net share ""cd_share={app}\cd_dp"" /grant:cd_share_ro,READ /grant:cd_share_rw,FULL"; StatusMsg: "Creating SMB Shares";
Filename: cmd; Parameters: "/c icacls ""{app}\cd_dp"" /T /C /grant cd_share_ro:(OI)(CI)RX /grant cd_share_rw:(OI)(CI)F"; StatusMsg: "Creating SMB Shares";
;Install MariaDB
Filename: msiexec; Parameters: "/i ""{userappdata}\clonedeploy\mariadb-10.2.8-win32.msi"" SERVICENAME=mysql-cd PASSWORD={code:GetDBPass} UTF8=1 /qb"; StatusMsg: "Installing MariaDB";
Filename: "{pf32}\MariaDB 10.2\bin\mysql.exe"; Parameters: "--user=root --password={code:GetDBPass} --execute=""create database clonedeploy"" -v"; StatusMsg: "Creating Database";
Filename: "{pf32}\MariaDB 10.2\bin\mysql.exe"; Parameters: "--user=root --password={code:GetDBPass} --database=clonedeploy --execute=""source {code:MySQLAppData}/clonedeploy/cd.sql"" -v"; StatusMsg: "Creating Database";
;Install Tftpd32
Filename: {app}\tftpd32\tftpd32_svc; Parameters: "-install"; StatusMsg: "Setting Up Tftp Server";
Filename: cmd; Parameters: "/c sc config tftpd32_svc start= auto"; StatusMsg: "Setting Up Tftp Server";
Filename: cmd; Parameters: "/c net start tftpd32_svc"; StatusMsg: "Setting Up Tftp Server";
;Install IIS Win7
Filename: cmd; Parameters: "/c dism /online /enable-feature /featurename:IIS-WebServerRole /featurename:IIS-WebServer /featurename:IIS-ISAPIFilter /featurename:IIS-ISAPIExtensions /featurename:IIS-NetFxExtensibility /featurename:IIS-ASPNET /norestart"; StatusMsg: "Installing IIS"; Flags: 32bit; Check: not IsWin64 and IsWin7;
Filename: cmd; Parameters: "/c dism /online /enable-feature /featurename:IIS-WebServerRole /featurename:IIS-WebServer /featurename:IIS-ISAPIFilter /featurename:IIS-ISAPIExtensions /featurename:IIS-NetFxExtensibility /featurename:IIS-ASPNET /norestart"; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsWin64 and IsWin7;
;Install IIS Win8 or Win10
Filename: cmd; Parameters: "/c powershell -command ""enable-windowsoptionalfeature -online -featurename iis-webserverrole -norestart;enable-windowsoptionalfeature -online -featurename iis-webserver -norestart;enable-windowsoptionalfeature -online -featurename iis-isapifilter -norestart;enable-windowsoptionalfeature -online -featurename iis-isapiextensions -norestart; enable-windowsoptionalfeature -online -featurename netfx4extended-aspnet45 -norestart; enable-windowsoptionalfeature -online -featurename iis-netfxextensibility45 -norestart;enable-windowsoptionalfeature -online -featurename iis-aspnet45 -all -norestart;"""; StatusMsg: "Installing IIS"; Flags: 32bit; Check: not IsWin64 and (IsWin8 or IsWin10);
Filename: cmd; Parameters: "/c powershell -command ""enable-windowsoptionalfeature -online -featurename iis-webserverrole -norestart;enable-windowsoptionalfeature -online -featurename iis-webserver -norestart;enable-windowsoptionalfeature -online -featurename iis-isapifilter -norestart;enable-windowsoptionalfeature -online -featurename iis-isapiextensions -norestart; enable-windowsoptionalfeature -online -featurename netfx4extended-aspnet45 -norestart; enable-windowsoptionalfeature -online -featurename iis-netfxextensibility45 -norestart;enable-windowsoptionalfeature -online -featurename iis-aspnet45 -all -norestart;"""; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsWin64 and (IsWin8 or IsWin10);
;Install IIS Server 2008
Filename: servermanagercmd; Parameters: "-install web-server"; StatusMsg: "Installing IIS"; Flags: 32bit; Check: not IsWin64 and IsServer2008;
Filename: servermanagercmd; Parameters: "-install web-server"; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsWin64 and IsServer2008;
Filename: servermanagercmd; Parameters: "-install web-asp-net"; StatusMsg: "Installing IIS"; Flags: 32bit; Check: not IsWin64 and IsServer2008;
Filename: servermanagercmd; Parameters: "-install web-asp-net"; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsWin64 and IsServer2008;
;Install IIS Server 2012
Filename: cmd; Parameters: "/c powershell -command ""import-module servermanager; add-windowsfeature web-server"""; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsServer2012;
Filename: cmd; Parameters: "/c powershell -command ""import-module servermanager; add-windowsfeature web-asp-net"""; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsServer2012;
Filename: cmd; Parameters: "/c powershell -command ""import-module servermanager; add-windowsfeature web-asp-net45"""; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsServer2012;
Filename: cmd; Parameters: "/c powershell -command ""import-module servermanager; add-windowsfeature web-mgmt-console"""; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsServer2012;
;Install IIS Server 2016
Filename: cmd; Parameters: "/c powershell -command ""import-module servermanager; add-windowsfeature web-server"""; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsServer2016;
Filename: cmd; Parameters: "/c powershell -command ""import-module servermanager; add-windowsfeature web-asp-net45"""; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsServer2016;
Filename: cmd; Parameters: "/c powershell -command ""import-module servermanager; add-windowsfeature web-mgmt-console"""; StatusMsg: "Installing IIS"; Flags: 64bit; Check: IsServer2016;
;Create Web Application
Filename: cmd; Parameters: "/c {sys}\inetsrv\appcmd add app /site.name:""Default Web Site"" /path:/clonedeploy /physicalpath:""{app}\frontend"" ";
Filename: cmd; Parameters: "/c {sys}\inetsrv\appcmd add app /site.name:""Default Web Site"" /path:/clonedeploy/api /physicalpath:""{app}\application"" ";
;Register Web Application
Filename: cmd; Parameters: "/c {win}\microsoft.net\framework\v4.0.30319\aspnet_regiis.exe -i -enable"; Check: IsWin7 or IsServer2008;
;Set IIS Permissions
Filename: cmd; Parameters: "/c icacls ""{app}\application"" /T /C /grant IIS_IUSRS:(OI)(CI)M"; StatusMsg: "Installing IIS";Filename: cmd; Parameters: "/c icacls ""{app}\frontend"" /T /C /grant IIS_IUSRS:(OI)(CI)M"; StatusMsg: "Installing IIS";
Filename: cmd; Parameters: "/c icacls ""{app}\cd_dp"" /T /C /grant IIS_IUSRS:(OI)(CI)M"; StatusMsg: "Installing IIS";
Filename: cmd; Parameters: "/c icacls ""{app}\tftpboot"" /T /C /grant IIS_IUSRS:(OI)(CI)M"; StatusMsg: "Installing IIS";
;Setup Firewall
Filename: cmd; Parameters: "/c netsh advfirewall firewall add rule name=dhcps dir=in action=allow protocol=UDP localport=67 profile=any "; StatusMsg: "Creating Firewall Exceptions";
Filename: cmd; Parameters: "/c netsh advfirewall firewall add rule name=dhcpd dir=in action=allow protocol=UDP localport=68 profile=any "; StatusMsg: "Creating Firewall Exceptions";
Filename: cmd; Parameters: "/c netsh advfirewall firewall add rule name=tftp dir=in action=allow protocol=UDP localport=69 profile=any "; StatusMsg: "Creating Firewall Exceptions";
Filename: cmd; Parameters: "/c netsh advfirewall firewall add rule name=http dir=in action=allow protocol=TCP localport=80 profile=any "; StatusMsg: "Creating Firewall Exceptions";
Filename: cmd; Parameters: "/c netsh advfirewall firewall add rule name=https dir=in action=allow protocol=TCP localport=443 profile=any "; StatusMsg: "Creating Firewall Exceptions";
Filename: cmd; Parameters: "/c netsh advfirewall firewall add rule name=proxyd dir=in action=allow protocol=UDP localport=4011 profile=any "; StatusMsg: "Creating Firewall Exceptions";
Filename: cmd; Parameters: "/c netsh advfirewall firewall add rule name=udp-sender dir=in action=allow program=""{app}\web\private\apps\udp-sender.exe"" enable=yes profile=any "; StatusMsg: "Creating Firewall Exceptions";
Filename: cmd; Parameters: "/c netsh advfirewall firewall add rule name=udp-sender dir=out action=allow program=""{app}\web\private\apps\udp-sender.exe"" enable=yes profile=any "; StatusMsg: "Creating Firewall Exceptions";
Filename: cmd; Parameters: "/c netsh advfirewall firewall set rule group=""File and Printer Sharing"" new enable=Yes"; StatusMsg: "Creating Firewall Exceptions";
;Create Symlinks For ProxyDHCP
Filename: cmd; Parameters: "/c mklink /J ""{app}\tftpboot\proxy\bios\kernels"" ""{app}\tftpboot\kernels"""; StatusMsg: "Creating Symlinks";
Filename: cmd; Parameters: "/c mklink /J ""{app}\tftpboot\proxy\bios\images"" ""{app}\tftpboot\images"""; StatusMsg: "Creating Symlinks";
Filename: cmd; Parameters: "/c mklink /J ""{app}\tftpboot\proxy\efi32\kernels"" ""{app}\tftpboot\kernels"""; StatusMsg: "Creating Symlinks";
Filename: cmd; Parameters: "/c mklink /J ""{app}\tftpboot\proxy\efi32\images"" ""{app}\tftpboot\images"""; StatusMsg: "Creating Symlinks";
Filename: cmd; Parameters: "/c mklink /J ""{app}\tftpboot\proxy\efi64\kernels"" ""{app}\tftpboot\kernels"""; StatusMsg: "Creating Symlinks";
Filename: cmd; Parameters: "/c mklink /J ""{app}\tftpboot\proxy\efi64\images"" ""{app}\tftpboot\images"""; StatusMsg: "Creating Symlinks";
[Registry]
Root: "HKLM32"; Subkey: "SOFTWARE\CloneDeploy"; ValueType: string; ValueName: "AppVersion"; ValueData: "1300"; Flags: createvalueifdoesntexist; Check: not IsWin64
Root: "HKLM64"; Subkey: "SOFTWARE\CloneDeploy"; ValueType: string; ValueName: "AppVersion"; ValueData: "1300"; Flags: createvalueifdoesntexist; Check: IsWin64
[Code]
var
AuthPage : TInputQueryWizardPage;
InstallType : String;
procedure InitializeWizard;
begin
AuthPage := CreateInputQueryPage(wpWelcome,
'Setup', 'Information Needed',
'A Read Only And Read/Write SMB Share Will Be Created. Create A Password For Each. Also Create A Database Password. Do Not Use The Following Characters < > " Ampersand '+Chr(39)+'');
AuthPage.Add('Share Read Only Password: (Complexity Requirements Apply To Server versions)', True);
AuthPage.Add('Share Read Write Password: (Complexity Requirements Apply To Server versions)', True);
AuthPage.Add('Database Password:', True);
end;
function IsWin7(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
if (Version.Major = 6) and
(Version.Minor = 1) and
(Version.ProductType = VER_NT_WORKSTATION)
then
Result := True
else
Result := False
end;
function IsWin8(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
if (Version.Major = 6) and
((Version.Minor = 2) or (Version.Minor = 3)) and
(Version.ProductType = VER_NT_WORKSTATION)
then
Result := True
else
Result := False
end;
function IsWin10(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
Log('The value is');
if (Version.Major = 10) and
(Version.Minor = 0) and
(Version.ProductType = VER_NT_WORKSTATION)
then
Result := True
else
Result := False
end;
function IsServer2008(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
if (Version.Major = 6) and
((Version.Minor = 0) or (Version.Minor = 1)) and
(Version.ProductType = VER_NT_SERVER)
then
Result := True
else
Result := False
end;
function IsServer2012(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
if (Version.Major = 6) and
((Version.Minor = 2) or (Version.Minor = 3)) and
(Version.ProductType = VER_NT_SERVER)
then
Result := True
else
Result := False
end;
function IsServer2016(): Boolean;
var
Version: TWindowsVersion;
begin
GetWindowsVersionEx(Version);
Log('The value is');
if (Version.Major = 10) and
(Version.Minor = 0) and
(Version.ProductType = VER_NT_SERVER)
then
Result := True
else
Result := False
end;
function GetROPass(Param: String): string;
begin
result := AuthPage.Values[0];
end;
function GetRWPass(Param: String): string;
begin
result := AuthPage.Values[1];
end;
function GetDBPass(Param: String): string;
begin
result := AuthPage.Values[2];
end;
procedure UpdateStrings;
var
FileData: String;
begin
LoadStringFromFile(ExpandConstant('{app}\application\web.config'), FileData);
StringChange(FileData, 'xx_marker1_xx', ExpandConstant('{code:GetDBPass}'));
SaveStringToFile(ExpandConstant('{app}\application\web.config'), FileData, False);
LoadStringFromFile(ExpandConstant('{app}\application\web.config'), FileData);
StringChange(FileData, 'xx_marker2_xx', ExpandConstant('{code:GetROPass}{code:GetRWPass}'));
SaveStringToFile(ExpandConstant('{app}\application\web.config'), FileData, False);
LoadStringFromFile(ExpandConstant('{app}\tftpd32\tftpd32.ini'), FileData);
StringChange(FileData, 'xx_marker1_xx', ExpandConstant('{app}\tftpboot'));
SaveStringToFile(ExpandConstant('{app}\tftpd32\tftpd32.ini'), FileData, False);
end;
function MySQLAppData(Param: String): string;
var
mysqlapp: string;
begin
mysqlapp := expandconstant('{userappdata}');
StringChange(mysqlapp, '\', '/');
result := mysqlapp
end;
function IsDotNetDetected(version: string; service: cardinal): boolean;
// Indicates whether the specified version and service pack of the .NET Framework is installed.
//
// version -- Specify one of these strings for the required .NET Framework version:
// 'v1.1' .NET Framework 1.1
// 'v2.0' .NET Framework 2.0
// 'v3.0' .NET Framework 3.0
// 'v3.5' .NET Framework 3.5
// 'v4\Client' .NET Framework 4.0 Client Profile
// 'v4\Full' .NET Framework 4.0 Full Installation
// 'v4.5' .NET Framework 4.5
// 'v4.5.1' .NET Framework 4.5.1
// 'v4.5.2' .NET Framework 4.5.2
// 'v4.6' .NET Framework 4.6
// 'v4.6.1' .NET Framework 4.6.1
//
// service -- Specify any non-negative integer for the required service pack level:
// 0 No service packs required
// 1, 2, etc. Service pack 1, 2, etc. required
var
key, versionKey: string;
install, release, serviceCount, versionRelease: cardinal;
success: boolean;
begin
versionKey := version;
versionRelease := 0;
// .NET 1.1 and 2.0 embed release number in version key
if version = 'v1.1' then begin
versionKey := 'v1.1.4322';
end else if version = 'v2.0' then begin
versionKey := 'v2.0.50727';
end
// .NET 4.5 and newer install as update to .NET 4.0 Full
else if Pos('v4.', version) = 1 then begin
versionKey := 'v4\Full';
case version of
'v4.5': versionRelease := 378389;
'v4.5.1': versionRelease := 378675; // or 378758 on Windows 8 and older
'v4.5.2': versionRelease := 379893;
'v4.6': versionRelease := 393295; // or 393297 on Windows 8.1 and older
'v4.6.1': versionRelease := 394254; // or 394271 on Windows 8.1 and older
end;
end;
// installation key group for all .NET versions
key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;
// .NET 3.0 uses value InstallSuccess in subkey Setup
if Pos('v3.0', version) = 1 then begin
success := RegQueryDWordValue(HKLM, key + '\Setup', 'InstallSuccess', install);
end else begin
success := RegQueryDWordValue(HKLM, key, 'Install', install);
end;
// .NET 4.0 and newer use value Servicing instead of SP
if Pos('v4', version) = 1 then begin
success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
end else begin
success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
end;
// .NET 4.5 and newer use additional value Release
if versionRelease > 0 then begin
success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
success := success and (release >= versionRelease);
end;
result := success and (install = 1) and (serviceCount >= service);
end;
function InitializeSetup(): Boolean;
begin
MsgBox('Warning: This Installer Is Only For New Installations.'#13#13
'If You Are Upgrading, Exit Now And Follow The Upgrade Documentation.'#13
'See http://clonedeploy.org for more info', mbInformation, MB_OK);
if not IsDotNetDetected('v4.5', 0) then begin
MsgBox('Clone Deploy requires Microsoft .NET Framework 4.5.'#13#13
'See http://clonedeploy.org for more info.'#13
'Run setup again after installation.', mbInformation, MB_OK);
Result := False;
Exit;
end
Result := True;
end;
procedure DeinitializeSetup();
var
logfilepathname, logfilename, newfilepathname: string;
begin
logfilepathname := expandconstant('{log}');
logfilename := ExtractFileName(logfilepathname);
// Set the new target path as the directory where the installer is being run from
newfilepathname := expandconstant('{src}\') +logfilename;
filecopy(logfilepathname, newfilepathname, false);
end;