88; for the specific language governing rights and limitations under the
99; License.
1010;
11- ; The Original Code is copyright 2001-2021 Paul Reeves for IBPhoenix.
11+ ; The Original Code is copyright 2001-2024 Paul Reeves for IBPhoenix.
1212;
1313; The Initial Developer of the Original Code is Paul Reeves for IBPhoenix.
1414;
232232#define ConfigurationTarget " release"
233233#endif
234234
235- #if FB_BUILD_TYPE == " T"
236- ;If we are still under development we can ignore some missing files.
237- #define SkipFileIfDevStatus " skipifsourcedoesntexist "
238- #else
239- #define SkipFileIfDevStatus " "
240- #endif
241-
242235;This location is relative to SourceDir (declared below)
243236#define FilesDir= " output_" + PlatformTarget + " _" + ConfigurationTarget
244237#if PlatformTarget == " x64"
@@ -488,8 +481,8 @@ Source: {#FilesDir}\fbtrace.conf; DestDir: {app}; DestName: fbtrace.conf; Compon
488481Source : {#FilesDir}\databases.conf; DestDir : {app} ; Components : ClientComponent; Flags : uninsneveruninstall onlyifdoesntexist
489482Source : {#FilesDir}\replication.conf; DestDir : {app} ; DestName : replication.conf.default; Components : ServerComponent;
490483Source : {#FilesDir}\replication.conf; DestDir : {app} ; Components : ServerComponent; Flags : uninsneveruninstall onlyifdoesntexist ; check : NoReplicationConfExists;
491- Source : {#FilesDir}\security6 .fdb; DestDir : {app} ; Destname : security6 .fdb.empty; Components : ServerComponent;
492- Source : {#FilesDir}\security6 .fdb; DestDir : {app} ; Components : ServerComponent; Flags : uninsneveruninstall onlyifdoesntexist
484+ Source : {#FilesDir}\security{#FB_MAJOR_VER} .fdb; DestDir : {app} ; Destname : security{#FB_MAJOR_VER} .fdb.empty; Components : ServerComponent;
485+ Source : {#FilesDir}\security{#FB_MAJOR_VER} .fdb; DestDir : {app} ; Components : ServerComponent; Check : ConfigureAuthentication ; Flags : uninsneveruninstall onlyifdoesntexist
493486Source : {#FilesDir}\firebird.msg; DestDir : {app} ; Components : ClientComponent; Flags : sharedfile ignoreversion
494487Source : {#FilesDir}\firebird.log; DestDir : {app} ; Components : ServerComponent; Flags : uninsneveruninstall skipifsourcedoesntexist external dontcopy
495488
@@ -512,18 +505,18 @@ Source: {#FilesDir}\fbsvcmgr.exe; DestDir: {app}; Components: DevAdminComponent;
512505Source : {#FilesDir}\fbtracemgr.exe; DestDir : {app} ; Components : DevAdminComponent; Flags : ignoreversion
513506Source : {#FilesDir}\fbclient.dll; DestDir : {app} ; Components : ClientComponent; Flags : overwritereadonly sharedfile promptifolder
514507#if PlatformTarget == " x64"
515- Source : {#WOW64Dir}\fbclient.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : overwritereadonly sharedfile promptifolder {#SkipFileIfDevStatus}
516- Source : {#WOW64Dir}\instclient.exe; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion {#SkipFileIfDevStatus}
508+ Source : {#WOW64Dir}\fbclient.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : overwritereadonly sharedfile promptifolder
509+ Source : {#WOW64Dir}\instclient.exe; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion
517510#endif
518511Source : {#FilesDir}\icuuc??.dll; DestDir : {app} ; Components : ClientComponent; Flags : sharedfile ignoreversion
519512Source : {#FilesDir}\icuin??.dll; DestDir : {app} ; Components : ClientComponent; Flags : sharedfile ignoreversion
520513Source : {#FilesDir}\icudt??.dll; DestDir : {app} ; Components : ClientComponent; Flags : sharedfile ignoreversion
521514Source : {#FilesDir}\icudt*.dat; DestDir : {app} ; Components : ClientComponent; Flags : sharedfile ignoreversion
522515#if PlatformTarget == " x64"
523- Source : {#WOW64Dir}\icuuc??.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion {#SkipFileIfDevStatus}
524- Source : {#WOW64Dir}\icuin??.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion {#SkipFileIfDevStatus}
525- Source : {#WOW64Dir}\icudt??.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion {#SkipFileIfDevStatus}
526- Source : {#WOW64Dir}\icudt*.dat; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion {#SkipFileIfDevStatus}
516+ Source : {#WOW64Dir}\icuuc??.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion
517+ Source : {#WOW64Dir}\icuin??.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion
518+ Source : {#WOW64Dir}\icudt??.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion
519+ Source : {#WOW64Dir}\icudt*.dat; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion
527520#endif
528521
529522#if PlatformTarget == " Win32"
@@ -532,7 +525,7 @@ Source: {#FilesDir}\fbrmclib.dll; DestDir: {app}; Components: ServerComponent; F
532525
533526Source : {#FilesDir}\zlib1.dll; DestDir : {app} ; Components : ClientComponent; Flags : sharedfile ignoreversion
534527#if PlatformTarget == " x64"
535- Source : {#WOW64Dir}\zlib1.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion {#SkipFileIfDevStatus}
528+ Source : {#WOW64Dir}\zlib1.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ignoreversion
536529#endif
537530
538531;Rules for installation of MS runtimes are simplified with MSVC10
@@ -543,19 +536,19 @@ Source: {#FilesDir}\{#msvcr_filename}{#msvc_runtime_file_version}.dll; DestDir:
543536Source : {#FilesDir}\msvcp{#msvc_runtime_file_version}.dll; DestDir : {app} ; Components : ClientComponent; Flags : sharedfile ;
544537#if PlatformTarget == " x64"
545538;If we are installing on x64 we need some 32-bit libraries for compatibility with 32-bit applications
546- Source : {#WOW64Dir}\{#msvcr_filename}{#msvc_runtime_file_version}.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile {#SkipFileIfDevStatus} ;
547- Source : {#WOW64Dir}\msvcp{#msvc_runtime_file_version}.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile {#SkipFileIfDevStatus} ;
539+ Source : {#WOW64Dir}\{#msvcr_filename}{#msvc_runtime_file_version}.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ;
540+ Source : {#WOW64Dir}\msvcp{#msvc_runtime_file_version}.dll; DestDir : {app} \WOW64; Components : ClientComponent; Flags : sharedfile ;
548541#endif
549542#endif /* #if Int(msvc_runtime_major_version,14 ) >= 10 */
550543
551544#if msvc_runtime_major_version = 14
552545#if PlatformTarget == " x64"
553546;MinVersion 0,5.0 means no version of Win9x and at least Win2k if NT O/S
554547;In addition, O/S must have Windows Installer 3.0.
555- Source : {#FilesDir}\system32\vccrt{#msvc_runtime_library_version}_x64.msi; DestDir : {tmp} ; Check : HasWI30; MinVersion: {#MinVer}; Components : ClientComponent; Flags : {#SkipFileIfDevStatus}
556- Source : {#WOW64Dir}\system32\vccrt{#msvc_runtime_library_version}_Win32.msi; DestDir : {tmp} ; Check : HasWI30; MinVersion: {#MinVer}; Components : ClientComponent; Flags : {#SkipFileIfDevStatus}
548+ Source : {#FilesDir}\system32\vccrt{#msvc_runtime_library_version}_x64.msi; DestDir : {tmp} ; Check : HasWI30; MinVersion: {#MinVer}; Components : ClientComponent;
549+ Source : {#WOW64Dir}\system32\vccrt{#msvc_runtime_library_version}_Win32.msi; DestDir : {tmp} ; Check : HasWI30; MinVersion: {#MinVer}; Components : ClientComponent;
557550#else
558- Source : {#FilesDir}\system32\vccrt{#msvc_runtime_library_version}_Win32.msi; DestDir : {tmp} ; Check : HasWI30; MinVersion: {#MinVer}; Components : ClientComponent; Flags : {#SkipFileIfDevStatus}
551+ Source : {#FilesDir}\system32\vccrt{#msvc_runtime_library_version}_Win32.msi; DestDir : {tmp} ; Check : HasWI30; MinVersion: {#MinVer}; Components : ClientComponent;
559552#endif
560553#endif
561554
@@ -571,7 +564,7 @@ Source: {#FilesDir}\intl\fbintl.dll; DestDir: {app}\intl; Components: ServerComp
571564Source : {#FilesDir}\intl\fbintl.conf; DestDir : {app} \intl; Components : ServerComponent; Flags : onlyifdoesntexist
572565Source : {#FilesDir}\lib\*.lib; DestDir : {app} \lib; Components : DevAdminComponent; Flags : ignoreversion ;
573566#if PlatformTarget == " x64"
574- Source : {#WOW64Dir}\lib\*.lib; DestDir : {app} \WOW64\lib; Components : DevAdminComponent; Flags : ignoreversion {#SkipFileIfDevStatus}
567+ Source : {#WOW64Dir}\lib\*.lib; DestDir : {app} \WOW64\lib; Components : DevAdminComponent; Flags : ignoreversion
575568#endif
576569
577570;deprecated in FB4.0
@@ -586,18 +579,17 @@ Source: {#FilesDir}\plugins\chacha.dll; DestDir: {app}\plugins; Components: Clie
586579Source : {#FilesDir}\plugins\*.conf; DestDir : {app} \plugins; Components : ServerComponent; Flags : ignoreversion ;
587580Source : {#FilesDir}\plugins\udr\*.*; DestDir : {app} \plugins\udr; Components : ServerComponent; Flags : ignoreversion ;
588581#if PlatformTarget == " x64"
589- Source : {#WOW64Dir}\plugins\chacha*.dll; DestDir : {app} \WOW64\plugins; Components : ClientComponent; Flags : ignoreversion {#SkipFileIfDevStatus} ;
582+ Source : {#WOW64Dir}\plugins\chacha*.dll; DestDir : {app} \WOW64\plugins; Components : ClientComponent; Flags : ignoreversion ;
590583#endif
591584
592585Source : {#FilesDir}\misc\*.*; DestDir : {app} \misc; Components : ServerComponent; Flags : ignoreversion createallsubdirs recursesubdirs ;
593586
594587Source : {#FilesDir}\tzdata\*.*; DestDir : {app} \tzdata; Components : ClientComponent; Flags : ignoreversion ;
595588
596- ;Source: {#FilesDir}\system32\Firebird2Control.cpl; DestDir: {sys}; Components: ServerComponent; MinVersion: {#MinVer}; Flags: sharedfile ignoreversion promptifolder restartreplace uninsrestartdelete; Check: InstallCPLApplet
597589#endif /* files */
598590
599591#ifdef examples
600- Source : {#FilesDir}\examples\*.*; DestDir : {app} \examples; Components : DevAdminComponent; Flags : ignoreversion createallsubdirs recursesubdirs {#SkipFileIfDevStatus} ;
592+ Source : {#FilesDir}\examples\*.*; DestDir : {app} \examples; Components : DevAdminComponent; Flags : ignoreversion createallsubdirs recursesubdirs ;
601593#endif
602594
603595#ifdef ship_pdb
@@ -608,7 +600,7 @@ Source: {#FilesDir}\gfix.pdb; DestDir: {app}; Components: DevAdminComponent;
608600Source : {#FilesDir}\isql.pdb; DestDir : {app} ; Components : ClientComponent;
609601Source : {#FilesDir}\plugins\*.pdb; DestDir : {app} \plugins; Components : ServerComponent;
610602#if PlatformTarget == " x64"
611- Source : {#WOW64Dir}\fbclient.pdb; DestDir : {app} \WOW64; Components : ClientComponent; Flags : {#SkipFileIfDevStatus};
603+ Source : {#WOW64Dir}\fbclient.pdb; DestDir : {app} \WOW64; Components : ClientComponent;
612604#endif
613605#endif
614606
@@ -638,10 +630,14 @@ program Setup;
638630// Some global variables are also in FirebirdInstallEnvironmentChecks.inc
639631// This is not ideal, but then this scripting environment is not ideal, either.
640632// The basic point of the include files is to isolate chunks of code that are
641- // a) Form a module or have common functionality
633+ // a) From a module or have common functionality
642634// b) Debugged.
643635// This hopefully keeps the main script simpler to follow.
644636
637+
638+ const
639+ UNDEFINED = -1 ;
640+
645641Var
646642 InstallRootDir: String;
647643 FirebirdConfSaved: String;
657653
658654 SYSDBAPassword: String; // SYSDBA password
659655
656+ init_secdb: integer; // Is set to UNDEFINED by default in InitializeSetup
657+
660658#ifdef setuplogging
661659// Not yet implemented - leave log in %TEMP%
662660// OkToCopyLog : Boolean; // Set when installation is complete.
@@ -739,7 +737,7 @@ begin
739737 exit;
740738 end ;
741739
742- // By default we want to install and confugure ,
740+ // By default we want to install and configure ,
743741 // unless subsequent analysis suggests otherwise.
744742 InstallAndConfigure := Install + Configure;
745743
@@ -748,6 +746,7 @@ begin
748746 InitExistingInstallRecords;
749747 AnalyzeEnvironment;
750748 result := AnalysisAssessment;
749+ init_secdb := UNDEFINED;
751750
752751end ;
753752
@@ -883,19 +882,34 @@ var
883882 TempDir: String;
884883 ResultCode: Integer;
885884 CmdStr: string;
885+ InputStr: string;
886+ OutputStr: string;
886887begin
887888 TempDir := ExpandConstant( ' {tmp}' );
888889 CmdStr := ExpandConstant( ' {app}\isql.exe' );
890+ InputStr := TempDir + ' \' + ' temp.sql' ;
891+ OutputStr := InputStr + ' .txt' ;
892+
893+ // Ensure these files do not already exist.
894+ if FileExists( InputStr ) then DeleteFile( InputStr );
895+ if FileExists( OutputStr ) then DeleteFile( OutputStr );
896+
889897 AStringList := TStringList.create;
890898 with AStringList do begin
891- Add( ' create user ' + GetAdminUserName + ' password '' ' + GetAdminUserPassword + ' '' using plugin Srp;' );
892- Add( ' commit;' ); // Technically exit implies a commit so this not necessary. OTOH, explicitly committing makes for more readable code.
899+ Add( ' create or alter user ' + GetAdminUserName + ' password '' ' + GetAdminUserPassword + ' '' using plugin Srp;' );
893900 Add( ' exit;' );
894- SaveToFile( Tempdir + ' \temp.sql ' );
901+ SaveToFile( InputStr );
895902 end ;
896- Result := Exec( CmdStr , ' -m -m2 -user SYSDBA -i ' + TempDir + ' \temp.sql -o ' + TempDir + ' \temp.sql.txt employee ' , TempDir, SW_HIDE, ewWaitUntilTerminated, ResultCode );
897- DeleteFile( TempDir + ' \temp.sql' );
898- DeleteFile( TempDir + ' \temp.sql.txt' );
903+ Result := Exec( CmdStr , ' -m -m2 -user SYSDBA -i ' + InputStr + ' -o ' + OutputStr + ' employee ' , TempDir, SW_HIDE, ewWaitUntilTerminated, ResultCode );
904+ if ResultCode <> 0 then begin
905+ Result := False;
906+ Log( ' In function InitSecurityDB Exec isql returned ' + IntToStr(ResultCode) + ' executing ' + InputStr );
907+ end ;
908+ if FindInFile( OutputStr, ' error' ) then begin
909+ Result := False;
910+ Log( ' In function InitSecurityDB FindInFile found an error in ' + OutputStr );
911+ end ;
912+
899913end ;
900914
901915
@@ -1056,10 +1070,11 @@ begin
10561070 IncrementSharedCount(Is64BitInstallMode, GetAppPath+' \firebird.log' , false);
10571071 IncrementSharedCount(Is64BitInstallMode, GetAppPath+' \databases.conf' , false);
10581072 IncrementSharedCount(Is64BitInstallMode, GetAppPath+' \fbtrace.conf' , false);
1059- IncrementSharedCount(Is64BitInstallMode, GetAppPath+' \security6 .fdb' , false);
1073+ IncrementSharedCount(Is64BitInstallMode, GetAppPath+' \security{#FB_MAJOR_VER} .fdb' , false);
10601074 IncrementSharedCount(Is64BitInstallMode, GetAppPath+' \replication.conf' , false);
10611075
1062- InitSecurityDB;
1076+ if init_secdb = 1 then
1077+ InitSecurityDB;
10631078
10641079 // Fix up conf file
10651080 UpdateFirebirdConf;
@@ -1182,8 +1197,8 @@ begin
11821197 aStringList.add(appPath+' \firebird.log' );
11831198 aStringList.add(appPath+' \databases.conf' );
11841199 aStringList.add(appPath+' \fbtrace.conf' );
1185- aStringList.add(appPath+' \security6 .fdb' );
1186- aStringList.add(appPath+' \security6 .fdb.old' );
1200+ aStringList.add(appPath+' \security{#FB_MAJOR_VER} .fdb' );
1201+ aStringList.add(appPath+' \security{#FB_MAJOR_VER} .fdb.old' );
11871202 aStringList.add(appPath+' \replication.conf' );
11881203
11891204 for count := 0 to aStringList.count - 1 do begin
@@ -1247,4 +1262,3 @@ end;
12471262begin
12481263end .
12491264
1250- ; kate: replace-tabs on; indent-width 2 ; tab-width 2 ; replace-tabs-save on; syntax Pascal;
0 commit comments