Subject Re: Running multiple FB installations on customer pc's
Author Maverick Thunder
Hi,

This is an Inno Setup sample file to do multiple FB installations. I create an Firebird
subfolder inside my app's folder, and setup firebird.cnf. It works with FB 2.1.

Best regards,
Mauro H. Leggieri

------------------------------------------------------------------------------------------
--------------------

[Setup]
AppName=Full Firebird Install Sample
AppVerName=Full Firebird Install Sample v1.0
AppVersion=1.0
OutputBaseFilename=FullFirebirdSetup
LicenseFile=Firebird Full Files\IPLicense.txt
DefaultDirName={pf}\Full Firebird Sample
DefaultGroupName=Full Firebird Sample
UninstallDisplayIcon=Full Firebird Sample
Compression=lzma
SolidCompression=yes
DisableProgramGroupPage=yes
DisableReadyMemo=yes
DirExistsWarning=no
PrivilegesRequired=admin
ArchitecturesAllowed=x86

[Languages]
Name: en; MessagesFile: compiler:Default.isl;

[Components]
Name: FirebirdFullComponent; Description: "FirebirdSQL SuperServer Component";
ExtraDiskSpaceRequired: 10485760; Flags: fixed

[Files]
Source: Firebird Full Files\IPLicense.txt; DestDir: {app}\Firebird; Components:
FirebirdFullComponent;
Source: Firebird Full Files\IDPLicense.txt; DestDir: {app}\Firebird; Components:
FirebirdFullComponent;
Source: Firebird Full Files\firebird.conf; DestDir: {app}\Firebird; Components:
FirebirdFullComponent;
Source: Firebird Full Files\security2.fdb; DestDir: {app}\Firebird; Components:
FirebirdFullComponent;
Source: Firebird Full Files\firebird.msg; DestDir: {app}\Firebird; Components:
FirebirdFullComponent;
Source: Firebird Full Files\firebird.log; DestDir: {app}\Firebird; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\gbak.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\gdef.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\gfix.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\gpre.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\gsec.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\gsplit.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\gstat.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\fbclient.dll; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\fbserver.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\ib_util.dll; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\isql.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\nbackup.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\qli.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\icuuc30.dll; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\icuin30.dll; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\icudt30.dll; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\msvcr80.dll; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\msvcp80.dll; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;
Source: Firebird Full Files\bin\Microsoft.VC80.CRT.manifest; DestDir: {app}\Firebird\bin;
Components: FirebirdFullComponent;
Source: Firebird Full Files\bin\instsvc.exe; DestDir: {app}\Firebird\bin; Components:
FirebirdFullComponent;

Source: Firebird Full Files\help\*.*; DestDir: {app}\Firebird\help; Components:
FirebirdFullComponent;

Source: Firebird Full Files\intl\fbintl.dll; DestDir: {app}\Firebird\intl; Components:
FirebirdFullComponent;
Source: Firebird Full Files\intl\fbintl.conf; DestDir: {app}\Firebird\intl; Components:
FirebirdFullComponent;

[Run]
Filename: "{app}\Firebird\bin\instsvc.exe"; Parameters: "i -s -d -n
{code:FirebirdFull_GetInstanceName}"; Components: FirebirdFullComponent;

[UninstallRun]
Filename: "{app}\Firebird\bin\instsvc.exe"; Parameters: "stop -n
{code:FirebirdFull_GetInstanceName}"; Components: FirebirdFullComponent;
Filename: "{app}\Firebird\bin\instsvc.exe"; Parameters: "remove -n
{code:FirebirdFull_GetInstanceName}"; Components: FirebirdFullComponent;

[UninstallDelete]
Type: files; Name: {app}\Firebird\*.lck; Components: FirebirdFullComponent;
Type: files; Name: {app}\Firebird\*.evn; Components: FirebirdFullComponent;
Type: files; Name: {app}\Firebird\*.int; Components: FirebirdFullComponent;
Type: files; Name: {app}\Firebird\*.grd; Components: FirebirdFullComponent;
Type: files; Name: {app}\Firebird\*.mon; Components: FirebirdFullComponent;
Type: dirifempty; Name: {app}\Firebird; Components: FirebirdFullComponent;

[Code]
function FirebirdFull_GetInstanceName(Default: String): String;
begin
Result := 'FB_MyApp';
end;

function FirebirdFull_GetTcpPort(): Integer;
begin
Result := 5070;
end;

function ReplaceLine(Lines: TArrayOfString; StringToFind, NewLine, CommentType: String):
Boolean;
var
I: Integer;
CommentSize: Integer;
ArraySize: Integer;
FileChanged: Boolean;
TempStr: String;
begin
// Load textfile into string array
FileChanged := False;
CommentSize := Length(CommentType);
ArraySize := GetArrayLength(Lines)-1;
// Search through all textlines for given text
for i := 0 to ArraySize do begin
// Overwrite textline when text searched for is part of it
if Pos(StringToFind, Lines[i]) > 0 then begin
// does this line start with a comment ?
if CommentSize > 0 then begin
TempStr := TrimLeft(Lines[i]);
// only replace if line does not start with a comment
if CompareText(Copy(TempStr, 1, CommentSize), CommentType) <> 0 then begin
Lines[i] := NewLine;
FileChanged := True;
end;
end else begin
Lines[i] := NewLine;
FileChanged := True;
end;
end;
end;
Result := FileChanged;
end;

procedure UpdateConfig;
var
Lines: TArrayOfString;
Filename : String;
begin
Filename := ExpandConstant('{app}') + '\Firebird\firebird.conf';
LoadStringsFromFile(Filename, Lines);
ReplaceLine(Lines, 'GuardianOption', 'GuardianOption = 0', '#');
ReplaceLine(Lines, 'RemoteServicePort', 'RemoteServicePort = ' +
IntToStr(FirebirdFull_GetTcpPort()), '#');
SaveStringsToFile(Filename, Lines, False);
end;

procedure InitializeWizard();
var
I : Longint;
begin
for I := 0 to WizardForm.ComponentsList.Items.Count-1 do begin
if CompareText(WizardForm.ComponentsList.ItemCaption[I], 'Firebird Component') = 0
then begin
WizardForm.ComponentsList.Checked[I] := True;
end;
end;
end;

procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then begin
UpdateConfig();
end;
end;

function ShouldSkipPage(const PageID: Integer): Boolean;
begin
Result := False;
//if (PageID = wpSelectComponents) then Result := True;
end;

end.