From f3dda2c9aca0225941522c7580d210f6ac3fdaf8 Mon Sep 17 00:00:00 2001 From: paul_reeves Date: Tue, 4 Nov 2008 13:51:57 +0000 Subject: [PATCH] Backport improved product detection code from 2.1 Upgrade install script to InnoSetup 5.2.3 to take a) advantage of improved vista support b) make ongoing maintenance eaisier. --- .../win32/BuildExecutableInstall.bat | 18 +- .../FirebirdInstallEnvironmentChecks.inc | 371 +++++++++++++++--- .../win32/FirebirdInstallSupportFunctions.inc | 86 +++- .../win32/FirebirdInstall_20.iss | 271 ++++++++----- .../win32/installation_scripted.txt | 333 +++++++++++----- 5 files changed, 807 insertions(+), 272 deletions(-) diff --git a/builds/install/arch-specific/win32/BuildExecutableInstall.bat b/builds/install/arch-specific/win32/BuildExecutableInstall.bat index 03afcf66a2..5285315a4d 100644 --- a/builds/install/arch-specific/win32/BuildExecutableInstall.bat +++ b/builds/install/arch-specific/win32/BuildExecutableInstall.bat @@ -118,10 +118,10 @@ if %FBBUILD_ZIP_PACK% EQU 1 ( if %FBBUILD_ISX_PACK% EQU 1 ( - if NOT DEFINED INNO_SETUP_PATH ( - call :ERROR INNO_SETUP_PATH variable not defined + if NOT DEFINED INNO5_SETUP_PATH ( + call :ERROR INNO5_SETUP_PATH variable not defined @goto :EOF - ) else (@echo o Inno Setup found at %INNO_SETUP_PATH%.) + ) else (@echo o Inno Setup 5 found at %INNO5_SETUP_PATH%.) if not DEFINED FB_EXTERNAL_DOCS ( @echo. @@ -203,16 +203,18 @@ set FBBUILD_FB15_CUR_VER=1.5.5 :: MSVC7 requires the Framework SDK v1.1 to be installed. ::===================== @if not exist %FB_OUTPUT_DIR%\system32 (mkdir %FB_OUTPUT_DIR%\system32) +@if DEFINED MSDevDir ( @if %MSVC_VERSION% EQU 6 ( @copy "%MSDevDir%\vcredist\msvcrt.dll" %FB_OUTPUT_DIR%\bin\ > nul @copy "%MSDevDir%\vcredist\msvcp%MSVC_VERSION%0.dll" %FB_OUTPUT_DIR%\bin\ > nul + ) ) else ( @if %MSVC_VERSION% EQU 7 ( @copy "%FrameworkSDKDir%\bin\msvcp%MSVC_VERSION%?.dll" %FB_OUTPUT_DIR%\bin\ > nul @copy "%FrameworkSDKDir%\bin\msvcr%MSVC_VERSION%?.dll" %FB_OUTPUT_DIR%\bin\ > nul ) ) - +) @if %ERRORLEVEL% GEQ 1 ( (call :ERROR Copying MSVC runtime library failed with error %ERRORLEVEL% ) & (goto :EOF)) ::grab some missing bits'n'pieces from different parts of the source tree ::========================================================================= @@ -616,14 +618,14 @@ endlocal ::======= :: Now let's go and build the installable .exe :: -:: Note - define INNO_SETUP_PATH with double quotes if it is installed into a path string using spaces. -:: eg set INNO_SETUP_PATH="C:\Program Files\Inno Setup 4" +:: Note - define INNO5_SETUP_PATH with double quotes if it is installed into a path string using spaces. +:: eg set INNO5_SETUP_PATH="C:\Program Files\Inno Setup 5" :: ::================================================= if %FBBUILD_ISX_PACK% NEQ 1 goto :EOF @Echo Now let's compile the InnoSetup scripts @Echo. -"%INNO_SETUP_PATH%"\iscc %FB_ROOT_PATH%\builds\install\arch-specific\win32\FirebirdInstall_%FBBUILD_FILE_ID%.iss +%INNO5_SETUP_PATH%\iscc %FB_ROOT_PATH%\builds\install\arch-specific\win32\FirebirdInstall_%FBBUILD_FILE_ID%.iss @echo. @echo End of ISX_PACK @@ -647,7 +649,7 @@ if %FBBUILD_ISX_PACK% NEQ 1 goto :EOF @echo (These files roughly double the size of the package.) @echo. @echo ISX Create installable binary from InnoSetup Extensions compiler. -@echo (You need to set the INNO_SETUP_PATH environment variable.) +@echo (You need to set the INNO5_SETUP_PATH environment variable.) @echo. @echo ZIP Create Zip package. @echo (SEVENZIP is currently used and the SEVENZIP env var must be set.) diff --git a/builds/install/arch-specific/win32/FirebirdInstallEnvironmentChecks.inc b/builds/install/arch-specific/win32/FirebirdInstallEnvironmentChecks.inc index 38934f4048..7b04eb71af 100644 --- a/builds/install/arch-specific/win32/FirebirdInstallEnvironmentChecks.inc +++ b/builds/install/arch-specific/win32/FirebirdInstallEnvironmentChecks.inc @@ -42,7 +42,8 @@ function CopyFbClientLib: boolean; function ShowCopyFbClientLibTask: boolean; - + function HasWI30: boolean; + function HasNotWI30: boolean; *) @@ -83,27 +84,44 @@ Const BrokenInstall = 32; //version or component mismatch found, so mark broken //Possible product installs - IB4Install = 0; - IB5Install = 1; - IB6Install = 2; - IB65Install = 3; - IB7Install = 4; - FB1Install = 5; - FB15RCInstall = 6; - FB15Install = 7; - FB2Install = 8; //All Fb 1.6 and beyond - MaxProdInstalled = FB2Install; + IB4Install = 0; + IB5Install = 1; + IB6Install = 2; + IB65Install = 3; + IB70Install = 4; + FB1Install = 5; + FB15RCInstall = 6; + FB15Install = 7; + FB20Install = 8; + IB80Install = 9; + IB81Install = 10; + FB21Install = 11; + FB21_x64_Install = 12; + FB25Install = 13; + FB25_x64_Install = 14; + FB30Install = 15; + FB30_x64_Install = 16; - //ProductsInstalled - IB4 = $0001; - IB5 = $0002; - IB6 = $0004; - IB65 = $0008; - IB7 = $0010; - FB1 = $0020; - FB15RC = $0040; - FB15 = $0080; - FB2 = $0100; + MaxProdInstalled = FB30_x64_Install; + +//ProductsInstalled + IB4 = $00001; + IB5 = $00002; + IB6 = $00004; + IB65 = $00008; + IB70 = $00010; + FB1 = $00020; + FB15RC = $00040; + FB15 = $00080; + FB20 = $00100; + IB80 = $00200; + IB81 = $00400; + FB21 = $00800; + FB25 = $01000; + FB30 = $02000; + FB21_x64 = $04000; + FB25_x64 = $08000; + FB30_x64 = $10000; // Likely gds32 version strings for installed versions of Firebird or InterBase are: // [6,0,n,n] InterBase 6.0 @@ -140,6 +158,7 @@ Type InstallType: Integer; ActualVersion: String; FirebirdVersion:String; + RootKey: Integer; end; @@ -150,6 +169,7 @@ procedure InitExistingInstallRecords; var product: Integer; begin + SetArrayLength(ProductsInstalledArray,MaxProdInstalled + 1); for product := 0 to MaxProdInstalled do begin @@ -162,6 +182,7 @@ begin ProductsInstalledArray[product].RegKey := IBRegKey; ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry; ProductsInstalledArray[product].MessageFile := IB4MessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; end; IB5Install: begin @@ -169,6 +190,7 @@ begin ProductsInstalledArray[product].RegKey := IB5RegKey; ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry; ProductsInstalledArray[product].MessageFile := IBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; end; IB6Install: begin @@ -176,6 +198,7 @@ begin ProductsInstalledArray[product].RegKey := IBRegKey; ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry; ProductsInstalledArray[product].MessageFile := IBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; end; IB65Install: begin @@ -183,13 +206,31 @@ begin ProductsInstalledArray[product].RegKey := IBRegKey; ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry; ProductsInstalledArray[product].MessageFile := IBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; end; - IB7Install: begin + IB70Install: begin ProductsInstalledArray[product].Description := IBDesc; ProductsInstalledArray[product].RegKey := IBRegKey; ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry; ProductsInstalledArray[product].MessageFile := IBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; + end; + + IB80Install: begin + ProductsInstalledArray[product].Description := IBDesc; + ProductsInstalledArray[product].RegKey := IBRegKey; + ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry; + ProductsInstalledArray[product].MessageFile := IBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; + end; + + IB81Install: begin + ProductsInstalledArray[product].Description := IBDesc; + ProductsInstalledArray[product].RegKey := IBRegKey; + ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry; + ProductsInstalledArray[product].MessageFile := IBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; end; FB1Install: begin @@ -197,6 +238,7 @@ begin ProductsInstalledArray[product].RegKey := IBRegKey; ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry; ProductsInstalledArray[product].MessageFile := IBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; end; FB15RCInstall: begin @@ -204,6 +246,7 @@ begin ProductsInstalledArray[product].RegKey := FB15RCKey; ProductsInstalledArray[product].RegEntry := LegacyRegPathEntry; ProductsInstalledArray[product].MessageFile := FBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; end; FB15Install: begin @@ -211,22 +254,72 @@ begin ProductsInstalledArray[product].RegKey := FB2RegKey; ProductsInstalledArray[product].RegEntry := FBRegPathEntry; ProductsInstalledArray[product].MessageFile := FBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; end; - FB2Install: begin + FB20Install: begin ProductsInstalledArray[product].Description := FBDesc; ProductsInstalledArray[product].RegKey := FB2RegKey; ProductsInstalledArray[product].RegEntry := FBRegPathEntry; ProductsInstalledArray[product].MessageFile := FBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; + end; + + FB21Install: begin + ProductsInstalledArray[product].Description := FBDesc + ' (Win32) '; + ProductsInstalledArray[product].RegKey := FB2RegKey; + ProductsInstalledArray[product].RegEntry := FBRegPathEntry; + ProductsInstalledArray[product].MessageFile := FBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; + end; + + FB21_x64_Install: begin + ProductsInstalledArray[product].Description := FBDesc + ' (x64) '; + ProductsInstalledArray[product].RegKey := FB2RegKey; + ProductsInstalledArray[product].RegEntry := FBRegPathEntry; + ProductsInstalledArray[product].MessageFile := FBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM64; + end; + + FB25Install: begin + ProductsInstalledArray[product].Description := FBDesc + ' (Win32) '; + ProductsInstalledArray[product].RegKey := FB2RegKey; + ProductsInstalledArray[product].RegEntry := FBRegPathEntry; + ProductsInstalledArray[product].MessageFile := FBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; + end; + + FB25_x64_Install: begin + ProductsInstalledArray[product].Description := FBDesc + ' (x64) '; + ProductsInstalledArray[product].RegKey := FB2RegKey; + ProductsInstalledArray[product].RegEntry := FBRegPathEntry; + ProductsInstalledArray[product].MessageFile := FBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM64; + end; + + FB30Install: begin + ProductsInstalledArray[product].Description := FBDesc + ' (Win32) '; + ProductsInstalledArray[product].RegKey := FB2RegKey; + ProductsInstalledArray[product].RegEntry := FBRegPathEntry; + ProductsInstalledArray[product].MessageFile := FBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM32; + end; + + FB30_x64_Install: begin + ProductsInstalledArray[product].Description := FBDesc + ' (x64) '; + ProductsInstalledArray[product].RegKey := FB2RegKey; + ProductsInstalledArray[product].RegEntry := FBRegPathEntry; + ProductsInstalledArray[product].MessageFile := FBMessageFile; + ProductsInstalledArray[product].RootKey := HKLM64; end; end; //case - ProductsInstalledArray[product].Path := GetRegistryEntry( - ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry); + ProductsInstalledArray[product].Path := GetRegistryEntry(ProductsInstalledArray[product].RootKey, + ProductsInstalledArray[product].RegKey, ProductsInstalledArray[product].RegEntry); ProductsInstalledArray[product].RegVersion := GetRegistryEntry( - ProductsInstalledArray[product].RegKey, 'Version'); + ProductsInstalledArray[product].RootKey, ProductsInstalledArray[product].RegKey, 'Version'); end; //for end; //function @@ -386,14 +479,14 @@ begin ProductsInstalledArray[product].InstallType := NotInstalled; end; - IB7Install: begin + IB70Install: begin //If we get here we have ambiguity with other versions of InterBase and Firebird if ( pos('InterBase',ProductsInstalledArray[product].RegVersion) > 0 ) then begin if CompareVersion(ProductsInstalledArray[product].ClientVersion, '7.0.0.0',1) <> 0 then ProductsInstalledArray[product].InstallType := NotInstalled else if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin - ProductsInstalled := ProductsInstalled + IB7; + ProductsInstalled := ProductsInstalled + IB70; ProductsInstalledCount := ProductsInstalledCount + 1; end; end @@ -436,16 +529,118 @@ begin end; end; - FB2Install: begin + FB20Install: begin if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.0.0.0',2) <> 0) then ProductsInstalledArray[product].InstallType := NotInstalled else if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin - ProductsInstalled := ProductsInstalled + FB2; + ProductsInstalled := ProductsInstalled + FB20; ProductsInstalledCount := ProductsInstalledCount + 1; end; end; + IB80Install: begin + //If we get here we have ambiguity with other versions of InterBase and Firebird + if ( pos('InterBase',ProductsInstalledArray[product].RegVersion) > 0 ) then begin + if CompareVersion(ProductsInstalledArray[product].ClientVersion, '8.0.0.0',2) <> 0 then + ProductsInstalledArray[product].InstallType := NotInstalled + else + if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin + ProductsInstalled := ProductsInstalled + IB80; + ProductsInstalledCount := ProductsInstalledCount + 1; + end; + end + else + ProductsInstalledArray[product].InstallType := NotInstalled; + end; + + IB81Install: begin + //If we get here we have ambiguity with other versions of InterBase and Firebird + if ( pos('InterBase',ProductsInstalledArray[product].RegVersion) > 0 ) then begin + if CompareVersion(ProductsInstalledArray[product].ClientVersion, '8.1.0.0',2) <> 0 then + ProductsInstalledArray[product].InstallType := NotInstalled + else + if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin + ProductsInstalled := ProductsInstalled + IB81; + ProductsInstalledCount := ProductsInstalledCount + 1; + end; + end + else + ProductsInstalledArray[product].InstallType := NotInstalled; + end; + + FB21Install: begin + if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.1.0.0',2) <> 0) then + ProductsInstalledArray[product].InstallType := NotInstalled + else + if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin + ProductsInstalled := ProductsInstalled + FB21; + ProductsInstalledCount := ProductsInstalledCount + 1; + end; + end; + + FB21_x64_Install: begin + if iswin64 then begin + if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.1.0.0',2) <> 0) then + ProductsInstalledArray[product].InstallType := NotInstalled + else + if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin + ProductsInstalled := ProductsInstalled + FB21_x64; + ProductsInstalledCount := ProductsInstalledCount + 1; + end + end + else + ProductsInstalledArray[product].InstallType := NotInstalled; + end; + + FB25Install: begin + if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.5.0.0',2) <> 0) then + ProductsInstalledArray[product].InstallType := NotInstalled + else + if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin + ProductsInstalled := ProductsInstalled + FB25; + ProductsInstalledCount := ProductsInstalledCount + 1; + end; + end; + + FB25_x64_Install: begin + if iswin64 then begin + if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '2.5.0.0',2) <> 0) then + ProductsInstalledArray[product].InstallType := NotInstalled + else + if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin + ProductsInstalled := ProductsInstalled + FB25_x64; + ProductsInstalledCount := ProductsInstalledCount + 1; + end + end + else + ProductsInstalledArray[product].InstallType := NotInstalled; + end; + + FB30Install: begin + if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '3.0.0.0',2) <> 0) then + ProductsInstalledArray[product].InstallType := NotInstalled + else + if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin + ProductsInstalled := ProductsInstalled + FB30; + ProductsInstalledCount := ProductsInstalledCount + 1; + end; + end; + + FB30_x64_Install: begin + if iswin64 then begin + if (CompareVersion(ProductsInstalledArray[product].ClientVersion, '3.0.0.0',2) <> 0) then + ProductsInstalledArray[product].InstallType := NotInstalled + else + if ((ProductsInstalledArray[product].InstallType AND ClientInstall) = ClientInstall) then begin + ProductsInstalled := ProductsInstalled + FB30_x64; + ProductsInstalledCount := ProductsInstalledCount + 1; + end + end + else + ProductsInstalledArray[product].InstallType := NotInstalled; + end; + end;//case @@ -497,7 +692,7 @@ procedure SetupSharedFilesArray; // - Libraries // - License files begin -SetArrayLength(SharedFileArray,29); +SetArrayLength(SharedFileArray,33); SharedFileArray[0].Filename := ExpandConstant('{app}')+'\IPLicense.txt'; SharedFileArray[1].Filename := ExpandConstant('{app}')+'\IDPLicense.txt'; @@ -540,7 +735,10 @@ if UsingWinNT then else SharedFileArray[28].Filename := ExpandConstant('{sys}')+'\FIREBI~1.CPL'; - +SharedFileArray[29].Filename := ExpandConstant('{app}')+'aliases.conf'; +SharedFileArray[30].Filename := ExpandConstant('{app}')+'firebird.conf'; +SharedFileArray[31].Filename := ExpandConstant('{app}')+'firebird.log'; +SharedFileArray[32].Filename := ExpandConstant('{app}')+'security2.fdb'; end; @@ -645,34 +843,76 @@ begin result := true; end; -//Detect any 1.5 or 2.0 server running with default ClassName or mutex -function FirebirdDefaultServerRunning: String; + +//Detect server running with default ClassName or mutex +var + RunningServerVerString: String; + +function FirebirdDefaultServerRunning: Boolean; var Handle: Integer; mutex_found: boolean; + mutexes: String; begin - result := ''; - //Look for a running version of Firebird 1.5 or later - Handle := FindWindowByClassName('FB_Disabled'); - if ( Handle = 0 ) then - Handle := FindWindowByClassName('FB_Server'); - if ( Handle = 0 ) then - Handle := FindWindowByClassName('FB_Guard'); + RunningServerVerString := ''; + Result := false; - if (Handle > 0) then - result := '1.5' - else begin - mutex_found := CheckForMutexes('FirebirdGuardianMutex,FirebirdServerMutex'); - if mutex_found then - result := '2.0' - else begin - mutex_found := CheckForMutexes('FirebirdGuardianMutexDefaultInstance,FirebirdServerMutexDefaultInstance'); - if mutex_found then - result := '2.1' - end; + if FirebirdOneRunning then + RunningServerVerString := 'Firebird v1.0 / InterBase'; + //Look for a valid window handle + if RunningServerVerString = '' then begin + //This is effectivley a test for Firebird running as an application. + //This is useful if Firebird is running without the guardian + //because prior to v2.0.4 there is no server mutex. + Handle := FindWindowByClassName('FB_Disabled'); + if ( Handle = 0 ) then + Handle := FindWindowByClassName('FB_Server'); + if ( Handle = 0 ) then + Handle := FindWindowByClassName('FB_Guard'); + + if (Handle > 0) then + RunningServerVerString := 'Firebird'; end; + //Look for a firebird mutex + if RunningServerVerString = '' then begin + //General Notes on testing for mutexes: + // - Mutexes are case-sensitive. + // - Don't escape the slash in Global\, Local\ etc. (We don't currently use Local\) + // + // v2.0 notes + // - v2.0 prior to 2.0.4 does not create a FirebirdServerMutex mutex, + // so server running without guardian is not detected. + // - v2.0.4 creates mutexes without the global prefix. + // - Later versions (if any) will use the prefix, so we will test for them anyway. + mutexes := 'Global\FirebirdGuardianMutex' + ',' + + 'Global\FirebirdServerMutex' + ',' + + 'FirebirdGuardianMutex' + ',' + + 'FirebirdServerMutex'; + mutex_found := CheckForMutexes(mutexes); + + if mutex_found then + RunningServerVerString := 'Firebird'; + end; + + if RunningServerVerString = '' then begin + //v2.1.1 notes + // - v2.1.0 creates mutexes without the global prefix. + // - v2.1.1 and later should use the correct prefix. + mutexes := 'Global\FirebirdGuardianMutexDefaultInstance' + ',' + + 'Global\FirebirdServerMutexDefaultInstance' + ',' + + 'FirebirdGuardianMutexDefaultInstance' + ',' + + 'FirebirdServerMutexDefaultInstance'; + mutex_found := CheckForMutexes(mutexes); + + if mutex_found then + RunningServerVerString := 'Firebird v2.1' + end; + + if RunningServerVerString <> '' then + Result := True; + end; @@ -680,7 +920,7 @@ function InstallCPLApplet: boolean; begin result := False; if ( (ConfigureFirebird) AND (not NoCPL) ) then - result := (ShouldProcessEntry('ServerComponent\SuperServerComponent', 'InstallCPLAppletTask') = srYes) ; + result := IsTaskSelected('InstallCPLAppletTask') ; end; @@ -701,7 +941,7 @@ begin if ConfigureFirebird then begin //If one of these is false then either the commandline switch was passed //or the user unchecked the Copy client as GDS32 box - result := ( (not NoLegacyClient) AND (ShouldProcessEntry('ClientComponent', 'CopyFbClientAsGds32Task')= srYes) ); + result := ( (not NoLegacyClient) AND (IsTaskSelected('CopyFbClientAsGds32Task') )); end; end; @@ -716,7 +956,8 @@ end; function CopyFbClientLib: boolean; begin //Note that the default for this is the opposite to CopyGds32. - result := ( (CopyFbClient) OR (ShouldProcessEntry('ClientComponent', 'CopyFbClientToSysTask')= srYes) ); + //result := ( (CopyFbClient) OR (ShouldProcessEntry('ClientComponent', 'CopyFbClientToSysTask')= srYes) ); + result := ( (not CopyFbClient) AND (IsTaskSelected('CopyFbClientToSysTask') )); end; @@ -728,4 +969,24 @@ begin result := ((not CopyFbClient) and ConfigureFirebird); end; +function HasWI30: boolean; +//We need at least Windows Installer 3.0 available if we +//are installing the msi bundles for the VC8 CRT libraries. +var + VersionStr: String; + VerInt: array of Integer; +begin + Result := False; + VersionStr := WIVersion; + DecodeVersion(VersionStr, VerInt); + if (VerInt[0] >= 3) then + Result := True; + +end; + +function HasNotWI30: boolean; +//Used to check if O/S does NOT have minimum version of Windows Installer +begin + result := NOT HasWI30; +end; diff --git a/builds/install/arch-specific/win32/FirebirdInstallSupportFunctions.inc b/builds/install/arch-specific/win32/FirebirdInstallSupportFunctions.inc index 7e319a7684..5d0ecd07b3 100644 --- a/builds/install/arch-specific/win32/FirebirdInstallSupportFunctions.inc +++ b/builds/install/arch-specific/win32/FirebirdInstallSupportFunctions.inc @@ -25,6 +25,8 @@ Function Prototypes + function IsWin32: boolean; + function Is32BitInstallMode: boolean; function IsVista: boolean; function IsWin2k3: boolean; function IsWinXP: boolean; @@ -36,6 +38,7 @@ Function Prototypes function CheckWinsock2(): Boolean; function GetAppPath: String; function GetSysPath: String; + function WIVersion: string; function ReplaceLine(Filename, StringToFind, NewLine,CommentType: string): boolean; procedure DecodeVersion( VerStr: String; var VerInt: array of Integer ); function CompareVersion( ver1, ver2: String ) : Integer; @@ -67,22 +70,56 @@ Windows NT versions: *) -Type TWindowsVersion = record - Major: Cardinal; // Major version number - Minor: Cardinal; // Minor version number - Build: Cardinal; // Build number - NTPlatform: Boolean; // True if an NT-based platform - end; +(* +Windows Installer versions: (extracted from MSDN) +Release Version Description +----------------------------------------------- +v2.0 2.0.2600.0 Released with Windows XP. +v2.0 2.0.2600.1 Released with Windows 2000 Server SP3. +v2.0 2.0.2600.1183 Released with Windows 2000 Server SP4. +v2.0 2.0.2600.2 Released as a redistributable. +v2.0 2.0.2600.1106 Released with Windows XP SP1. +v2.0 2.0.3790.0 Released with Windows Server 2003. +v3.0 3.0.3790.2180 Released with Windows XP SP2. + Released as a redistributable. +v3.1 3.1.4000.1823 Released as a redistributable. + This version has the same functionality as version 3.1.4000.2435. +v3.1 3.1.4000.1830 Released with Windows Server 2003 SP1 and + Windows XP Professional x64 Edition. + Update this version to version 3.1.4000.2435 + to address the issue discussed in KB898628. +v3.1 3.1.4000.2435 Released with a fix to address the issue + discussed in KB898628. This is the latest version + of Windows Installer 3.1. +v4.0 4.0.6000.16386 Released with Windows Vista. +v4.0 4.0.6001.16531 or greater Released with Windows Vista SP1 and + Windows Server 2008. -procedure GetWindowsVersionEx(Version: TWindowsVersion); -var - WinVer: Cardinal; +(NB1 - msi.dll stores the correct version number and is updated + automatically by Windows Update. msiexec.exe will be the original shipped version. + + NB2 - Re v3.1 build numbers and KB 898628 - This KB article refers to the + fact that initial releases of WI 3.1 would error and STOP if an attempt + was made to overwrite a system file in the WFP list. Previous behaviour + was to error, log and continue. This behaviour is irrelevant to us because + we don't do anything sophisticated with the msi. OTOH, if we used msi + for all our installation needs this would be a serious problem. + + NB3 - Our installer will not run msiexec on systems before XP. However, some early XP and W2K3 + systems do not have v3.0 of the Windows Installer. +*) + + +function IsWin32: boolean; +//helper function to simplify logic of x86/win64 checks. begin - WinVer := GetWindowsVersion; - Version.Major := WinVer shr 24; - Version.Minor := (WinVer shr 16) and $FF; - Version.Build := WinVer and $FFFF; - Version.NTPlatform := UsingWinNT; + result := not IsWin64; +end; + +function Is32BitInstallMode: boolean; +//helper function to simplify logic of x86/win64 checks. +begin + result := not Is64BitInstallMode; end; function IsVista: boolean; @@ -196,6 +233,15 @@ begin // Result := '"' + Result +'"'; end; +function WIVersion: string; +//Get version of Windows Installer +var + VersionStr: string; +begin + GetVersionNumbersString(GetSysPath + '\msi.dll', VersionStr); + result := VersionStr; +end; + (*Based on InnoSetup KB example at http://www13.brinkster.com/vincenzog/isxart.asp?idart=14)*) function ReplaceLine(Filename, StringToFind, NewLine,CommentType: string): boolean; @@ -336,10 +382,16 @@ begin end; -function GetRegistryEntry(RegKey, RegEntry: string): String; +function GetRegistryEntry(RootKey: Integer; RegKey, RegEntry: string): String; begin - result := ''; - RegQueryStringValue(HKEY_LOCAL_MACHINE, RegKey, RegEntry, Result); + Result := ''; + //if not win64 and RootKey is HKLM64 then we are on a 32-bit box, + //so skip looking in registry + if ( (RootKey = HKLM64) AND (isWin32) ) then + //do nothing + Result := '' + else + RegQueryStringValue(RootKey, RegKey, RegEntry, Result); end; diff --git a/builds/install/arch-specific/win32/FirebirdInstall_20.iss b/builds/install/arch-specific/win32/FirebirdInstall_20.iss index 5eb30e26e5..25ac1b6d1a 100644 --- a/builds/install/arch-specific/win32/FirebirdInstall_20.iss +++ b/builds/install/arch-specific/win32/FirebirdInstall_20.iss @@ -19,12 +19,12 @@ ; of an existing install directory. ; Simon Carter for the WinSock2 detection. ; Philippe Makowski for internationalization and french translation +; Sergey Nikitin for migrating to ISS v5. ; Usage Notes: ; -; This script has been designed to work with Inno Setup v4.2.7 -; with Inno Setup Preprocessor v. 1.2.1.295. It is available -; as a quick start pack from here: +; This script has been designed to work with Inno Setup v5.2.3 +; It is available as a quick start pack from here: ; http://www.jrsoftware.org/isdl.php#qsp ; ; @@ -36,24 +36,6 @@ ; application will not be stopped and the uninstall will not complete ; cleanly. ; -; InnoSetup does not support script execution as part of uninstallation. -; And this feature is not likely to be added in the near future. Here is -; the definitive explanation from Jordan Russell, the developer of InnoSetup: -; -; 'The uninstaller currently relies on a 100% forward compatible uninstall -; log format. When an existing uninstall log is appended to, and the -; uninstaller EXE is replaced with a newer version, the previous log contents -; are guaranteed to be processed properly. There are no such guarantees of -; forward compatibility with the Pascal Scripting feature; some support -; functions might be removed at some point, their declarations might change, -; etc. For the uninstaller to support Pascal Scripting, it would likely have -; to abandon the uninstall-log-appending concept, and instead create multiple -; uninstaller EXEs (chained together somehow) and multiple uninstall logs.' -; -; To work around this we will probably need to extend the instsvc/instreg -; utilities to support uninstallation of applications. -; -; ; o The uninstaller does not know how to stop multiple instances of a classic ; server. They must be stopped manually. ; @@ -114,6 +96,7 @@ #undef files ;We speed up compilation (and hence testing) by not compressing contents. #undef compression + #endif @@ -133,27 +116,42 @@ ;------If necessary we can turn off i18n by uncommenting this undefine ;#undef i18n +;----- If we are debugging the script (and not executed from command prompt) +;----- there is no guarantee that the environment variable exists. However an +;----- expression such as #define FB_MAJOR_VER GetEnv("FB_MAJOR_VER") will +;----- 'define' the macro anyway so we need to test for a valid env var before +;----- we define our macro. +#if Len(GetEnv("FB_MAJOR_VER")) > 0 #define FB_MAJOR_VER GetEnv("FB_MAJOR_VER") +#endif #ifdef FB_MAJOR_VER #define MajorVer FB_MAJOR_VER #endif +#if Len(GetEnv("FB_MINOR_VER")) > 0 #define FB_MINOR_VER GetEnv("FB_MINOR_VER") +#endif #ifdef FB_MINOR_VER #define MinorVer FB_MINOR_VER #endif +#if Len(GetEnv("FB_REV_NO")) > 0 #define FB_REV_NO GetEnv("FB_REV_NO") +#endif #ifdef FB_REV_NO #define PointRelease FB_REV_NO #endif +#if Len(GetEnv("FB_BUILD_NO")) > 0 #define FB_BUILD_NO GetEnv("FB_BUILD_NO") +#endif #ifdef FB_BUILD_NO #define BuildNumber FB_BUILD_NO #endif +#if Len(GetEnv("FBBUILD_PACKAGE_NUMBER")) > 0 #define FBBUILD_PACKAGE_NUMBER GetEnv("FBBUILD_PACKAGE_NUMBER") +#endif #ifdef FBBUILD_PACKAGE_NUMBER #define PackageNumber FBBUILD_PACKAGE_NUMBER #endif @@ -167,16 +165,21 @@ #endif #define MyAppVerName MyAppName + " " + MyAppVerString - +;---- If we haven't already set PlatformTarget then pick it up from the environment. +#ifndef PlatformTarget +#define PlatformTarget GetEnv("FB_TARGET_PLATFORM") +#endif +#if PlatformTarget == "" #define PlatformTarget "win32" +#endif ;This location is relative to SourceDir (declared below) #define FilesDir="output" #define msvc_version 7 -;BaseVer should be used for all v2.n installs. -;This allows us to upgrade silently from 2.0 to 2.1 -#define BaseVer MajorVer + "_0" +;BaseVer should be used for all v2.0.n installs. +;This allows us to upgrade silently from 2.1.m to 2.1.n +#define BaseVer MajorVer + "_" + MinorVer #define AppVer MajorVer + "_" + MinorVer #define GroupnameVer MajorVer + "." + MinorVer @@ -246,32 +249,34 @@ Compression=none SolidCompression=yes #endif +ShowUndisplayableLanguages={#defined iss_debug} AllowNoIcons=true AlwaysShowComponentsList=true PrivilegesRequired=admin -ShowTasksTreeLines=false -LanguageDetectionMethod=uilanguage [Languages] Name: en; MessagesFile: compiler:Default.isl; InfoBeforeFile: {#ScriptsDir}\installation_readme.txt; InfoAfterFile: {#ScriptsDir}\readme.txt; #ifdef i18n Name: ba; MessagesFile: compiler:Languages\Bosnian.isl; InfoBeforeFile: {#ScriptsDir}\ba\Instalacija_ProcitajMe.txt; InfoAfterFile: {#ScriptsDir}\ba\ProcitajMe.txt; +Name: cz; MessagesFile: compiler:Languages\Czech.isl; InfoBeforeFile: {#ScriptsDir}\installation_readme.txt; InfoAfterFile: {#ScriptsDir}\readme.txt; Name: fr; MessagesFile: compiler:Languages\French.isl; InfoBeforeFile: {#ScriptsDir}\fr\installation_lisezmoi.txt; InfoAfterFile: {#ScriptsDir}\fr\lisezmoi.txt; Name: de; MessagesFile: compiler:Languages\German.isl; InfoBeforeFile: {#ScriptsDir}\de\installation_liesmich.txt; InfoAfterFile: {#ScriptsDir}\de\liesmich.txt; Name: es; MessagesFile: compiler:Languages\Spanish.isl; InfoBeforeFile: {#ScriptsDir}\es\leame_instalacion.txt; InfoAfterFile: {#ScriptsDir}\es\leame.txt; Name: hu; MessagesFile: compiler:Languages\Hungarian.isl; InfoBeforeFile: {#ScriptsDir}\hu\telepitesi_segedlet.txt; InfoAfterFile: {#ScriptsDir}\hu\olvass_el.txt; Name: it; MessagesFile: compiler:Languages\Italian.isl; InfoBeforeFile: {#ScriptsDir}\it\leggimi_installazione.txt; InfoAfterFile: {#ScriptsDir}\it\leggimi.txt Name: pl; MessagesFile: compiler:Languages\Polish.isl; InfoBeforeFile: {#ScriptsDir}\pl\instalacja_czytajto.txt; InfoAfterFile: {#ScriptsDir}\pl\czytajto.txt; -Name: pt; MessagesFile: compiler:Languages\PortugueseStd.isl; InfoBeforeFile: {#ScriptsDir}\pt\instalacao_leia-me.txt; InfoAfterFile: {#ScriptsDir}\pt\leia-me.txt +Name: pt; MessagesFile: compiler:Languages\Portuguese.isl; InfoBeforeFile: {#ScriptsDir}\pt\instalacao_leia-me.txt; InfoAfterFile: {#ScriptsDir}\pt\leia-me.txt Name: ru; MessagesFile: compiler:Languages\Russian.isl; InfoBeforeFile: {#ScriptsDir}\ru\installation_readme.txt; InfoAfterFile: {#ScriptsDir}\ru\readme.txt; Name: si; MessagesFile: compiler:Languages\Slovenian.isl; InfoBeforeFile: {#ScriptsDir}\si\instalacija_precitajMe.txt; InfoAfterFile: {#ScriptsDir}\readme.txt; +Name: sk; MessagesFile: compiler:Languages\Slovak.isl; InfoBeforeFile: {#ScriptsDir}\installation_readme.txt; InfoAfterFile: {#ScriptsDir}\readme.txt; #endif [Messages] en.BeveledLabel=English #ifdef i18n ba.BeveledLabel=Bosanski +cz.BeveledLabel=?eština fr.BeveledLabel=Français de.BeveledLabel=Deutsch es.BeveledLabel=Español @@ -281,12 +286,14 @@ pl.BeveledLabel=Polski pt.BeveledLabel=Português ru.BeveledLabel=Ðóññêèé si.BeveledLabel=Slovenski +sk.BeveledLabel=Sloven?ina #endif [CustomMessages] #include "custom_messages.inc" #ifdef i18n #include "ba\custom_messages_ba.inc" +#include "cz\custom_messages_cz.inc" #include "fr\custom_messages_fr.inc" #include "de\custom_messages_de.inc" #include "es\custom_messages_es.inc" @@ -296,6 +303,7 @@ si.BeveledLabel=Slovenski #include "pt\custom_messages_pt.inc" #include "ru\custom_messages_ru.inc" #include "si\custom_messages_si.inc" +#include "sk\custom_messages_sk.inc" #endif #ifdef iss_debug @@ -339,7 +347,8 @@ Name: CopyFbClientAsGds32Task; Description: {cm:CopyFbClientAsGds32Task}; Compon [Run] ;Always register Firebird -Filename: {app}\bin\instreg.exe; Parameters: "install "; StatusMsg: {cm:instreg}; MinVersion: 4.0,4.0; Components: ClientComponent; Flags: runminimized +;Only register Firebird if we are installing AND configuring +Filename: {app}\bin\instreg.exe; Parameters: "install "; StatusMsg: {cm:instreg}; MinVersion: 4.0,4.0; Components: ClientComponent; Flags: runminimized; Check: ConfigureFirebird; Filename: {app}\bin\instclient.exe; Parameters: "install fbclient"; StatusMsg: {cm:instclientCopyFbClient}; MinVersion: 4.0,4.0; Components: ClientComponent; Flags: runminimized; Check: CopyFBClientLib; Filename: {app}\bin\instclient.exe; Parameters: "install gds32"; StatusMsg: {cm:instclientGenGds32}; MinVersion: 4.0,4.0; Components: ClientComponent; Flags: runminimized; Check: CopyGds32 @@ -348,8 +357,8 @@ Filename: {app}\bin\instclient.exe; Parameters: "install gds32"; StatusMsg: {cm: ;If on NT/Win2k etc and 'Install and start service' requested ;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. Filename: {app}\bin\instsvc.exe; Parameters: "remove "; StatusMsg: {cm:instsvcSetup}; MinVersion: 0,4.0; Components: ServerComponent; Flags: runminimized; Tasks: UseServiceTask; Check: ConfigureFirebird; -Filename: {app}\bin\instsvc.exe; Parameters: "install {code:ServiceStartFlags|""""} "; StatusMsg: {cm:instsvcSetup}; MinVersion: 0,4.0; Components: ServerComponent; Flags: runminimized; Tasks: UseServiceTask; Check: ConfigureFirebird; -Filename: {app}\bin\instsvc.exe; Description: {cm:instsvcStartQuestion}; Parameters: start; StatusMsg: {cm:instsvcStartMsg}; MinVersion: 0,4.0; Components: ServerComponent; Flags: runminimized postinstall; Tasks: UseServiceTask; Check: StartEngine +Filename: {app}\bin\instsvc.exe; Parameters: "install {code:ServiceStartFlags} "; StatusMsg: {cm:instsvcSetup}; MinVersion: 0,4.0; Components: ServerComponent; Flags: runminimized; Tasks: UseServiceTask; Check: ConfigureFirebird; +Filename: {app}\bin\instsvc.exe; Description: {cm:instsvcStartQuestion}; Parameters: "start" ; StatusMsg: {cm:instsvcStartMsg}; MinVersion: 0,4.0; Components: ServerComponent; Flags: runminimized postinstall runascurrentuser; Tasks: UseServiceTask; Check: StartEngine ;If 'start as application' requested Filename: {code:StartApp|{app}\bin\fbserver.exe}; Description: {cm:instappStartQuestion}; Parameters: -a; StatusMsg: {cm:instappStartMsg}; MinVersion: 0,4.0; Components: ServerComponent; Flags: nowait postinstall; Tasks: UseApplicationTask; Check: StartEngine @@ -402,6 +411,7 @@ Source: {#ScriptsDir}\readme.txt; DestDir: {app}; Components: DevAdminComponent; #ifdef i18n ;Translated files Source: {#ScriptsDir}\ba\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: ba; +;Source: {#ScriptsDir}\cz\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: cz; Source: {#ScriptsDir}\fr\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: fr; Source: {#ScriptsDir}\de\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: de; Source: {#ScriptsDir}\es\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: es; @@ -411,6 +421,7 @@ Source: {#ScriptsDir}\pl\*.txt; DestDir: {app}\doc; Components: DevAdminComponen Source: {#ScriptsDir}\pt\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: pt; Source: {#ScriptsDir}\ru\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: ru; Source: {#ScriptsDir}\si\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: si; +;Source: {#ScriptsDir}\sk\*.txt; DestDir: {app}\doc; Components: DevAdminComponent; Flags: ignoreversion; Languages: sk; #endif Source: {#FilesDir}\firebird.conf; DestDir: {app}; DestName: firebird.conf.default; Components: ServerComponent; check: FirebirdConfExists; Source: {#FilesDir}\firebird.conf; DestDir: {app}; DestName: firebird.conf; Components: ServerComponent; Flags: uninsneveruninstall; check: NoFirebirdConfExists @@ -443,9 +454,9 @@ Source: {#FilesDir}\bin\icuin30.dll; DestDir: {app}\bin; Components: ServerCompo Source: {#FilesDir}\bin\icudt30.dll; DestDir: {app}\bin; Components: ServerComponent; Flags: sharedfile ignoreversion ; Install MS libs locally if Win2K or later, else place in if NT4 or Win95/98/ME. -; NOTE: These dll's MUST never be sourced from the local system32 directory. -; Deploy libraries from vcredist if MSVC6 is used. Use %FrameworkSDKDir% is compiling with Visual Studio. -; The BuildExecutableInstall.bat will attempt to locate them and place them in output\system32\ +; NOTE: These dll's MUST never be sourced from the local system32 directory. +; Deploy libraries from vcredist if MSVC6 is used. Use %FrameworkSDKDir% if compiling with Visual Studio. +; The BuildExecutableInstall.bat will attempt to locate them and place them in {#FilesDir}\system32\ #if msvc_version == 6 Source: {#FilesDir}\bin\msvcrt.dll; DestDir: {app}\bin; Components: ClientComponent; Source: {#FilesDir}\bin\msvcrt.dll; DestDir: {sys}; Components: ClientComponent; Flags: sharedfile onlyifdoesntexist uninsneveruninstall; @@ -496,6 +507,7 @@ Source: {#FilesDir}\examples\udf\*.*; DestDir: {app}\examples\udf; Components: D Source: {#FilesDir}\bin\fbclient.pdb; DestDir: {app}\bin; Components: ClientComponent; Source: {#FilesDir}\bin\fb_inet_server.pdb; DestDir: {app}\bin; Components: ServerComponent\ClassicServerComponent; Source: {#FilesDir}\bin\fbserver.pdb; DestDir: {app}\bin; Components: ServerComponent\SuperServerComponent; +;Source: {#FilesDir}\bin\fbembed.pdb; DestDir: {app}\bin; Components: ClientComponent; #endif [UninstallRun] @@ -508,7 +520,7 @@ Filename: {app}\bin\instreg.exe; Parameters: " remove"; StatusMsg: {cm:instreg}; [UninstallDelete] Type: files; Name: {app}\*.lck Type: files; Name: {app}\*.evn - +Type: dirifempty; Name: {app} [_ISTool] EnableISX=true @@ -542,6 +554,14 @@ Var NoLegacyClient: Boolean; // pass /nogds32 on command line. CopyFbClient: Boolean; // pass /copyfbclient on command line. + // Options for scripted uninstall. + CleanUninstall: Boolean; // If /clean is passed to the uninstaller it will delete + // user config files - firebird.conf, firebird.log, + // aliases.conf and the security database. + +#ifdef setuplogging + OkToCopyLog : Boolean; // Set when installation is complete. +#endif #include "FirebirdInstallSupportFunctions.inc" @@ -565,8 +585,7 @@ if ProductsInstalledCount = 0 then SetArrayLength(InstallSummaryArray,ProductsInstalledCount); for product := 0 to MaxProdInstalled -1 do begin if (ProductsInstalledArray[product].InstallType <> NotInstalled) then begin - InstallSummaryArray[i] := Format1(ProductsInstalledArray[product].Description, - ProductsInstalledArray[product].ActualVersion); + InstallSummaryArray[i] := Format(ProductsInstalledArray[product].Description, [ProductsInstalledArray[product].ActualVersion]); if (ProductsInstalledArray[product].ServerVersion <> '') then begin if ((ProductsInstalledArray[product].InstallType AND ClassicServerInstall) = ClassicServerInstall) then @@ -597,7 +616,7 @@ for i:=0 to ProductsInstalledCount-1 do InstallSummary := InstallSummary + InstallSummaryArray[i] + #13; //If FB2 is installed -If ((ProductsInstalled AND FB2) = FB2) then +If ((ProductsInstalled AND FB20 ) = FB20 ) then InstallSummary := InstallSummary +#13 + ExpandConstant('{cm:InstallSummarySuffix1}') +#13 + ExpandConstant('{cm:InstallSummarySuffix2}') @@ -607,9 +626,9 @@ If ((ProductsInstalled AND FB2) = FB2) then ; if ProductsInstalledCount = 1 then - StatusDescription := Format2(ExpandConstant('{cm:InstalledProducts}'), IntToStr(ProductsInstalledCount), ExpandConstant('{cm:InstalledProdCountSingular}')) + StatusDescription := Format(ExpandConstant('{cm:InstalledProducts}'), [IntToStr(ProductsInstalledCount), ExpandConstant('{cm:InstalledProdCountSingular}')]) else - StatusDescription := Format2(ExpandConstant('{cm:InstalledProducts}'), IntToStr(ProductsInstalledCount), ExpandConstant('{cm:InstalledProdCountPlural}')); + StatusDescription := Format(ExpandConstant('{cm:InstalledProducts}'), [IntToStr(ProductsInstalledCount), ExpandConstant('{cm:InstalledProdCountPlural}')]); Result := StatusDescription +#13 @@ -637,24 +656,12 @@ begin end; - //If Fb2.0 is installed then we can install over it. - //unless we find the server running. + //If existing install of the same majorver.minorver is + //found then we can upgrade it. if (ProductsInstalledCount = 1) AND - ((ProductsInstalled AND FB2) = FB2) then begin - VerString := ( FirebirdDefaultServerRunning ); - if VerString <> '' then begin - result := false; - MsgBox( #13+Format1(ExpandConstant('{cm:FbRunning1}'),VerString) - +#13 - +#13+ExpandConstant('{cm:FbRunning2}') - +#13+ExpandConstant('{cm:FbRunning3}') - +#13, mbError, MB_OK); - exit; - end - else begin + ((ProductsInstalled AND FB20 ) = FB20 ) then begin result := true; exit; - end end ; @@ -678,16 +685,10 @@ function InitializeSetup(): Boolean; var i: Integer; CommandLine: String; - VerString: String; begin result := true; - if not CheckWinsock2 then begin - result := False; - exit; - end - CommandLine:=GetCmdTail; if ((pos('HELP',Uppercase(CommandLine)) > 0) or @@ -713,6 +714,17 @@ begin if pos('COPYFBCLIENT', Uppercase(CommandLine))>0 then CopyFbClient := True; + // Check if a server is running - we cannot continue if it is. + if FirebirdDefaultServerRunning then begin + result := false; + exit; + end; + + if not CheckWinsock2 then begin + result := False; + exit; + end + //By default we want to install and confugure, //unless subsequent analysis suggests otherwise. InstallAndConfigure := Install + Configure; @@ -722,20 +734,7 @@ begin InitExistingInstallRecords; AnalyzeEnvironment; result := AnalysisAssessment; - if result then begin - //There is a possibility that all our efforts to detect an - //install were in vain and a server _is_ running... - VerString := FirebirdDefaultServerRunning; - if ( VerString <> '' ) then begin - result := false; - MsgBox( #13+ExpandConstant('{cm:FbRunning1,VerString}') - +#13 - +#13+ExpandConstant('{cm:FbRunning2}') - +#13+ExpandConstant('{cm:FbRunning3}') - +#13, mbError, MB_OK); - exit; - end; - end; + end; @@ -748,13 +747,28 @@ begin // Ask user if they want to visit the Winsock2 update web page. if MsgBox(ExpandConstant('{cm:Winsock2Web1}')+#13#13+ExpandConstant('{cm:Winsock2Web2}'), mbInformation, MB_YESNO) = idYes then // User wants to visit the web page - InstShellExec(sMSWinsock2Update, '', '', SW_SHOWNORMAL, ErrCode); + ShellExec('open', sMSWinsock2Update, '', '', SW_SHOWNORMAL, ewNoWait, ErrCode); + + if RunningServerVerString <> '' then + MsgBox( #13+Format(ExpandConstant('{cm:FbRunning1}'), [RunningServerVerString]) + +#13 + +#13+ExpandConstant('{cm:FbRunning2}') + +#13+ExpandConstant('{cm:FbRunning3}') + +#13, mbError, MB_OK); + +#ifdef setuplogging + if OkToCopyLog then + FileCopy (ExpandConstant ('{log}'), ExpandConstant ('{app}\InstallationLogFile.log'), FALSE); + + RestartReplace (ExpandConstant ('{log}'), ''); +#endif /* setuplogging */ + end; -//This function tries to find an existing install of Firebird 1.5 +//This function tries to find an existing install of Firebird 2.n //If it succeeds it suggests that directory for the install -//Otherwise it suggests the default for Fb 1.5 +//Otherwise it suggests the default for Fb 2.n function ChooseInstallDir(Default: String): String; var InterBaseRootDir, @@ -781,7 +795,7 @@ begin InstallRootDir := Default; // but the user has changed the default if (( InstallRootDir = '') and - ( FirebirdVer[0] = 2 ) and ( FirebirdVer[1] = 0 ) ) then // Firebird 2.0 is installed + ( FirebirdVer[0] = {#MajorVer} ) and ( FirebirdVer[1] = {#MinorVer} ) ) then // Firebird 2.n is installed InstallRootDir := FirebirdRootDir; // but the user has changed the default // if we haven't found anything then try the FIREBIRD env var @@ -813,13 +827,12 @@ begin else ServerType := ' -superserver '; - - if ShouldProcessEntry('ServerComponent', 'AutoStartTask')= srYes then + if IsComponentSelected('ServerComponent') and IsTaskSelected('AutoStartTask') then SvcParams := ' -auto ' else SvcParams := ' -demand '; - if ShouldProcessEntry('ServerComponent', 'UseGuardianTask')= srYes then + if IsComponentSelected('ServerComponent') and IsTaskSelected('UseGuardianTask') then SvcParams := SvcParams + ServerType + ' -guardian' else SvcParams := SvcParams + ServerType; @@ -830,22 +843,22 @@ end; function InstallGuardianIcon(): Boolean; begin result := false; - if ShouldProcessEntry('ServerComponent', 'UseApplicationTask')= srYes then - if ShouldProcessEntry('ServerComponent', 'UseGuardianTask')= srYes then + if IsComponentSelected('ServerComponent') and IsTaskSelected('UseApplicationTask') then + if IsComponentSelected('ServerComponent') and IsTaskSelected('UseGuardianTask') then result := true; end; function InstallServerIcon(): Boolean; begin result := false; - if ShouldProcessEntry('ServerComponent', 'UseApplicationTask')= srYes then - if ShouldProcessEntry('ServerComponent', 'UseGuardianTask')= srNo then + if IsComponentSelected('ServerComponent') and IsTaskSelected('UseApplicationTask') then + if NOT (IsComponentSelected('ServerComponent') and IsTaskSelected('UseGuardianTask')) then result := true; end; function StartApp(Default: String): String; begin - if ShouldProcessEntry('ServerComponent', 'UseGuardianTask')= srYes then begin + if IsComponentSelected('ServerComponent') and IsTaskSelected('UseGuardianTask') then begin Result := GetAppPath+'\bin\fbguard.exe'; if ClassicInstallChosen then Result := Result + ' -c'; @@ -863,8 +876,8 @@ function IsNotAutoStartApp: boolean; //Support function to help remove unwanted registry entry. begin result := true; - if ( ShouldProcessEntry('ServerComponent', 'AutoStartTask')= srYes) and - ( ShouldProcessEntry('ServerComponent', 'UseApplicationTask')= srYes ) then + if ( IsComponentSelected('ServerComponent') and IsTaskSelected('AutoStartTask') ) and + ( IsComponentSelected('ServerComponent') and IsTaskSelected('UseApplicationTask') ) then result := false; end; @@ -896,7 +909,7 @@ begin //we are doing a server install, so the easiest way is to see if a //firebird.conf exists. If it doesn't then we don't care. if FileExists(GetAppPath+'\firebird.conf') then begin - if ShouldProcessEntry('ServerComponent', 'UseGuardianTask') = srNo then + if NOT (IsComponentSelected('ServerComponent') and IsTaskSelected('UseGuardianTask')) then ReplaceLine(GetAppPath+'\firebird.conf','GuardianOption','GuardianOption = 0','#'); end; end; @@ -920,22 +933,30 @@ begin end; -procedure CurStepChanged(CurStep: Integer); +procedure CurStepChanged(CurStep: TSetupStep); var AppStr: String; ReadMeFileStr: String; begin case CurStep of - csCopy: begin + ssInstall: begin SetupSharedFilesArray; GetSharedLibCountBeforeCopy; end; - csFinished: begin + ssPostInstall: begin + //Manually set the sharedfile count of these files. + IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\firebird.conf', false); + IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\firebird.log', false); + IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\aliases.conf', false); + IncrementSharedCount(Is64BitInstallMode, GetAppPath+'\security2.fdb', false); + end; + + ssDone: begin //If user has chosen to install an app and run it automatically set up the registry accordingly //so that the server or guardian starts evertime they login. - if (ShouldProcessEntry('ServerComponent', 'AutoStartTask')= srYes) and - ( ShouldProcessEntry('ServerComponent', 'UseApplicationTask')= srYes ) then begin + if (IsComponentSelected('ServerComponent') and IsTaskSelected('AutoStartTask') ) and + ( IsComponentSelected('ServerComponent') and IsTaskSelected('UseApplicationTask') ) then begin AppStr := StartApp('')+' -a'; RegWriteStringValue (HKLM, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Run', 'Firebird', AppStr); end; @@ -954,6 +975,10 @@ begin DeleteFile(GetAppPath+'\doc\'+ReadMeFileStr); end; +#ifdef setuplogging + OkToCopyLog := True; +#endif + end; end; end; @@ -961,7 +986,7 @@ end; function StartEngine: boolean; begin if ConfigureFirebird then - result := not FirebirdOneRunning; + result := not FirebirdDefaultServerRunning; end; @@ -992,6 +1017,60 @@ begin Result := not fileexists(GetAppPath+'\firebird.conf'); end; +function InitializeUninstall(): Boolean; +var + CommandLine: String; +begin + CommandLine:=GetCmdTail; + if pos('CLEAN',Uppercase(CommandLine))>0 then + CleanUninstall:=True + else + CleanUninstall:=False; + + //MUST return a result of true, otherwise uninstall will abort! + result := true; +end; + +procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); +begin + + case CurUninstallStep of + +// usAppMutexCheck : + +// usUninstall : + + usPostUninstall : begin + // We are manually handling the share count of these files, so we must + // a) Decrement shared count of each one and + // b) If Decrement reaches 0 (ie, function returns true) then we + // test if CleanUninstall has been passed. + if DecrementSharedCount(Is64BitInstallMode, GetAppPath+'\firebird.conf') then + if CleanUninstall then + DeleteFile(GetAppPath+'\firebird.conf'); + + if DecrementSharedCount(Is64BitInstallMode, GetAppPath+'\firebird.log') then + if CleanUninstall then + DeleteFile(GetAppPath+'\firebird.log'); + + if DecrementSharedCount(Is64BitInstallMode, GetAppPath+'\aliases.conf') then + if CleanUninstall then + DeleteFile(GetAppPath+'\aliases.conf'); + + if DecrementSharedCount(Is64BitInstallMode, GetAppPath+'\security2.fdb') then + if CleanUninstall then + DeleteFile(GetAppPath+'\security2.fdb'); + + end; + +// usDone : + + end; + + +end; + + begin end. diff --git a/builds/install/arch-specific/win32/installation_scripted.txt b/builds/install/arch-specific/win32/installation_scripted.txt index 5151bc70e5..69484f10e8 100644 --- a/builds/install/arch-specific/win32/installation_scripted.txt +++ b/builds/install/arch-specific/win32/installation_scripted.txt @@ -8,11 +8,11 @@ o Setup Command Line Parameters o Parameters specific to Firebird installs o Setup exit codes o Uninstall Command Line Parameters +o Parameters specific to Firebird uninstalls o Uninstaller Exit Codes -(These notes are taken directly from the InnoSetup 4.2.7 documentation, - +(These notes are taken directly from the InnoSetup 5.1.12 documentation, except for Firebird specific parameters.) Quick summary of available parameters @@ -26,11 +26,16 @@ Setup parameters specific to the Firebird Installer /NOGDS32 /COPYFBCLIENT /COMPONENTS="comma separated list of component names" +/TASKS="comma separated list of task names" +/MERGETASKS="comma separated list of task names" + +Setup parameters specific to the Firebird Uninstaller +/CLEAN General parameters available to all InnoSetup based installers /SP- /SILENT | /VERYSILENT [/SUPPRESSMSGBOXES] -/LOG +/LOG[="filename"] /NOCANCEL /NORESTART /RESTARTEXITCODE=exit code @@ -45,78 +50,128 @@ General parameters available to all InnoSetup based installers Setup Command Line Parameters ----------------------------- -/SP- - Disables the This will install... Do you wish to continue? prompt at the - beginning of Setup. Of course, this will have no effect if the +The Setup program accepts optional command line parameters. These can be +useful to system administrators, and to other programs calling the Setup +program. + +/SP- + Disables the "This will install... Do you wish to continue?" prompt + at the beginning of Setup. Of course, this will have no effect if the DisableStartupPrompt [Setup] section directive was set to yes. - -/SILENT,/VERYSILENT - Instructs Setup to be silent or very silent. When Setup is silent the wizard and - the background window are not displayed but the installation progress window is. - When a setup is very silent this installation progress window is not displayed. - Everything else is normal so for example error messages during installation are - displayed and the startup prompt is (if you haven't disabled it with - DisableStartupPrompt or the '/SP-' command line option explained above) - - If a restart is necessary and the '/NORESTART' command isn't used (see below) - and Setup is silent, it will display a Reboot now? message box. If it's very - silent it will reboot without asking. - -/LOG - Causes Setup to create a log file in the user's TEMP directory detailing file - installation actions taken during the installation process. This can be a - helpful debugging aid. For example, if you suspect a file isn't being replaced - when you believe it should be (or vice versa), the log file will tell you if the - file was really skipped, and why. - - The log file is created with a unique name based on the current date. (It will - not overwrite or append to existing files.) Currently, it is not possible to - customize the filename. The information contained in the log file is technical - in nature and therefore not intended to be understandable by end users. Nor is - it designed to be machine-parseable; the format of the file is subject to change - without notice. - -/NOCANCEL - Prevents the user from cancelling during the installation process, by disabling - the Cancel button and ignoring clicks on the close button. Useful along with - '/SILENT' or '/VERYSILENT'. - -/NORESTART + +/SILENT, /VERYSILENT + Instructs Setup to be silent or very silent. When Setup is silent the + wizard and the background window are not displayed but the installation + progress window is. When a setup is very silent this installation + progress window is not displayed. Everything else is normal so for + example error messages during installation are displayed and the startup + prompt is (if you haven't disabled it with DisableStartupPrompt or the + '/SP-' command line option explained above). + + If a restart is necessary and the '/NORESTART' command isn't used (see + below) and Setup is silent, it will display a "Reboot now?" message box. + If it's very silent it will reboot without asking. + +/SUPPRESSMSGBOXES + Instructs Setup to suppress message boxes. Only has an effect when + combined with '/SILENT' and '/VERYSILENT'. + + The default response in situations where there's a choice is: + + Yes in a 'Keep newer file?' situation. + + No in a 'File exists, confirm overwrite.' situation. + + Abort in Abort/Retry situations. + + Cancel in Retry/Cancel situations. + + Yes (=continue) in a DiskSpaceWarning/DirExists/DirDoesntExist/ + NoUninstallWarning/ExitSetupMessage/ConfirmUninstall situation. + + Yes (=restart) in a FinishedRestartMessage/UninstalledAndNeedsRestart situation. + + 5 message boxes are not suppressible: + + The About Setup message box. + + The Exit Setup? message box. + + The FileNotInDir2 message box displayed when Setup requires a + new disk to be inserted and the disk was not found. + + Any (error) message box displayed before Setup (or Uninstall) + could read the command line parameters. + + Any message box displayed by [Code] support function MsgBox. + +/LOG + Causes Setup to create a log file in the user's TEMP directory detailing + file installation and [Run] actions taken during the installation + process. This can be a helpful debugging aid. For example, if you + suspect a file isn't being replaced when you believe it should be (or + vice versa), the log file will tell you if the file was really skipped, + and why. + + The log file is created with a unique name based on the current date. + (It will not overwrite or append to existing files.) + + The information contained in the log file is technical in nature and + therefore not intended to be understandable by end users. Nor is it + designed to be machine-parseable; the format of the file is subject to + change without notice. + +/LOG="filename" + Same as /LOG, except it allows you to specify a fixed path/filename to + use for the log file. If a file with the specified name already exists + it will be overwritten. If the file cannot be created, Setup will abort + with an error message. + +/NOCANCEL + Prevents the user from cancelling during the installation process, by + disabling the Cancel button and ignoring clicks on the close button. + Useful along with '/SILENT' or '/VERYSILENT'. + +/NORESTART Instructs Setup not to reboot even if it's necessary. - -/RESTARTEXITCODE=exit code - Specifies the custom exit code that Setup is to return when a restart is needed. - Useful along with '/NORESTART'. Also see Setup Exit Codes. - -/LOADINF="filename" - Instructs Setup to load the settings from the specified file after having - checked the command line. This file can be prepared using the '/SAVEINF=' - command as explained below. - + +/RESTARTEXITCODE=exit code + Specifies the custom exit code that Setup is to return when a restart is + needed. Useful along with '/NORESTART'. Also see Setup Exit Codes. + +/LOADINF="filename" + Instructs Setup to load the settings from the specified file after + having checked the command line. This file can be prepared using the + '/SAVEINF=' command as explained below. + Don't forget to use quotes if the filename contains spaces. - + /SAVEINF="filename" - Instructs Setup to save installation settings to the specified file. Don't - forget to use quotes if the filename contains spaces. - -/LANG=language - Specifies the language to use. language specifies the internal name of the - language as specified in a [Languages] section entry. When a valid /LANG - parameter is used, the Select Language dialog will be suppressed. - -/DIR="x:\dirname" + Instructs Setup to save installation settings to the specified file. + + Don't forget to use quotes if the filename contains spaces. + +/LANG=language + Specifies the language to use. language specifies the internal name of + the language as specified in a [Languages] section entry. + + When a valid /LANG parameter is used, the Select Language dialog will be + suppressed. + +/DIR="x:\dirname" Overrides the default directory name displayed on the Select Destination Location wizard page. A fully qualified pathname must be specified. - -/GROUP="folder name" - Overrides the default folder name displayed on the Select Start Menu Folder - wizard page. If the [Setup] section directive DisableProgramGroupPage was set to - yes, this command line parameter is ignored. - -/NOICONS - Instructs Setup to initially check the Don't create any icons check box - on the Select Start Menu Folder wizard page. - + +/GROUP="folder name" + Overrides the default folder name displayed on the Select Start Menu + Folder wizard page. If the [Setup] section directive + DisableProgramGroupPage was set to yes, this command line parameter is + ignored. + +/NOICONS + Instructs Setup to initially check the Don't create a Start Menu folder + check box on the Select Start Menu Folder wizard page. + Parameters specific to Firebird installs ---------------------------------------- @@ -140,16 +195,51 @@ Parameters specific to Firebird installs would be required for a full install. +/TASKS="comma separated list of task names" + + Specifies a list of tasks that should be initially selected or + deselected. To deselect a task, prefix its name with a "!" character. + + Choose from - UseGuardianTask + UseApplicationTask + UseServiceTask + AutoStartTask + InstallCPLAppletTask + MenuGroupTask + CopyFbClientToSysTask + CopyFbClientAsGds32Task + + Only the specified tasks (and their children) will be selected; the rest + will be deselected. Use the /MERGETASKS parameter instead if you want to + keep the default set of tasks and only select/deselect some of them. + + By default the following tasks are run: + + UseGuardianTask + UseServiceTask + AutoStartTask + InstallCPLAppletTask + MenuGroupTask + CopyFbClientAsGds32Task + + The /TASKS option is not recommended for use with the /NOCPL, NOGDS32 + or /COPYFBCLIENT. - Make sure that your component list is _only_ separated by commas. +/MERGETASKS="comma separated list of task names" + Like the /TASKS parameter, except the specified tasks will be merged + with the set of tasks that would have otherwise been selected by + default. + + If UsePreviousTasks is set to yes, the specified tasks will be + selected/deselected after any previous tasks are restored. /FORCE Tells the installer to ignore its analysis of the existing - environment. It will attempt to install and configure Firebird 2.0 as + environment. It will attempt to install and configure Firebird 2.1 as if no previous version of Firebird or InterBase was installed. This can be useful if you have a seriously broken installation that @@ -168,12 +258,16 @@ Parameters specific to Firebird installs o You may wish to use an alternative cpl applet. + (This option is not intended to be used with the /TASKS parameter.) + /NOGDS32 Don't install a copy of the client library into the system directory, even if installation analysis concludes it is OK to do so. + (This option is not intended to be used with the /TASKS parameter.) + /COPYFBCLIENT @@ -185,6 +279,7 @@ Parameters specific to Firebird installs doc/README.Win32LibraryInstallation.txt for more information. + (This option is not intended to be used with the /TASKS parameter.) Setup Exit Codes @@ -231,37 +326,83 @@ The Setup program may return one of the following exit codes: Uninstaller Command Line Parameters =================================== -The uninstaller program (unins???.exe) accepts optional command line parameters. -These can be useful to system administrators, and to other programs calling the -uninstaller program. -/SILENT, /VERYSILENT - When specified, the uninstaller will not ask the user for - startup confirmation or display a message stating that uninstall is complete. - Shared files that are no longer in use are deleted automatically without - prompting. Any critical error messages will still be shown on the screen. When - '/VERYSILENT' is specified, the uninstallation progress window is not displayed. - If a restart is necessary and the '/NORESTART' command isn't used (see below) - and '/VERYSILENT' is specified, the uninstaller will reboot without asking. +The uninstaller program (unins???.exe) accepts optional command line +parameters. These can be useful to system administrators, and to other +programs calling the uninstaller program. -/NORESTART - Instructs the uninstaller not to reboot even if it's necessary. +/SILENT, /VERYSILENT + When specified, the uninstaller will not ask the user for startup + confirmation or display a message stating that uninstall is complete. + Shared files that are no longer in use are deleted automatically without + prompting. Any critical error messages will still be shown on the + screen. When '/VERYSILENT' is specified, the uninstallation progress + window is not displayed. + If a restart is necessary and the '/NORESTART' command isn't used (see + below) and '/VERYSILENT' is specified, the uninstaller will reboot + without asking. + +/SUPPRESSMSGBOXES + Instructs the uninstaller to suppress message boxes. Only has an effect + when combined with '/SILENT' and '/VERYSILENT'. See '/SUPPRESSMSGBOXES' + under Setup Command Line Parameters for more details. + +/LOG + Causes Uninstall to create a log file in the user's TEMP directory + detailing file uninstallation and [UninstallRun] actions taken during + the uninstallation process. This can be a helpful debugging aid. + + The log file is created with a unique name based on the current date. + (It will not overwrite or append to existing files.) + + The information contained in the log file is technical in nature and + therefore not intended to be understandable by end users. Nor is it + designed to be machine-parseable; the format of the file is subject to + change without notice. + +/LOG="filename" + Same as /LOG, except it allows you to specify a fixed path/filename to + use for the log file. If a file with the specified name already exists + it will be overwritten. If the file cannot be created, Uninstall will + abort with an error message. + +/NORESTART + Instructs the uninstaller not to reboot even if it's necessary. + + +Parameters specific to Firebird uninstalls +------------------------------------------ + +/CLEAN + + Uninstallation has always left the following files in place after + the uninstallation process hase completed: + + firebird.conf + aliases.conf + firebird.log + security2.fdb + + The assumption is that these files will be useful to users + re-installing or upgrading Firebird. Starting with Firebird 2.1 + (using InnoSetup 5 to build the installation package) it is now + possible to pass the /clean option to remove these files. Uninstaller Exit Codes ---------------------- -Beginning with Inno Setup 4.0.8, the uninstaller will return a non-zero exit -code if the user cancels or a fatal error is encountered. Programs checking the -exit code to detect failure should not check for a specific non-zero value; any -non-zero exit code indicates that the uninstaller was not run to completion. + The uninstaller will return a non-zero exit code if the user cancels or + a fatal error is encountered. Programs checking the exit code to detect + failure should not check for a specific non-zero value; any non-zero + exit code indicates that the uninstaller was not run to completion. -Note that at the moment you get an exit code back from the uninstaller, some -code related to uninstallation might still be running. Because Windows doesn't -allow programs to delete their own EXEs, the uninstaller creates and spawns a -copy of itself in the TEMP directory. This "clone" performs the actual -uninstallation, and at the end, terminates the original uninstaller EXE (at -which point you get an exit code back), deletes it, then displays the "uninstall -complete" message box (if it hasn't been suppressed with /SILENT or -/VERYSILENT). + Note that at the moment you get an exit code back from the uninstaller, + some code related to uninstallation might still be running. Because + Windows doesn't allow programs to delete their own EXEs, the uninstaller + creates and spawns a copy of itself in the TEMP directory. This "clone" + performs the actual uninstallation, and at the end, terminates the + original uninstaller EXE (at which point you get an exit code back), + deletes it, then displays the "uninstall complete" message box (if it + hasn't been suppressed with /SILENT or /VERYSILENT).