Debian Codegraph @

builds/install/arch-specific/win32/FirebirdInstall.iss

raw
1 ; Initial Developer's Public License.
2 ; The contents of this file are subject to the Initial Developer's Public
3 ; License Version 1.0 (the "License"). You may not use this file except
4 ; in compliance with the License. You may obtain a copy of the License at
5 ; http://www.ibphoenix.com?a=ibphoenix&page=ibp_idpl
6 ; Software distributed under the License is distributed on an "AS IS" basis,
7 ; WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
8 ; for the specific language governing rights and limitations under the
9 ; License.
10 ;
11 ; The Original Code is copyright 2001-2024 Paul Reeves for IBPhoenix.
12 ;
13 ; The Initial Developer of the Original Code is Paul Reeves for IBPhoenix.
14 ;
15 ; All Rights Reserved.
16 ;
17 ; Contributor(s):
18 ; Tilo Muetze, Theo ? and Michael Rimov for improved detection
19 ; of an existing install directory.
20 ; Simon Carter for the WinSock2 detection.
21 ; Philippe Makowski for internationalization and french translation
22 ; Sergey Nikitin for migrating to ISS v5.
23
24 ; Usage Notes:
25 ;
26 ; This script has been designed to work with Inno Setup v6.2.1
27 ; It is available as a quick start pack from here:
28 ; https://www.jrsoftware.org/isdl.php
29 ;
30 ;
31 ; Known bugs and problems etc etc.
32 ;
33 ; o The uninstaller can only uninstall what it installed.
34 ; For instance, if Firebird is installed as a service, but is actually
35 ; running as an application when the uninstaller is run then the
36 ; application will not be stopped and the uninstall will not complete
37 ; cleanly.
38 ;
39 ; o The uninstaller does not know how to stop multiple instances of a classic
40 ; server. They must be stopped manually.
41 ;
42 ;
43 ; Debugging this script
44 ;
45 ; You need to run BuildExecutableInstall.bat to create the correct environment.
46 ; If you have built firebird from run_all.bat you need to switch to the install
47 ; script directory:
48 ; pushd ..\install\arch-specific\win32
49 ;
50 ; After that you should be able to compile and debug the script from the command
51 ; line thus:
52 ; "%INNO6_SETUP_PATH%"\compil32.exe FirebirdInstall.iss
53 ;
54 ;
55 #define MyAppPublisher "Firebird Project"
56 #define MyAppURL "http://www.firebirdsql.org/"
57 #define MyAppName "Firebird"
58 #define MyAppId "FBDBServer"
59
60 #define FirebirdURL MyAppURL
61 #define UninstallBinary "{app}\firebird.exe"
62
63 #define Root GetEnv("FB_ROOT_PATH")
64 #if Root == ""
65 ;We are not run from batch file, let's set some sane defaults
66 #define Root = "..\..\..\.."
67 ;Assume iss debug as well
68 #define iss_debug
69 #else
70
71 #endif
72
73 #if GetEnv("FB2_ISS_DEBUG") == "1"
74 #define iss_debug
75 #endif
76
77 #if GetEnv("FBBUILD_SHIP_PDB") == "ship_pdb"
78 #define ship_pdb
79 #endif
80
81 ;Get version information from build_no.h
82 #include Root + "\gen\jrd\build_no.h"
83
84 ;Hard code some defaults to aid debugging and running script standalone.
85 ;In practice, these values are set in the environment and we use the env vars.
86 #define PackageNumber GetEnv("FBBUILD_PACKAGE_NUMBER")
87 #if PackageNumber == ""
88 #define PackageNumber "0"
89 #endif
90 #define FilenameSuffix GetEnv("FBBUILD_FILENAME_SUFFIX")
91 #if FilenameSuffix != "" && pos('-',FilenameSuffix) == 0
92 #define FilenameSuffix "-" + FilenameSuffix
93 #endif
94
95 ;-------Start of Innosetup script debug flags section
96
97 ; if iss_debug is undefined then iss_release is set
98 ; Setting iss_release implies that the defines for files,
99 ; examples and compression are set. If debug is set then this
100 ; section controls the settings of files, examples
101 ; and compression.
102
103 #ifndef iss_debug
104 #define iss_release
105 #endif
106
107 ;;;;;;;;;;;;;;;;;;;;;;;;;
108 #ifdef iss_release
109 #define files
110 #if GetEnv("FB2_EXAMPLES") != "0"
111 #define examples
112 #endif
113 #define compression
114 #define i18n
115 #endif
116 ;--------------------
117
118 ;--------------------
119 #ifdef iss_debug
120 ;Be more verbose
121 #pragma option -v+
122 #pragma verboselevel 9
123
124 ;Useful for cases where engine is built without examples.
125 #undef examples
126 ;Useful when testing structure of script - adding files takes time.
127 #undef files
128 ;We speed up compilation (and hence testing) by not compressing contents.
129 #undef compression
130
131 ;Default to x64 for testing
132 #define PlatformTarget "x64"
133 #endif
134 ;-------#ifdef iss_debug
135
136 ;-------end of Innosetup script debug flags section
137
138 ; As per the innosetup documentation:
139 ; "Change in default behavior: [Setup] section directive MinVersion now
140 ; defaults to 6.1sp1, so by default Setup will not run on Windows Vista or
141 ; on versions of Windows 7 and Windows Server 2008 R2 which have not been
142 ; updated. Setting MinVersion to 6.0 to allow Setup to run on Windows Vista
143 ; is supported but not recommended - Windows Vista doesn't support some of
144 ; Setup's security measures against potential DLL preloading attacks so these
145 ; have to be removed by the compiler if MinVersion is below 6.1 making your
146 ; installer less secure on all versions of Windows."
147 ;
148 ; This change _may_ be a problem for W2K8 R2. In any case Windows Vista and
149 ; even Windows 7 are now deprecated and hopefully no production install of
150 ; W2K8 R2 is unpatched. If necessary we can define 'support_legacy_windows' to
151 ; roll back this new feature but users who need to deploy to what are now
152 ; ancient versions of windows are advised to manually install Firebird with
153 ; the zip package.
154 #ifdef support_legacy_windows
155 #define MINVER "6.0"
156 #else
157 #define MINVER "6.1sp1"
158 #endif
159
160
161 ;-------Start of Innosetup script
162
163 #if Len(GetEnv("MSVC_VERSION")) > 0
164 #define msvc_version GetEnv("MSVC_VERSION")
165 #else
166 #define msvc_version 15
167 #pragma warning "msvc version is not defined. Forcing default value."
168 #endif
169
170 #if Len(GetEnv("MSVC_RUNTIME_MAJOR_VERSION")) > 0
171 #define msvc_runtime_major_version GetEnv("MSVC_RUNTIME_MAJOR_VERSION")
172 #else
173 #define msvc_runtime_major_version 14
174 #pragma warning "msvc runtime major version was not defined. Forcing default value."
175 #endif
176
177 #if Len(GetEnv("MSVC_RUNTIME_MINOR_VERSION_0")) > 0
178 #define msvc_runtime_minor_version_0 GetEnv("MSVC_RUNTIME_MINOR_VERSION_0")
179 #else
180 #define msvc_runtime_minor_version_0 0
181 #pragma warning "msvc runtime minor version 0 was not defined. Forcing default value."
182 #endif
183
184 ;if we are running msvc15 then we sometimes need to look for 140 and sometimes for 141
185 ; the rule until MS changes it again is that 141 is always used, except for the filename
186 ; of the vcruntime and msvcp dll's.
187 #if msvc_version = 15
188 #if Len(GetEnv("MSVC_RUNTIME_MINOR_VERSION_1")) > 0
189 #define msvc_runtime_minor_version_1 GetEnv("MSVC_RUNTIME_MINOR_VERSION_1")
190 #else
191 #define msvc_runtime_minor_version_1 1
192 #pragma warning "msvc runtime minor version 1 was not defined. Forcing default value."
193 #endif
194 #endif
195
196 #if Int(msvc_version,15) < 15
197 #define msvcr_filename = "msvcr"
198 #else
199 #define msvcr_filename = "vcruntime"
200 #endif
201
202 #if FB_BUILD_NO == "0"
203 #define MyAppVerString FB_MAJOR_VER + "." + FB_MINOR_VER + "." + FB_REV_NO
204 #else
205 #define MyAppVerString FB_MAJOR_VER + "." + FB_MINOR_VER + "." + FB_REV_NO + "." + FB_BUILD_NO
206 #endif
207 #define MyAppVerName MyAppName + " " + MyAppVerString
208
209 ;---- If we haven't already set PlatformTarget then pick it up from the environment.
210 #ifndef PlatformTarget
211 #define PlatformTarget GetEnv("FB_TARGET_PLATFORM")
212 #endif
213 #if PlatformTarget == ""
214 ;Assume native platform
215 #if IsWin64
216 #define PlatformTarget "x64"
217 #else
218 #define PlatformTarget "win32"
219 #endif
220 #endif
221
222 ;This location is relative to SourceDir (declared below)
223 #define FilesDir="output_" + PlatformTarget
224 #if PlatformTarget == "x64"
225 #define WOW64Dir="output_win32"
226 #endif
227
228 ;BaseVer should be used for all FB_MAJOR_VER.FB_MINOR_VER installs.
229 ;This allows us to upgrade silently from FB_MAJOR_VER.FB_MINOR_VER.m to FB_MAJOR_VER.FB_MINOR_VER.n
230 #define BaseVer FB_MAJOR_VER + "_" + FB_MINOR_VER
231 #define AppVer FB_MAJOR_VER + "_" + FB_MINOR_VER
232 #define GroupnameVer FB_MAJOR_VER + "." + FB_MINOR_VER
233 #define FB_cur_ver FB_MAJOR_VER + "." + FB_MINOR_VER + "." + FB_REV_NO
234
235 ; We can save space by shipping a pdb package that just includes
236 ; the pdb files. It would then upgrade an existing installation,
237 ; however, it wouldn't work on its own. This practice would go
238 ; against previous policy, which was to make the pdb package a
239 ; complete package. OTOH, now we have 32-bit and 64-bit platforms
240 ; to support we would benefit from slimming down the pdb packages.
241 ;;Uncomment the following lines to build the pdb package
242 ;;with just the pdb files.
243 ;#ifdef ship_pdb
244 ;#undef files
245 ;#undef examples
246 ;#endif
247
248
249 ; Some more strings to distinguish the name of final executable
250 ; shipping with debug symbols should not be confused with actual debug builds
251 #ifdef ship_pdb
252 #define pdb_str="-pdb"
253 #else
254 #define pdb_str=""
255 #endif
256 ; This is intended for builds that have been built with the debug flag
257 ; So far we have never actually released such a build.
258 #if GetEnv("FBBUILD_BUILDTYPE") == "debug"
259 #define debug_str="-debug"
260 #else
261 #define debug_str=""
262 #endif
263
264 #define InstallTimeStamp GetDateTimeString('yyyymmdd-hhnnss','','')
265
266 [Setup]
267 AppName={#MyAppName}
268 ;The following is important - all ISS install packages should
269 ;duplicate this. See the InnoSetup help for details.
270 #if PlatformTarget == "x64"
271 AppID={#MyAppId}_{#BaseVer}_{#PlatformTarget}
272 #else
273 AppID={#MyAppId}_{#BaseVer}
274 #endif
275 AppVerName={#MyAppVerName} ({#PlatformTarget})
276 AppPublisher={#MyAppPublisher}
277 AppPublisherURL={#MyAppURL}
278 AppSupportURL={#MyAppURL}
279 AppUpdatesURL={#MyAppURL}
280 AppVersion={#MyAppVerString}
281 VersionInfoVersion={#MyAppVerString}
282
283 SourceDir={#Root}
284 OutputBaseFilename={#MyAppName}-{#MyAppVerString}-{#PackageNumber}-{#PlatformTarget}{#debug_str}{#pdb_str}{#FilenameSuffix}
285 ;OutputManifestFile={#MyAppName}-{#MyAppVerString}-{#PackageNumber}-{#PlatformTarget}{#debug_str}{#pdb_str}{#FilenameSuffix}-Setup-Manifest.txt
286 OutputDir=builds\install_images
287 ;!!! These directories are as seen from SourceDir !!!
288 #define ScriptsDir "builds\install\arch-specific\win32"
289 #define LicensesDir "builds\install\misc"
290 #define GenDir "gen\readmes"
291 LicenseFile={#LicensesDir}\IPLicense.txt
292
293 WizardStyle=modern
294 WizardSizePercent=130,150
295 WizardResizable=yes
296 WizardImageFile={#ScriptsDir}\firebird_install_logo1.bmp
297 WizardSmallImageFile={#ScriptsDir}\firebird_install_logo1.bmp
298
299 DefaultDirName={code:ChooseInstallDir|{commonpf}\Firebird\Firebird_{#AppVer}}
300 DefaultGroupName=Firebird {#GroupnameVer} ({#PlatformTarget})
301
302 UninstallDisplayIcon={code:ChooseUninstallIcon|{#UninstallBinary}}
303 #ifndef compression
304 Compression=none
305 #else
306 SolidCompression=yes
307 #endif
308
309 AllowNoIcons=true
310 AlwaysShowComponentsList=true
311 PrivilegesRequired=admin
312 SetupMutex={#MyAppName}
313
314 #if PlatformTarget == "x64"
315 ArchitecturesAllowed=x64
316 ArchitecturesInstallIn64BitMode=x64
317 #endif
318
319 ;This feature is incomplete, as more thought is required.
320 #define setuplogging
321 #ifdef setuplogging
322 ;New with IS 5.2 -let's use it by default until we figure out how and whether it should be used.
323 SetupLogging=yes
324 #endif
325
326 [Languages]
327 Name: en; MessagesFile: compiler:Default.isl; InfoBeforeFile: {#GenDir}\installation_readme.txt; InfoAfterFile: {#GenDir}\Readme.txt;
328 #ifdef i18n
329 ;Name: ba; MessagesFile: compiler:Languages\Bosnian.isl; InfoBeforeFile: {#GenDir}\ba\Instalacija_ProcitajMe.txt; InfoAfterFile: {#GenDir}\ba\ProcitajMe.txt;
330 Name: cz; MessagesFile: compiler:Languages\Czech.isl; InfoBeforeFile: {#GenDir}\cz\instalace_ctime.txt; InfoAfterFile: {#GenDir}\cz\ctime.txt;
331 Name: fr; MessagesFile: compiler:Languages\French.isl; InfoBeforeFile: {#GenDir}\fr\installation_lisezmoi.txt; InfoAfterFile: {#GenDir}\fr\lisezmoi.txt;
332 ;Name: de; MessagesFile: compiler:Languages\German.isl; InfoBeforeFile: {#GenDir}\de\installation_liesmich.txt; InfoAfterFile: {#GenDir}\de\liesmich.txt;
333 ;Name: es; MessagesFile: compiler:Languages\Spanish.isl; InfoBeforeFile: {#GenDir}\es\leame_instalacion.txt; InfoAfterFile: {#GenDir}\es\leame.txt;
334 ;Name: hu; MessagesFile: compiler:Languages\Hungarian.isl; InfoBeforeFile: {#GenDir}\hu\telepitesi_segedlet.txt; InfoAfterFile: {#GenDir}\hu\olvass_el.txt;
335 ;Name: it; MessagesFile: compiler:Languages\Italian.isl; InfoBeforeFile: {#GenDir}\it\leggimi_installazione.txt; InfoAfterFile: {#GenDir}\it\leggimi.txt
336 ;Name: pl; MessagesFile: compiler:Languages\Polish.isl; InfoBeforeFile: {#GenDir}\pl\instalacja_czytajto.txt; InfoAfterFile: {#GenDir}\pl\czytajto.txt;
337 ;Name: pt; MessagesFile: compiler:Languages\Portuguese.isl; InfoBeforeFile: {#GenDir}\pt\instalacao_leia-me.txt; InfoAfterFile: {#GenDir}\pt\leia-me.txt
338 Name: ru; MessagesFile: compiler:Languages\Russian.isl; InfoBeforeFile: {#GenDir}\ru\installation_readme.txt; InfoAfterFile: {#GenDir}\ru\readme.txt;
339 ;Name: si; MessagesFile: compiler:Languages\Slovenian.isl; InfoBeforeFile: {#GenDir}\si\instalacija_precitajMe.txt; InfoAfterFile: {#GenDir}\readme.txt;
340 Name: ja; MessagesFile: compiler:Languages\Japanese.isl; InfoBeforeFile: {#GenDir}\ja\installation_readme.txt; InfoAfterFile: {#GenDir}\ja\readme.txt;
341 #endif
342
343 [CustomMessages]
344 #include "custom_messages.inc"
345 #ifdef i18n
346 ;#include "ba\custom_messages_ba.inc"
347 #include "cz\custom_messages_cz.inc"
348 #include "fr\custom_messages_fr.inc"
349 ;#include "de\custom_messages_de.inc"
350 ;#include "es\custom_messages_es.inc"
351 ;#include "hu\custom_messages_hu.inc"
352 ;#include "it\custom_messages_it.inc"
353 ;#include "pl\custom_messages_pl.inc"
354 ;#include "pt\custom_messages_pt.inc"
355 #include "ru\custom_messages_ru.inc"
356 ;#include "si\custom_messages_si.inc"
357 #include "ja\custom_messages_ja.inc"
358 #endif
359
360 [Types]
361 Name: ServerInstall; Description: {cm:ServerInstall}
362 Name: DeveloperInstall; Description: {cm:DeveloperInstall}
363 Name: ClientInstall; Description: {cm:ClientInstall}
364 Name: CustomInstall; Description: {cm:CustomInstall}; Flags: iscustom;
365
366 [Components]
367 Name: ServerComponent; Description: {cm:ServerComponent}; Types: ServerInstall;
368 Name: DevAdminComponent; Description: {cm:DevAdminComponent}; Types: ServerInstall DeveloperInstall;
369 Name: ClientComponent; Description: {cm:ClientComponent}; Types: ServerInstall DeveloperInstall ClientInstall CustomInstall; Flags: fixed disablenouninstallwarning;
370
371 [Tasks]
372 ;Server tasks
373 Name: UseClassicServerTask; Description: {cm:RunCS}; GroupDescription: {cm:ServerTaskDescription}; Components: ServerComponent; MinVersion: {#MinVer}; Flags: exclusive unchecked; Check: ConfigureFirebird;
374 Name: UseSuperClassicTask; Description: {cm:RunSC}; GroupDescription: {cm:ServerTaskDescription}; Components: ServerComponent; MinVersion: {#MinVer}; Flags: exclusive unchecked; Check: ConfigureFirebird;
375 Name: UseSuperClassicTask\UseGuardianTask; Description: {cm:UseGuardianTask}; Components: ServerComponent; MinVersion: {#MinVer}; Flags: unchecked dontinheritcheck; Check: ConfigureFirebird;
376 Name: UseSuperServerTask; Description: {cm:RunSS}; GroupDescription: {cm:ServerTaskDescription}; Components: ServerComponent; MinVersion: {#MinVer}; Flags: exclusive; Check: ConfigureFirebird;
377 Name: UseSuperServerTask\UseGuardianTask; Description: {cm:UseGuardianTask}; Components: ServerComponent; MinVersion: {#MinVer}; Flags: unchecked dontinheritcheck; Check: ConfigureFirebird;
378 Name: UseApplicationTask; Description: {cm:UseApplicationTaskMsg}; GroupDescription: {cm:TaskGroupDescription}; Components: ServerComponent; MinVersion: {#MinVer}; Flags: exclusive unchecked; Check: ConfigureFirebird;
379 Name: UseServiceTask; Description: {cm:UseServiceTask}; GroupDescription: {cm:TaskGroupDescription}; Components: ServerComponent; MinVersion: {#MinVer}; Flags: exclusive; Check: ConfigureFirebird;
380 Name: AutoStartTask; Description: {cm:AutoStartTask}; Components: ServerComponent; MinVersion: {#MinVer}; Check: ConfigureFirebird;
381 ;Name: MenuGroupTask; Description: Create a Menu &Group; Components: DevAdminComponent; MinVersion: {#MinVer}
382 ;Copying of client libs to <sys>
383 Name: CopyFbClientToSysTask; Description: {cm:CopyFbClientToSysTask}; Components: ClientComponent; MinVersion: {#MinVer}; Check: ShowCopyFbClientLibTask;
384 Name: CopyFbClientAsGds32Task; Description: {cm:CopyFbClientAsGds32Task}; Components: ClientComponent; MinVersion: {#MinVer}; Flags: Unchecked; Check: ShowCopyGds32Task;
385
386
387 [Run]
388 ; due to the changes required to support MSVC15 support for earlier versions is now broken.
389 #if Int(msvc_runtime_major_version,14) >= 14
390 Filename: msiexec.exe; Parameters: "/qn /norestart /i ""{tmp}\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi"" /L*v ""{tmp}\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.log"" "; StatusMsg: {cm:InstallingMSVC32runtimes}; Check: HasWI30; Components: ClientComponent;
391 #if PlatformTarget == "x64"
392 Filename: msiexec.exe; Parameters: "/qn /norestart /i ""{tmp}\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_x64.msi"" /L*v ""{tmp}\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_x64.log"" "; StatusMsg: {cm:InstallingMSVC64runtimes}; Check: HasWI30; Components: ClientComponent;
393 #endif
394 #endif
395
396 ;Only register Firebird if we are installing AND configuring
397 Filename: {app}\instreg.exe; Parameters: "install "; StatusMsg: {cm:instreg}; MinVersion: {#MinVer}; Components: ServerComponent; Flags: runminimized; Check: ConfigureFirebird;
398
399 Filename: {app}\instclient.exe; Parameters: "install fbclient"; StatusMsg: {cm:instclientCopyFbClient}; MinVersion: {#MinVer}; Components: ClientComponent; Flags: runminimized; Check: CopyFBClientLib;
400 Filename: {app}\instclient.exe; Parameters: "install gds32"; StatusMsg: {cm:instclientGenGds32}; MinVersion: {#MinVer}; Components: ClientComponent; Flags: runminimized; Check: CopyGds32
401 #if PlatformTarget == "x64"
402 Filename: {app}\WOW64\instclient.exe; Parameters: "install fbclient"; StatusMsg: {cm:instclientCopyFbClient}; MinVersion: {#MinVer}; Components: ClientComponent; Flags: runminimized 32bit; Check: CopyFBClientLib;
403 Filename: {app}\WOW64\instclient.exe; Parameters: "install gds32"; StatusMsg: {cm:instclientGenGds32}; MinVersion: {#MinVer}; Components: ClientComponent; Flags: runminimized 32bit; Check: CopyGds32
404 #endif
405
406 ;If 'Install and start service' requested
407 ;First, if installing service we must try and remove remnants of old service. Otherwise the new install will fail and when we start the service the old service will be started.
408 Filename: {app}\instsvc.exe; Parameters: "remove "; StatusMsg: {cm:instsvcSetup}; MinVersion: 0,4.0; Components: ServerComponent; Flags: runminimized; Tasks: UseServiceTask; Check: ConfigureFirebird;
409 Filename: {app}\instsvc.exe; Parameters: "install {code:ServiceStartFlags} "; StatusMsg: {cm:instsvcSetup}; MinVersion: {#MinVer}; Components: ServerComponent; Flags: runminimized; Tasks: UseServiceTask; Check: ConfigureFirebird;
410 Filename: {app}\instsvc.exe; Description: {cm:instsvcStartQuestion}; Parameters: "start {code:ServiceName} "; StatusMsg: {cm:instsvcStartMsg}; MinVersion: {#MinVer}; Components: ServerComponent; Flags: runminimized postinstall runascurrentuser; Tasks: UseServiceTask; Check: StartEngine
411 ;If 'start as application' requested
412 Filename: {code:StartApp|{app}\firebird.exe}; Description: {cm:instappStartQuestion}; Parameters: {code:StartAppParams|' -a '}; StatusMsg: {cm:instappStartMsg}; MinVersion: {#MinVer}; Components: ServerComponent; Flags: nowait postinstall; Tasks: UseApplicationTask; Check: StartEngine
413
414 ;This is a preliminary test of jumping to a landing page. In practice, we are going to need to know the users language and the version number they have installed.
415 Filename: "{#MyAppURL}/afterinstall"; Description: "After installation - What Next?"; Flags: postinstall shellexec skipifsilent; Components: ServerComponent DevAdminComponent;
416
417 [Registry]
418 ;If user has chosen to start as App they may well want to start automatically. That is handled by a function below.
419 ;Unless we set a marker here the uninstall will leave some annoying debris.
420 Root: HKLM; Subkey: SOFTWARE\Microsoft\Windows\CurrentVersion\Run; ValueType: string; ValueName: Firebird; ValueData: ; Flags: uninsdeletevalue; Tasks: UseApplicationTask; Check: ConfigureFirebird;
421
422 ;This doesn't seem to get cleared automatically by instreg on uninstall, so lets make sure of it
423 Root: HKLM; Subkey: "SOFTWARE\Firebird Project"; Flags: uninsdeletekeyifempty; Components: ServerComponent
424
425 ;Clean up Invalid registry entries from previous installs.
426 Root: HKLM; Subkey: "SOFTWARE\FirebirdSQL"; ValueType: none; Flags: deletekey;
427
428 [Icons]
429 Name: {group}\Firebird Server; Filename: {app}\firebird.exe; Parameters: {code:StartAppParams}; Flags: runminimized; MinVersion: {#MinVer}; Check: InstallServerIcon; IconIndex: 0; Components: ServerComponent; Comment: Run Firebird Server (without guardian)
430 Name: {group}\Firebird Guardian; Filename: {app}\fbguard.exe; Parameters: {code:StartAppParams}; Flags: runminimized; MinVersion: {#MinVer}; Check: InstallGuardianIcon; IconIndex: 1; Components: ServerComponent; Comment: Run Firebird Server (with guardian);
431 Name: {group}\Firebird ISQL Tool; Filename: {app}\isql.exe; Parameters: -z; WorkingDir: {app}; MinVersion: {#MinVer}; Comment: {cm:RunISQL}
432 Name: {group}\Firebird {#FB_cur_ver} Release Notes; Filename: {app}\doc\Firebird_v{#FB_cur_ver}.ReleaseNotes.pdf; MinVersion: {#MinVer}; Comment: {#MyAppName} {cm:ReleaseNotes}
433 ;Name: {group}\Firebird {#GroupnameVer} Quick Start Guide; Filename: {app}\doc\Firebird-{#FB_MAJOR_VER}-QuickStart.pdf; MinVersion: {#MinVer}; Comment: {#MyAppName} {#FB_cur_ver}
434 Name: "{group}\After Installation"; Filename: "{app}\doc\After_Installation.url"; Comment: "New User? Here's a quick guide to what you should do next."
435 Name: "{group}\Firebird Web-site"; Filename: "{app}\doc\firebirdsql.org.url"
436 ;Always install the original english version
437 Name: {group}\{cm:IconReadme,{#FB_cur_ver}}; Filename: {app}\readme.txt; MinVersion: {#MinVer};
438 #ifdef i18n
439 ;And install translated readme.txt if non-default language is chosen.
440 Name: {group}\{cm:IconReadme,{#FB_cur_ver}}; Filename: {app}\{cm:ReadMeFile}; MinVersion: {#MinVer}; Components: DevAdminComponent; Check: NonDefaultLanguage;
441 #endif
442 Name: {group}\{cm:Uninstall,{#FB_cur_ver}}; Filename: {uninstallexe}; Comment: Uninstall Firebird
443
444 [Files]
445 #ifdef files
446 Source: {#LicensesDir}\IPLicense.txt; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion;
447 Source: {#LicensesDir}\IDPLicense.txt; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion
448 Source: {#file "After_Installation.url"}; DestDir: {app}\doc; DestName: "After_Installation.url"; Components: ServerComponent DevAdminComponent; Flags: sharedfile ignoreversion
449 Source: {#ScriptsDir}\firebirdsql.org.url; DestDir: {app}\doc; Components: ServerComponent DevAdminComponent; Flags: sharedfile ignoreversion
450 ;Always install the original english version
451 Source: {#GenDir}\readme.txt; DestDir: {app}; Components: DevAdminComponent; Flags: ignoreversion;
452 #ifdef i18n
453 ;Translated files
454 ;Source: {#GenDir}\ba\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: ba;
455 Source: {#GenDir}\cz\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: cz;
456 Source: {#GenDir}\fr\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: fr;
457 ;Source: {#GenDir}\de\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: de;
458 ;Source: {#GenDir}\es\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: es;
459 ;Source: {#GenDir}\hu\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: hu;
460 ;Source: {#GenDir}\it\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: it;
461 ;Source: {#GenDir}\pl\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: pl;
462 ;Source: {#GenDir}\pt\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: pt;
463 Source: {#GenDir}\ru\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: ru;
464 ;Source: {#GenDir}\si\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: si;
465 Source: {#GenDir}\ja\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: ja;
466 #endif
467 Source: {#FilesDir}\firebird.conf; DestDir: {app}; DestName: firebird.conf.default; Components: ServerComponent;
468 Source: {#FilesDir}\firebird.conf; DestDir: {app}; DestName: firebird.conf; Components: ServerComponent; Flags: uninsneveruninstall; check: NoFirebirdConfExists
469 Source: {#FilesDir}\fbtrace.conf; DestDir: {app}; DestName: fbtrace.conf.default; Components: ServerComponent;
470 Source: {#FilesDir}\fbtrace.conf; DestDir: {app}; DestName: fbtrace.conf; Components: ServerComponent; Flags: uninsneveruninstall onlyifdoesntexist; check: NofbtraceConfExists;
471 Source: {#FilesDir}\databases.conf; DestDir: {app}; Components: ClientComponent; Flags: uninsneveruninstall onlyifdoesntexist
472 Source: {#FilesDir}\replication.conf; DestDir: {app}; DestName: replication.conf.default; Components: ServerComponent;
473 Source: {#FilesDir}\replication.conf; DestDir: {app}; Components: ServerComponent; Flags: uninsneveruninstall onlyifdoesntexist; check: NoReplicationConfExists;
474 Source: {#FilesDir}\security{#FB_MAJOR_VER}.fdb; DestDir: {app}; Destname: security{#FB_MAJOR_VER}.fdb.empty; Components: ServerComponent;
475 Source: {#FilesDir}\security{#FB_MAJOR_VER}.fdb; DestDir: {app}; Components: ServerComponent; Check: ConfigureAuthentication; Flags: uninsneveruninstall onlyifdoesntexist
476 Source: {#FilesDir}\firebird.msg; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion
477 Source: {#FilesDir}\firebird.log; DestDir: {app}; Components: ServerComponent; Flags: uninsneveruninstall skipifsourcedoesntexist external dontcopy
478
479 Source: {#FilesDir}\gbak.exe; DestDir: {app}; Components: DevAdminComponent; Flags: sharedfile ignoreversion
480 Source: {#FilesDir}\gfix.exe; DestDir: {app}; Components: DevAdminComponent; Flags: sharedfile ignoreversion
481 Source: {#FilesDir}\gpre.exe; DestDir: {app}; Components: DevAdminComponent; Flags: ignoreversion
482 Source: {#FilesDir}\gsec.exe; DestDir: {app}; Components: DevAdminComponent; Flags: sharedfile ignoreversion
483 Source: {#FilesDir}\gsplit.exe; DestDir: {app}; Components: DevAdminComponent; Flags: sharedfile ignoreversion
484 Source: {#FilesDir}\gstat.exe; DestDir: {app}; Components: ServerComponent; Flags: sharedfile ignoreversion
485 Source: {#FilesDir}\fbguard.exe; DestDir: {app}; Components: ServerComponent; Flags: sharedfile ignoreversion; Check: InstallGuardian;
486 Source: {#FilesDir}\firebird.exe; DestDir: {app}; Components: ServerComponent; Flags: sharedfile ignoreversion
487 Source: {#FilesDir}\fb_lock_print.exe; DestDir: {app}; Components: ServerComponent; Flags: sharedfile ignoreversion
488 Source: {#FilesDir}\ib_util.dll; DestDir: {app}; Components: ServerComponent; Flags: sharedfile ignoreversion
489 Source: {#FilesDir}\instclient.exe; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion
490 Source: {#FilesDir}\instreg.exe; DestDir: {app}; Components: ServerComponent; Flags: sharedfile ignoreversion
491 Source: {#FilesDir}\instsvc.exe; DestDir: {app}; Components: ServerComponent; MinVersion: {#MinVer}; Flags: sharedfile ignoreversion
492 Source: {#FilesDir}\isql.exe; DestDir: {app}; Components: DevAdminComponent; Flags: ignoreversion
493 Source: {#FilesDir}\nbackup.exe; DestDir: {app}; Components: DevAdminComponent; Flags: ignoreversion
494 Source: {#FilesDir}\qli.exe; DestDir: {app}; Components: DevAdminComponent; Flags: ignoreversion
495 Source: {#FilesDir}\fbsvcmgr.exe; DestDir: {app}; Components: DevAdminComponent; Flags: ignoreversion
496 Source: {#FilesDir}\fbtracemgr.exe; DestDir: {app}; Components: DevAdminComponent; Flags: ignoreversion
497 Source: {#FilesDir}\fbclient.dll; DestDir: {app}; Components: ClientComponent; Flags: overwritereadonly sharedfile promptifolder
498 #if PlatformTarget == "x64"
499 Source: {#WOW64Dir}\fbclient.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: overwritereadonly sharedfile promptifolder
500 Source: {#WOW64Dir}\instclient.exe; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile ignoreversion
501 #endif
502 Source: {#FilesDir}\icuuc??.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion
503 Source: {#FilesDir}\icuin??.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion
504 Source: {#FilesDir}\icudt??.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion
505 Source: {#FilesDir}\icudt*.dat; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion
506 #if PlatformTarget == "x64"
507 Source: {#WOW64Dir}\icuuc??.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile ignoreversion
508 Source: {#WOW64Dir}\icuin??.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile ignoreversion
509 Source: {#WOW64Dir}\icudt??.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile ignoreversion
510 Source: {#WOW64Dir}\icudt*.dat; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile ignoreversion
511 #endif
512
513 #if PlatformTarget =="Win32"
514 Source: {#FilesDir}\fbrmclib.dll; DestDir: {app}; Components: ServerComponent; Flags: sharedfile ignoreversion
515 #endif
516
517 Source: {#FilesDir}\zlib1.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion
518 #if PlatformTarget == "x64"
519 Source: {#WOW64Dir}\zlib1.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile ignoreversion
520 #endif
521
522 ;Rules for installation of MS runtimes are simplified with MSVC10
523 ;We just install the runtimes into the install dir.
524
525 #if Int(msvc_runtime_major_version,14) >= 14
526 Source: {#FilesDir}\{#msvcr_filename}{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile;
527 Source: {#FilesDir}\msvcp{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile;
528 #if PlatformTarget == "x64"
529 ;If we are installing on x64 we need some 32-bit libraries for compatibility with 32-bit applications
530 Source: {#WOW64Dir}\{#msvcr_filename}{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile;
531 Source: {#WOW64Dir}\msvcp{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile;
532 #endif
533 #endif /* #if Int(msvc_runtime_major_version,14) >= 10 */
534
535 #if msvc_runtime_major_version = 14
536 #if PlatformTarget == "x64"
537 ;MinVersion 0,5.0 means no version of Win9x and at least Win2k if NT O/S
538 ;In addition, O/S must have Windows Installer 3.0.
539 Source: {#FilesDir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_x64.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: {#MinVer}; Components: ClientComponent;
540 Source: {#WOW64Dir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: {#MinVer}; Components: ClientComponent;
541 #else
542 Source: {#FilesDir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: {#MinVer}; Components: ClientComponent;
543 #endif
544 #endif
545
546 ;Docs
547 Source: {#ScriptsDir}\installation_scripted.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: skipifsourcedoesntexist ignoreversion
548 Source: {#ScriptsDir}\installation_scripted.txt; DestDir: {tmp}; Flags: DontCopy;
549 Source: {#FilesDir}\doc\*.*; DestDir: {app}\doc; Components: DevAdminComponent; Flags: skipifsourcedoesntexist ignoreversion
550 Source: {#FilesDir}\doc\sql.extensions\*.*; DestDir: {app}\doc\sql.extensions; Components: DevAdminComponent; Flags: skipifsourcedoesntexist ignoreversion
551
552 ;Other stuff
553 Source: {#FilesDir}\help\*.*; DestDir: {app}\help; Components: DevAdminComponent; Flags: ignoreversion;
554 Source: {#FilesDir}\include\*.*; DestDir: {app}\include; Components: DevAdminComponent; Flags: ignoreversion recursesubdirs createallsubdirs;
555 Source: {#FilesDir}\intl\fbintl.dll; DestDir: {app}\intl; Components: ServerComponent; Flags: sharedfile ignoreversion;
556 Source: {#FilesDir}\intl\fbintl.conf; DestDir: {app}\intl; Components: ServerComponent; Flags: onlyifdoesntexist
557 Source: {#FilesDir}\lib\*.lib; DestDir: {app}\lib; Components: DevAdminComponent; Flags: ignoreversion;
558 #if PlatformTarget == "x64"
559 Source: {#WOW64Dir}\lib\*.lib; DestDir: {app}\WOW64\lib; Components: DevAdminComponent; Flags: ignoreversion
560 #endif
561
562 ;deprecated in FB4.0
563 ;Source: {#FilesDir}\UDF\ib_udf.dll; DestDir: {app}\UDF; Components: ServerComponent; Flags: sharedfile ignoreversion;
564 ;Source: {#FilesDir}\UDF\fbudf.dll; DestDir: {app}\UDF; Components: ServerComponent; Flags: sharedfile ignoreversion;
565 ;Source: {#FilesDir}\UDF\*.sql; DestDir: {app}\UDF; Components: ServerComponent; Flags: ignoreversion;
566 ;Source: {#FilesDir}\UDF\*.txt; DestDir: {app}\UDF; Components: ServerComponent; Flags: ignoreversion;
567
568 Source: {#FilesDir}\plugins.conf; DestDir: {app}; Components: ServerComponent; Flags: ignoreversion;
569 Source: {#FilesDir}\plugins\*.dll; DestDir: {app}\plugins; Components: ServerComponent; Flags: ignoreversion; Check: IsServerInstall;
570 Source: {#FilesDir}\plugins\chacha.dll; DestDir: {app}\plugins; Components: ClientComponent; Flags: ignoreversion; Check: IsNotServerInstall;
571 Source: {#FilesDir}\plugins\*.conf; DestDir: {app}\plugins; Components: ServerComponent; Flags: ignoreversion;
572 Source: {#FilesDir}\plugins\udr\*.*; DestDir: {app}\plugins\udr; Components: ServerComponent; Flags: ignoreversion;
573 #if PlatformTarget == "x64"
574 Source: {#WOW64Dir}\plugins\chacha*.dll; DestDir: {app}\WOW64\plugins; Components: ClientComponent; Flags: ignoreversion;
575 #endif
576
577 Source: {#FilesDir}\misc\*.*; DestDir: {app}\misc; Components: ServerComponent; Flags: ignoreversion createallsubdirs recursesubdirs ;
578
579 Source: {#FilesDir}\tzdata\*.*; DestDir: {app}\tzdata; Components: ClientComponent; Flags: ignoreversion;
580
581 #endif /* files */
582
583 #ifdef examples
584 Source: {#FilesDir}\examples\*.*; DestDir: {app}\examples; Components: DevAdminComponent; Flags: ignoreversion createallsubdirs recursesubdirs;
585 #endif
586
587 #ifdef ship_pdb
588 Source: {#FilesDir}\fbclient.pdb; DestDir: {app}; Components: ClientComponent;
589 Source: {#FilesDir}\firebird.pdb; DestDir: {app}; Components: ServerComponent;
590 Source: {#FilesDir}\fbtracemgr.pdb; DestDir: {app}; Components: DevAdminComponent;
591 Source: {#FilesDir}\intl\fbintl.pdb; DestDir: {app}\intl; Components: DevAdminComponent;
592 Source: {#FilesDir}\gbak.pdb; DestDir: {app}; Components: DevAdminComponent;
593 Source: {#FilesDir}\gfix.pdb; DestDir: {app}; Components: DevAdminComponent;
594 Source: {#FilesDir}\ib_util.pdb; DestDir: {app}; Components: ServerComponent;
595 Source: {#FilesDir}\isql.pdb; DestDir: {app}; Components: ClientComponent;
596 Source: {#FilesDir}\nbackup.pdb; DestDir: {app}; Components: DevAdminComponent;
597 Source: {#FilesDir}\plugins\*.pdb; DestDir: {app}\plugins; Components: ServerComponent;
598 #if PlatformTarget == "x64"
599 Source: {#WOW64Dir}\fbclient.pdb; DestDir: {app}\WOW64; Components: ClientComponent;
600 #endif
601 #endif
602
603 [UninstallRun]
604 Filename: {app}\instsvc.exe; Parameters: "stop {code:ServiceName} "; StatusMsg: {cm:instsvcStopMsg}; MinVersion: {#MinVer}; Components: ServerComponent; Flags: runminimized; Tasks: UseServiceTask; RunOnceId: StopService
605 Filename: {app}\instsvc.exe; Parameters: "remove {code:ServiceName} "; StatusMsg: {cm:instsvcRemove}; MinVersion: {#MinVer}; Components: ServerComponent; Flags: runminimized; Tasks: UseServiceTask; RunOnceId: RemoveService
606 Filename: {app}\instclient.exe; Parameters: " remove gds32"; StatusMsg: {cm:instclientDecLibCountGds32}; MinVersion: {#MinVer}; Flags: runminimized; RunOnceId: RemoveGDS32
607 Filename: {app}\instclient.exe; Parameters: " remove fbclient"; StatusMsg: {cm:instclientDecLibCountFbClient}; MinVersion: {#MinVer}; Flags: runminimized; RunOnceId: RemoveFbclient
608 #if PlatformTarget == "x64"
609 Filename: {app}\wow64\instclient.exe; Parameters: " remove gds32"; StatusMsg: {cm:instclientDecLibCountGds32}; MinVersion: {#MinVer}; Flags: runminimized 32bit; RunOnceId: RemoveGDS32x86
610 Filename: {app}\wow64\instclient.exe; Parameters: " remove fbclient"; StatusMsg: {cm:instclientDecLibCountFbClient}; MinVersion: {#MinVer}; Flags: runminimized 32bit; RunOnceId: RemoveFbClientx86
611 #endif
612 Filename: {app}\instreg.exe; Parameters: " remove"; StatusMsg: {cm:instreg}; MinVersion: {#MinVer}; Components: ServerComponent; Flags: runminimized; RunOnceId: RemoveRegistryEntry
613
614 [UninstallDelete]
615 Type: files; Name: "{app}\*.lck"
616 Type: files; Name: "{app}\*.evn"
617 Type: dirifempty; Name: "{app}"
618
619 [_ISTool]
620 EnableISX=true
621
622 [Code]
623 program Setup;
624
625
626 // Some global variables are also in FirebirdInstallEnvironmentChecks.inc
627 // This is not ideal, but then this scripting environment is not ideal, either.
628 // The basic point of the include files is to isolate chunks of code that are
629 // a) From a module or have common functionality
630 // b) Debugged.
631 // This hopefully keeps the main script simpler to follow.
632
633
634 const
635 UNDEFINED = -1;
636
637 Var
638 InstallRootDir: String;
639 FirebirdConfSaved: String;
640 ForceInstall: Boolean; // If /force set on command-line we install _and_
641 // configure. Default is to install and configure only if
642 // no other working installation is found (unless we are installing
643 // over the same version)
644
645 // Options for scripted uninstall.
646 CleanUninstall: Boolean; // If /clean is passed to the uninstaller it will delete
647 // user config files - firebird.conf, firebird.log,
648 // databases.conf, fbtrace.conf and the security database.
649
650 SYSDBAPassword: String; // SYSDBA password
651
652 init_secdb: integer; // Is set to UNDEFINED by default in InitializeSetup
653
654 AdminUserPage: TInputQueryWizardPage;
655
656 DonorPage: TWizardPage;
657 RichEditViewer: TRichEditViewer;
658 DonateButton: TNewButton;
659
660 initWizardHeight: Integer; // In prev. version - the wizard form was resized to new size every time when go back button pressed
661
662
663 #ifdef setuplogging
664 // Not yet implemented - leave log in %TEMP%
665 // OkToCopyLog : Boolean; // Set when installation is complete.
666 #endif
667
668 #include "FirebirdInstallSupportFunctions.inc"
669
670 #include "FirebirdInstallEnvironmentChecks.inc"
671
672 #include "FirebirdInstallGUIFunctions.inc"
673
674 procedure InitializeWizard;
675 begin
676 initWizardHeight := wizardform.height;
677
678 // Create a page to grab the new SYSDBA password
679 CreateAdminUserPage;
680
681 // Create a page to ask for donations
682 CreateDonorPage;
683
684 end;
685
686
687
688 function InitializeSetup(): Boolean;
689 var
690 i: Integer;
691 CommandLine: String;
692 cmdParams: TStringList;
693 begin
694
695 result := true;
696
697 CommandLine:=GetCmdTail;
698
699 if ((pos('HELP',Uppercase(CommandLine)) > 0) or
700 (pos('--',Uppercase(CommandLine)) > 0) )
701 // or
702 // (pos('/?',Uppercase(CommandLine)) > 0) or // InnoSetup displays its own help if these switches are passed.
703 // (pos('/H',Uppercase(CommandLine)) > 0) ) // Note also that our help screen only appears after the Choose Language dialogue :-(
704 then begin
705 ShowHelpDlg;
706 result := False;
707 Exit;
708
709 end;
710
711 if pos('FORCE',Uppercase(CommandLine)) > 0 then
712 ForceInstall:=True;
713
714
715 cmdParams := TStringList.create;
716 for i:=0 to ParamCount do begin
717 cmdParams.add(ParamStr(i));
718 if pos('SYSDBAPASSWORD', Uppercase(ParamStr(i)) ) > 0 then
719 SYSDBAPassword := Copy(ParamStr(i),Length('/SYSDBAPASSWORD=')+1,Length(ParamStr(i))-Length('/SYSDBAPASSWORD=') );
720 end;
721 #ifdef iss_debug
722 ShowDebugDlg(cmdParams.text,'');
723 #endif
724
725 // Check if a server is running - we cannot continue if it is.
726 if FirebirdDefaultServerRunning then begin
727 result := false;
728 exit;
729 end;
730
731 if not CheckWinsock2 then begin
732 result := False;
733 exit;
734 end;
735
736 //By default we want to install and configure,
737 //unless subsequent analysis suggests otherwise.
738 InstallAndConfigure := Install + Configure;
739
740 InstallRootDir := '';
741
742 InitExistingInstallRecords;
743 AnalyzeEnvironment;
744 result := AnalysisAssessment;
745 init_secdb := UNDEFINED;
746
747 end;
748
749
750 procedure DeInitializeSetup();
751 var
752 ErrCode: Integer;
753 begin
754 // Did the install fail because winsock 2 was not installed?
755 if Winsock2Failure then
756 // Ask user if they want to visit the Winsock2 update web page.
757 if MsgBox(ExpandConstant('{cm:Winsock2Web1}')+#13#13+ExpandConstant('{cm:Winsock2Web2}'), mbInformation, MB_YESNO) = idYes then
758 // User wants to visit the web page
759 ShellExec('open', sMSWinsock2Update, '', '', SW_SHOWNORMAL, ewNoWait, ErrCode);
760
761 if RunningServerVerString <> '' then
762 MsgBox( #13+Format(ExpandConstant('{cm:FbRunning1}'), [RunningServerVerString])
763 +#13
764 +#13+ExpandConstant('{cm:FbRunning2}')
765 +#13+ExpandConstant('{cm:FbRunning3}')
766 +#13, mbError, MB_OK);
767
768 #ifdef setuplogging
769 // Not yet implemented - leave log in %TEMP%
770 // if OkToCopyLog then
771 // FileCopy (ExpandConstant ('{log}'), ExpandConstant ('{app}\InstallationLogFile.log'), FALSE);
772
773 // RestartReplace (ExpandConstant ('{log}'), '');
774 #endif /* setuplogging */
775
776 end;
777
778 //This function tries to find an existing install of Firebird M.N
779 //If it succeeds it suggests that directory for the install
780 //Otherwise it suggests the default for Fb M.N
781 function ChooseInstallDir(Default: String): String;
782 var
783 InterBaseRootDir,
784 FirebirdRootDir: String;
785 begin
786 //The installer likes to call this FOUR times, which makes debugging a pain,
787 //so let's test for a previous call.
788 if (InstallRootDir = '') then begin
789
790 // Try to find the value of "RootDirectory" in the Firebird
791 // registry settings. This is either where Fb 1.0 exists or Fb 1.5
792 InterBaseRootDir := GetInterBaseDir;
793 FirebirdRootDir := GetFirebirdDir;
794
795 if (FirebirdRootDir <> '') and ( FirebirdRootDir = InterBaseRootDir ) then //Fb 1.0 must be installed so don't overwrite it.
796 InstallRootDir := Default;
797
798 if (( InstallRootDir = '' ) and
799 ( FirebirdRootDir = Default )) then // Fb 2.0 is already installed,
800 InstallRootDir := Default; // so we offer to install over it
801
802 if (( InstallRootDir = '') and
803 ( FirebirdVer[0] = 1 ) and ( FirebirdVer[1] = 5 ) ) then // Firebird 1.5 is installed
804 InstallRootDir := Default; // but the user has changed the default
805
806 if (( InstallRootDir = '') and
807 ( FirebirdVer[0] = {#FB_MAJOR_VER} ) and ( FirebirdVer[1] = {#FB_MINOR_VER} ) ) then // Firebird 2.n is installed
808 InstallRootDir := FirebirdRootDir; // but the user has changed the default
809
810 // if we haven't found anything then try the FIREBIRD env var
811 // User may have preferred location for Firebird, but has possibly
812 // uninstalled previous version
813 if (InstallRootDir = '') then
814 InstallRootDir:=getenv('FIREBIRD');
815
816 //if no existing locations found make sure we default to the default.
817 if (InstallRootDir = '') then
818 InstallRootDir := Default;
819
820 end; // if InstallRootDir = '' then begin
821
822 Result := ExpandConstant(InstallRootDir);
823
824 end;
825
826
827 function ServiceName(Default: String): String;
828 begin
829 Result := ' -n DefaultInstance' ;
830 end;
831
832
833 function ServiceStartFlags(Default: String): String;
834 var
835 ServerType: String;
836 SvcParams: String;
837 InstanceName: String;
838 begin
839 ServerType := '';
840 SvcParams := '';
841
842 if WizardIsComponentSelected('ServerComponent') and WizardIsTaskSelected('AutoStartTask') then
843 SvcParams := ' -auto '
844 else
845 SvcParams := ' -demand ';
846
847 SvcParams := ServerType + SvcParams;
848
849 if WizardIsComponentSelected('ServerComponent') and ( WizardIsTaskSelected('UseSuperServerTask\UseGuardianTask')
850 or ( WizardIsTaskSelected('UseSuperClassicTask\UseGuardianTask') ) ) then
851 SvcParams := ServerType + SvcParams + ' -guardian ';
852
853 InstanceName := ServiceName('We currently do not support or test for a different instance name');
854
855 SvcParams := SvcParams + InstanceName;
856
857 Result := SvcParams;
858 end;
859
860
861 function GetAdminUserName: String;
862 begin
863 Result := 'SYSDBA';
864 end;
865
866
867 function GetAdminUserPassword: String;
868 begin
869 Result := AdminUserPage.Values[0];
870 if Result = '' then
871 Result := 'masterkey';
872 end;
873
874
875 function InitSecurityDB: Boolean;
876 var
877 AStringList: TStringList;
878 TempDir: String;
879 ResultCode: Integer;
880 CmdStr: string;
881 InputStr: string;
882 OutputStr: string;
883 begin
884 TempDir := ExpandConstant( '{tmp}' );
885 CmdStr := ExpandConstant( '{app}\isql.exe' );
886 InputStr := TempDir + '\' + 'temp.sql';
887 OutputStr := InputStr + '.txt';
888
889 // Ensure these files do not already exist.
890 if FileExists( InputStr ) then DeleteFile( InputStr );
891 if FileExists( OutputStr ) then DeleteFile( OutputStr );
892
893 AStringList := TStringList.create;
894 with AStringList do begin
895 Add( 'create or alter user ' + GetAdminUserName + ' password ''' + GetAdminUserPassword + ''' using plugin Srp;' );
896 Add( 'exit;' );
897 SaveToFile( InputStr );
898 end;
899 Result := Exec( CmdStr , ' -m -m2 -user SYSDBA -i ' + InputStr + ' -o ' + OutputStr + ' employee ' , TempDir, SW_HIDE, ewWaitUntilTerminated, ResultCode );
900 if ResultCode <> 0 then begin
901 Result := False;
902 Log( 'In function InitSecurityDB Exec isql returned ' + IntToStr(ResultCode) + ' executing ' + InputStr );
903 end;
904 if FindInFile( OutputStr, 'error' ) then begin
905 Result := False;
906 Log( 'In function InitSecurityDB FindInFile found an error in ' + OutputStr );
907 end;
908
909 DeleteFile( InputStr );
910 DeleteFile( OutputStr );
911 end;
912
913
914 function InstallGuardianIcon(): Boolean;
915 begin
916 result := false;
917 if WizardIsTaskSelected('UseApplicationTask') and
918 WizardIsComponentSelected('ServerComponent') and (
919 WizardIsTaskSelected('UseSuperServerTask\UseGuardianTask') or
920 WizardIsTaskSelected('UseSuperClassicTask\UseGuardianTask') ) then
921 result := true;
922 end;
923
924 function InstallServerIcon(): Boolean;
925 begin
926 result := false;
927 if WizardIsTaskSelected('UseApplicationTask') and
928 WizardIsComponentSelected('ServerComponent') and
929 not ( WizardIsTaskSelected('UseSuperServerTask\UseGuardianTask') or
930 WizardIsTaskSelected('UseSuperClassicTask\UseGuardianTask') ) then
931 result := true;
932 end;
933
934 function StartApp(Default: String): String;
935 begin
936 if WizardIsComponentSelected('ServerComponent') and (
937 WizardIsTaskSelected('UseSuperServerTask\UseGuardianTask') or
938 WizardIsTaskSelected('UseSuperClassicTask\UseGuardianTask') ) then
939 Result := GetAppPath+'\fbguard.exe'
940 else
941 Result := GetAppPath+'\firebird.exe' ;
942 end;
943
944 function StartAppParams(Default: String): String;
945 begin
946 Result := ' -a ';
947 end;
948
949 function IsNotAutoStartApp: boolean;
950 //Support function to help remove unwanted registry entry.
951 begin
952 result := true;
953 if ( WizardIsComponentSelected('ServerComponent') and WizardIsTaskSelected('AutoStartTask') ) and
954 ( WizardIsComponentSelected('ServerComponent') and WizardIsTaskSelected('UseApplicationTask') ) then
955 result := false;
956 end;
957
958
959 procedure RemoveSavedConfIfNoDiff;
960 //Compare firebird.conf with the one we just saved.
961 //If they match then we can remove the saved one.
962 var
963 FirebirdConfStr: AnsiString;
964 SavedConfStr: AnsiString;
965 begin
966 LoadStringFromFile( GetAppPath+'\firebird.conf', FirebirdConfStr );
967 LoadStringFromFile( FirebirdConfSaved, SavedConfStr );
968
969 if CompareStr( FirebirdConfStr, SavedConfStr ) = 0 then
970 DeleteFile( FirebirdConfSaved );
971 end;
972
973
974 procedure UpdateFirebirdConf;
975 // Update firebird conf.
976 // If user has deselected the guardian we should update firebird.conf accordingly.
977 // We also test if user has asked for classic or super server
978 begin
979 //There is no simple, foolproof and futureproof way to check whether
980 //we are doing a server install, so the easiest way is to see if a
981 //firebird.conf exists. If it doesn't then we don't care.
982 if FileExists(GetAppPath+'\firebird.conf') then begin
983
984 if (WizardIsComponentSelected('ServerComponent') ) then begin
985
986 // Setting GuardianOption to 0 makes no sense. If the user deploys the guardian
987 // there is an expectation that it will restart the server in the event of a crash.
988 // Otherwise, why start firebird with the guardian?
989 // if not ( WizardIsTaskSelected('UseSuperServerTask\UseGuardianTask') or WizardIsTaskSelected('UseSuperClassicTask\UseGuardianTask') ) then
990 // ReplaceLine(GetAppPath+'\firebird.conf','GuardianOption','GuardianOption = 0','#');
991
992 // These attempts to modify firebird.conf may not survice repeated installs.
993
994 if WizardIsTaskSelected('UseClassicServerTask') then
995 ReplaceLine(GetAppPath+'\firebird.conf','ServerMode = ','ServerMode = Classic','#');
996
997 if WizardIsTaskSelected('UseSuperClassicTask') then
998 ReplaceLine(GetAppPath+'\firebird.conf','ServerMode = ','ServerMode = SuperClassic','#');
999
1000 if WizardIsTaskSelected('UseSuperServerTask') then
1001 ReplaceLine(GetAppPath+'\firebird.conf','ServerMode = ','ServerMode = Super','#');
1002
1003 end;
1004
1005 end;
1006 end;
1007
1008
1009 function NonDefaultLanguage: boolean;
1010 //return true if language other than default is chosen
1011 begin
1012 result := (ActiveLanguage <> 'en');
1013 end;
1014
1015 //Make installation form a little taller and wider.
1016 const
1017 HEIGHT_INCREASE = 175;
1018 WIDTH_INCREASE = 40;
1019
1020 procedure ResizeWizardForm(Increase: Boolean);
1021 var
1022 AWidth,AHeight: Integer;
1023 begin
1024 //Do resize only once!
1025 if wizardform.height = initWizardHeight then begin
1026 AHeight := HEIGHT_INCREASE;
1027 AWidth := WIDTH_INCREASE;
1028
1029 if not Increase then begin
1030 AHeight := (AHeight * (-1));
1031 AWidth := (AWidth * (-1));
1032 end;
1033
1034 SetupWizardFormComponentsArrays;
1035 ResizeWizardFormHeight(AHeight);
1036 // ResizeWizardFormWidth(AWidth);
1037 end;
1038 end;
1039
1040 procedure CurPageChanged(CurPage: Integer);
1041 // These are the predefined page IDs of the Wizard form as of InnoSetup 5.5.6
1042 // wpWelcome, wpLicense, wpPassword, wpInfoBefore, wpUserInfo,
1043 // wpSelectDir, wpSelectComponents, wpSelectProgramGroup, wpSelectTasks,
1044 // wpReady, wpPreparing, wpInstalling, wpInfoAfter, wpFinished
1045 begin
1046 case CurPage of
1047 wpInfoBefore: WizardForm.INFOBEFOREMEMO.font.name:='Courier New';
1048 wpInfoAfter: WizardForm.INFOAFTERMEMO.font.name:='Courier New';
1049 DonorPage.ID: begin
1050 DonateButton.Visible := True;
1051 WizardForm.BackButton.Visible := False;
1052 end;
1053 else
1054 DonateButton.Visible := False;
1055 end;
1056 end;
1057
1058
1059 procedure CurStepChanged(CurStep: TSetupStep);
1060 // currently just three steps - ssInstall, ssPostInstall, ssDone
1061 var
1062 AppStr: String;
1063 ReadMeFileStr: String;
1064 begin
1065 case CurStep of
1066 ssInstall: begin
1067 SetupSharedFilesArray;
1068 GetSharedLibCountBeforeCopy;
1069 end;
1070
1071 ssPostInstall: begin
1072 //Manually set the sharedfile count of these files.
1073 IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\firebird.conf', false);
1074 IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\firebird.log', false);
1075 IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\databases.conf', false);
1076 IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\fbtrace.conf', false);
1077 IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\security{#FB_MAJOR_VER}.fdb', false);
1078 IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\replication.conf', false);
1079
1080 if init_secdb = 1 then
1081 InitSecurityDB;
1082
1083 //Fix up conf file
1084 UpdateFirebirdConf;
1085 RemoveSavedConfIfNoDiff;
1086
1087
1088 end;
1089
1090 ssDone: begin
1091 //If user has chosen to install an app and run it automatically set up the registry accordingly
1092 //so that the server or guardian starts evertime they login.
1093 if (WizardIsComponentSelected('ServerComponent') and WizardIsTaskSelected('AutoStartTask') ) and
1094 ( WizardIsComponentSelected('ServerComponent') and WizardIsTaskSelected('UseApplicationTask') ) then begin
1095 AppStr := StartApp('')+StartAppParams('');
1096 RegWriteStringValue (HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'Firebird', AppStr);
1097 end;
1098
1099 //Reset shared library count if necessary
1100 CheckSharedLibCountAtEnd;
1101
1102 //Move lang specific readme from doc dir to root of install.
1103 if NonDefaultLanguage then begin
1104 ReadMeFileStr := ExpandConstant('{cm:ReadMeFile}');
1105 if FileCopy(GetAppPath+'\doc\'+ReadMeFileStr, GetAppPath+'\'+ReadMeFileStr, false) then
1106 DeleteFile(GetAppPath+'\doc\'+ReadMeFileStr);
1107 end;
1108
1109 #ifdef setuplogging
1110 // OkToCopyLog := True;
1111 #endif
1112
1113 end;
1114 end;
1115 end;
1116
1117 function StartEngine: boolean;
1118 begin
1119 if ConfigureFirebird then
1120 result := not FirebirdDefaultServerRunning;
1121 end;
1122
1123 // # FIXME - we can probably remove this function
1124 function ChooseUninstallIcon(Default: String): String;
1125 begin
1126 result := GetAppPath+'\firebird.exe';
1127 end;
1128
1129 //InnoSetup has a Check Parameter that allows installation if the function returns true.
1130 //For firebird.conf we want to do two things:
1131 // o if firebird.conf already exists then install firebird.conf.default
1132 // o if firebird.conf does not exist then install firebird.conf
1133 //
1134 // This double test is also needed because the uninstallation rules are different for each file.
1135 // We never uninstall firebird.conf. We always uninstall firebird.conf.default.
1136
1137 function FirebirdConfExists: boolean;
1138 begin
1139 Result := fileexists(GetAppPath+'\firebird.conf');
1140 end;
1141
1142 function NoFirebirdConfExists: boolean;
1143 begin
1144 Result := not fileexists(GetAppPath+'\firebird.conf');
1145 end;
1146
1147 function fbtraceConfExists: boolean;
1148 begin
1149 Result := fileexists(GetAppPath+'\fbtrace.conf');
1150 end;
1151
1152 function NofbtraceConfExists: boolean;
1153 begin
1154 Result := not fileexists(GetAppPath+'\fbtrace.conf');
1155 end;
1156
1157 function ReplicationConfExists: boolean;
1158 begin
1159 Result := fileexists(GetAppPath+'\replication.conf');
1160 end;
1161
1162 function NoReplicationConfExists: boolean;
1163 begin
1164 Result := not fileexists(GetAppPath+'\replication.conf');
1165 end;
1166
1167 function InitializeUninstall: Boolean;
1168 var
1169 CommandLine: String;
1170 begin
1171 CommandLine:=GetCmdTail;
1172 if pos('CLEAN',Uppercase(CommandLine))>0 then
1173 CleanUninstall:=True
1174 else
1175 CleanUninstall:=False;
1176
1177 //MUST return a result of true, otherwise uninstall will abort!
1178 result := true;
1179 end;
1180
1181 procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
1182 var
1183 res: boolean;
1184 i,count: integer;
1185 aStringList: TStringList;
1186 appPath: string;
1187 begin
1188
1189 case CurUninstallStep of
1190
1191 // usAppMutexCheck :
1192
1193 // usUninstall :
1194
1195 usPostUninstall : begin
1196 if CleanUninstall then begin
1197
1198 aStringList := TStringList.create;
1199 appPath := GetAppPath;
1200 aStringList.add(appPath+'\firebird.conf');
1201 aStringList.add(appPath+'\firebird.log');
1202 aStringList.add(appPath+'\databases.conf');
1203 aStringList.add(appPath+'\fbtrace.conf');
1204 aStringList.add(appPath+'\security{#FB_MAJOR_VER}.fdb');
1205 aStringList.add(appPath+'\security{#FB_MAJOR_VER}.fdb.old');
1206 aStringList.add(appPath+'\replication.conf');
1207
1208 for count := 0 to aStringList.count - 1 do begin
1209 // We are manually handling the share count of these files, so we must
1210 // a) Decrement shared count of each one and
1211 // b) If Decrement reaches 0 (ie, function returns true) then we
1212 // delete the file.
1213 // c) We arbitrarily break after 100 loops. Typically the shared count should only be
1214 // in single digits anyway but we don't want to risk the test entering an endless loop.
1215 i := 0;
1216 while not DecrementSharedCount(Is64BitInstallMode, aStringList[ count ] )
1217 do
1218 if i = 100 then break else inc(i);
1219
1220 res := DeleteFile( aStringList[ count ] );
1221
1222 end;
1223
1224 end;
1225 end;
1226
1227 usDone : res := RemoveDir(GetAppPath);
1228
1229 end;
1230
1231 end;
1232
1233
1234 function ShouldSkipPage(PageID: Integer): Boolean;
1235 begin
1236 if ( PageID = AdminUserPage.ID ) then
1237 { If we are not configuring Firebird then don't prompt for SYSDBA pw. }
1238 if not ConfigureFirebird then
1239 Result := True
1240 else if not ConfigureAuthentication then
1241 Result := True
1242 else
1243 Result := False;
1244 end;
1245
1246
1247 function NextButtonClick(CurPageID: Integer): Boolean;
1248 var
1249 i: integer;
1250 begin
1251 Result := True;
1252 case CurPageID of
1253 AdminUserPage.ID : begin
1254 { check user has entered new sysdba password correctly. }
1255 i := CompareStr(AdminUserPage.Values[0],AdminUserPage.Values[1]);
1256 If not (i = 0) then begin
1257 Result := False;
1258 AdminUserPage.Values[0] :='';
1259 AdminUserPage.Values[1] :='';
1260 MsgBox(ExpandConstant('{cm:SYSDBAPasswordMismatch}'), mbError, MB_OK);
1261 end;
1262 end;
1263 end;
1264 end;
1265
1266 begin
1267 end.
1268