FireBird 1.5 icin bir script su ana kadar bulamadım.
bende varolandan esinlenerek birazda tırmalayarak FireBird1.5 server kurulumu hazırladım. client kurulumuna hic bakmadım muhtemelen cok daha basit.
oncelikle Pc ye FireBird 1.5 final release kurarak ve InnoSetup+ISTool kurarak ise baslayalım.
Kurulum Win98-WinMe İşletim sisteminde farklı, Nt tabanlı işletim sistemlerinde farklı işlemler yapmakta
İşletim sistemini detekte ederek FbGuard'ı yada FireBird Guardian servisini baslatan/install ve deinstall eden bir exe programımız var.
Bu aslında FireBird 1.0 icin hazırlanmıs ama bazı degisiklikler ile ben 1.5 icin yeniden duzenledim. (Mesela NT tabanlı OS ler uzerinde servis kurma/baslatma /durdurma ve kaldırma islemleri Apiler ile yapılmakta, ama Fb 1.5 ta bir cok sorunlar ıkartmaya basladı, bende Fb1.5 paketindeki service programları instsvc ve instreg ile hallettim. )
Bu projenin kaynak kodunu en assagıda bulabilirsiniz.
InnoSetup scripti:
Kod: Tümünü seç
; Firebird 1.5 installation script(FbSetup.iss)
[Setup]
AppID=Firebird
AppName=Firebird
AdminPrivilegesRequired=true
AllowNoIcons=true
AlwaysShowComponentsList=true
AlwaysShowDirOnReadyPage=true
AlwaysShowGroupOnReadyPage=true
AppVerName=Firebird 1.5 Final Release
AppPublisher=Firebird Team
AppVersion=1.5
AppPublisherURL=http://www.FirebirdSQL.org
AppSupportURL=http://www.FirebirdSQL.org
AppUpdatesURL=http://www.FirebirdSQL.org
AppCopyright=Portions created by Inprise Corporation are Copyright © 2000, Inprise Corporation. Portions created by others are Copyright © 2000-2002, Firebird Project.
BackColor=clWhite
Compression=bzip
CreateAppDir=true
DefaultDirName={pf}\Firebird\Firebird_1_5
DefaultGroupName=Firebird
DirExistsWarning=auto
DisableDirPage=false
DisableStartupPrompt=false
DisableProgramGroupPage=false
FlatComponentsList=true
MinVersion=4.0.950,4.0.1381
OutputDir=D:\Project\Delphi\InnoSetup\FbSetup1.5
OutputBaseFilename=MyFbSetup
ShowComponentSizes=true
SourceDir=D:\Project\Delphi\InnoSetup\Firebird_1_5
UninstallDisplayIcon={app}\bin\ibserver.exe
UninstallLogMode=append
UninstallFilesDir={app}
Uninstallable=true
UsePreviousAppDir=false
UsePreviousGroup=true
UsePreviousSetupType=true
WizardStyle=modern
WindowShowCaption=true
WindowStartMaximized=false
WindowVisible=false
WindowResizable=true
WizardImageFile=D:\Project\Delphi\InnoSetup\FbSetup1.5\FireBirdLogo.bmp
WizardImageBackColor=$808000
WizardSmallImageFile=D:\Project\Delphi\InnoSetup\FbSetup1.5\SmallLogo.bmp
[Types]
Name: full; Description: Full installation
Name: compact; Description: Compact installation
Name: custom; Description: Customized installation; Flags: iscustom
[Components]
[Files]
Source: *.*; DestDir: {app}
Source: security.fdb; DestDir: {app}; DestName: security.fdb; Flags: onlyifdoesntexist
Source: security.fbk; DestDir: {app}; DestName: security.fbk; Flags: onlyifdoesntexist
Source: bin\msvcrt.dll; DestDir: {sys}; Flags: sharedfile uninsneveruninstall onlyifdoesntexist
Source: bin\*.*; DestDir: {app}\bin
Source: ..\FbSetup1.5\FbSvc\FbSvc.exe; DestDir: {app}\bin
Source: intl\*.*; DestDir: {app}\intl
Source: UDF\*.*; DestDir: {app}\UDF
Source: gds32.dll\GDS32.DLL; DestDir: {sys}; Flags: confirmoverwrite overwritereadonly sharedfile restartreplace comparetimestamp
Source: bin\msvcp60.dll; DestDir: {sys}; Flags: sharedfile restartreplace
[Icons]
Name: {group}\Readme; Filename: {app}\Readme.txt; WorkingDir: {app}
[Registry]
Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Services\FirebirdGuardian; ValueType: string; ValueName: Description; ValueData: Firebird Guardian
Root: HKLM; Subkey: SYSTEM\CurrentControlSet\Services\FirebirdServer; ValueType: string; ValueName: Description; ValueData: Firebird Database Server
[Run]
Filename: {app}\bin\instreg.exe; Parameters: "i "; WorkingDir: {app}\bin; Flags: runminimized
FileName: {app}\bin\FbSvc.exe; Parameters: /install_guardian; WorkingDir: {app}\bin; Flags: runminimized
[UninstallRun]
FileName: {app}\bin\FbSvc.exe; Parameters: /deinstall_guardian; WorkingDir: {app}\bin; Flags: runminimized
FileName: {app}\bin\FbSvc.exe; Parameters: /stop_server; WorkingDir: {app}\bin; Flags: runminimized
Filename: {app}\bin\instreg.exe; Parameters: r; WorkingDir: {app}\bin; Flags: runminimized
[Languages]
Name: default; MessagesFile: compiler:Default.isl
[_ISTool]
Use7zip=false
[UninstallDelete]
Name: {app}; Type: filesandordirs
- Burada benim kaynak dizinim (Firebird dosyalarının bulundugu)
D:\Project\Delphi\InnoSetup\FbSetup1.5\
scripti derlerken bu dizini Firebird kurdugunuz yerle degistirin
- Source: ..\FbSetup1.5\FbSvc\FbSvc.exe; DestDir: {app}\bin
FbSvc.exe yi olusturup bir yere koyun ve yolunu degistrin
- Source: gds32.dll\GDS32.DLL; DestDir: {sys};
Normalde Gds32.dll <WindowsSystem> icinde olmalı
dosya yolunu guncellemeniz gerekmekte
FbSvc.dpr
Kod: Tümünü seç
program FbSvc;
uses
Forms, Registry, Windows, Messages, Dialogs, WinSvc, SysUtils;
{$R *.RES}
function GetPath: string;
var
regFirebird: TRegistry;
begin
Result := '';
regFirebird := TRegistry.Create;
try
regFirebird.RootKey := HKEY_LOCAL_MACHINE;
if
(regFirebird.OpenKeyReadOnly('Software\Firebird Project\Firebird Server\Instances')
= True) then
Result := Trim(regFirebird.ReadString('DefaultInstance'));
finally
regFirebird.CloseKey;
regFirebird.Free;
end;
end;
function IsNT: Boolean;
var
OSVersion: TOSVersionInfo;
begin
Result := False;
OSVersion.dwOSVersionInfoSize := SizeOf(OSVersion);
if (GetVersionEx(OSVersion)) then
begin
case OSVersion.dwPlatformID of
VER_PLATFORM_WIN32_NT:
Result := True;
else
Result := False;
end;
end;
end;
function StopServer: Boolean;
var
lHWND: HWND;
sFirebirdPath, sExecName: string;
lArray: array[0..255] of Char;
begin
Result := False;
if (IsNT = True) then
begin
sFirebirdPath := GetPath;
if (sFirebirdPath <> '') then
begin
sExecName := Format('%s%s', [sFirebirdPath, 'bin\instsvc.exe stop']);
if (WinExec(StrPCopy(lArray, sExecName), 2) > 31) then
Result := True;
end;
end
else
begin
lHWND := FindWindow('FB_Server', 'Firebird Server');
if (PostMessage(lHWND, WM_CLOSE, 0, 0) <> Null) then
Result := True;
Application.ProcessMessages;
end;
end;
function InstallAndStartGuardian: Boolean;
var
sFirebirdPath, sExecName: string;
lArray: array[0..255] of Char;
bResultInstall, bResultStart: Boolean;
begin
Result := False;
if (IsNT = True) then
begin
sFirebirdPath := GetPath;
if (sFirebirdPath <> '') then
begin
//service install
sExecName := Format('%s%s', [sFirebirdPath,
'bin\instsvc.exe i -s -g -a']);
if (WinExec(StrPCopy(lArray, sExecName), 2) > 31) then
Result := True;
end;
end
else
begin
bResultInstall := False;
bResultStart := False;
sFirebirdPath := GetPath;
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if (OpenKey('Software\Microsoft\Windows\CurrentVersion\Run', False) = True)
then
begin
WriteString('Firebird Guardian', sFirebirdPath + 'bin\fbguard.exe -a');
bResultInstall := True;
end;
finally
CloseKey;
Free;
end;
if (sFirebirdPath <> '') then
begin
sExecName := Format('%s%s', [sFirebirdPath, 'bin\fbguard.exe']);
if (WinExec(StrPCopy(lArray, sExecName), 2) > 31) then
bResultStart := True;
end;
if ((bResultInstall = True) and (bResultStart = True)) then
Result := True;
end;
end;
function StopAndDeinstallGuardian: Boolean;
var
lHWND: HWND;
sFirebirdPath, sExecName: string;
lArray: array[0..255] of Char;
bResultDeInstall, bResultStop: Boolean;
begin
Result := False;
if (IsNT = True) then
begin
sFirebirdPath := GetPath;
if (sFirebirdPath <> '') then
begin
//service stop and uninstall
sExecName := Format('%s%s', [sFirebirdPath, 'bin\instsvc.exe stop']);
if (WinExec(StrPCopy(lArray, sExecName), 2) > 31) then
begin
sExecName := Format('%s%s', [sFirebirdPath, 'bin\instsvc.exe r']);
if (WinExec(StrPCopy(lArray, sExecName), 2) > 31) then
Result := True;
end;
end;
end
else
begin
bResultStop := False;
bResultDeinstall := False;
lHWND := FindWindow('FB_Server', 'Firebird Server');
if (PostMessage(lHWND, WM_CLOSE, 0, 0) <> Null) then
bResultStop := True;
Application.ProcessMessages;
with TRegistry.Create do
try
RootKey := HKEY_LOCAL_MACHINE;
if (OpenKey('Software\Microsoft\Windows\CurrentVersion\Run', False) = True)
then
bResultDeinstall := DeleteValue('Firebird Guardian');
finally
CloseKey;
Free;
end;
if ((bResultStop = True) and (bResultDeinstall = True)) then
Result := True;
end;
end;
var
I: Byte;
begin
for I := 1 to ParamCount do
begin
if (UpperCase(ParamStr(I)) = '/INSTALL_GUARDIAN') then
InstallAndStartGuardian;
if (UpperCase(ParamStr(I)) = '/DEINSTALL_GUARDIAN') then
StopAndDeinstallGuardian;
if (UpperCase(ParamStr(I)) = '/STOP_SERVER') then
StopServer;
end;
Application.Initialize;
end.
unuttugum bir seyler vs. varsa duzelteyim
Hepinize kolay gelsin, Fayırbördcüler...