Installer

Martin Kanich <[email protected]>
Newsgroups gmane.comp.db.postgresql.devel.win32
Message-ID <[email protected]>
Hi,

I thought I could speed up the installation, so I have written small 
install script using InnoSetup. I know that it's not so powerfull, but 
for now it could be good enough. I just post it here as attachment.
All you need is to build&install postgres using msys&mingw. Copy this 
file and COPYRIGHT in /local/pgsql and start it.

InnoSetup could be found under http://www.jrsoftware.org/isinfo.php

Regards,
Martin


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to [email protected])
PostgreSQL_7_5_for_Windows.iss (text/plain, 5 KB)
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
AppName=PostgreSQL 7.5 for Windows
AppVerName=PostgreSQL 7.5 for Windows
AppPublisher=PostgreSQL.org
AppPublisherURL=http://www.postgresql.org
AppSupportURL=http://www.postgresql.org
AppUpdatesURL=http://www.postgresql.org
DefaultDirName={pf}\pgsql
DefaultGroupName=PostgreSQL 7.5 for Windows
AllowNoIcons=yes
LicenseFile=COPYRIGHT
Compression=lzma
SolidCompression=yes
OutputBaseFilename=PostgreSQL_7_5

[Tasks]
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked

[Files]
;Source: bin\postmaster.exe; DestDir: {app}\bin; Flags: ignoreversion; Components: Binaries
Source: bin\*; DestDir: {app}\bin; Flags: ignoreversion; Components: Binaries
Source: lib\*; DestDir: {app}\lib; Flags: ignoreversion; Components: Binaries
Source: share\*; DestDir: {app}\share; Flags: ignoreversion recursesubdirs; Components: Binaries
Source: doc\*; DestDir: {app}\doc; Flags: ignoreversion recursesubdirs; Components: Docs
Source: include\*; DestDir: {app}\include; Flags: ignoreversion recursesubdirs; Components: Includes
Source: man\*; DestDir: {app}\man; Flags: ignoreversion recursesubdirs; Components: Mans
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Dirs]
Name: {code:GetDataDir}; Flags: uninsneveruninstall; Check: CheckDataDir

[INI]
Filename: {app}\postmaster.url; Section: InternetShortcut; Key: URL; String: http://www.postgresql.org

[Icons]
Name: {group}\PostgreSQL 7.5 for Windows; Filename: {app}\bin\postmaster.exe; Parameters: {code:GetParams}
Name: {group}\{cm:ProgramOnTheWeb,PostgreSQL 7.5 for Windows}; Filename: {app}\postmaster.url
Name: {group}\{cm:UninstallProgram,PostgreSQL 7.5 for Windows}; Filename: {uninstallexe}
Name: {userdesktop}\PostgreSQL 7.5 for Windows; Filename: {app}\bin\postmaster.exe; Tasks: desktopicon; Parameters: {code:GetParams}
Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\PostgreSQL 7.5 for Windows; Filename: {app}\bin\postmaster.exe; Tasks: quicklaunchicon; Parameters: {code:GetParams}

[Run]
Filename: {app}\bin\initdb.exe; Parameters: "-L ""{app}\share"" -D ""{code:GetDataDir}"""; Description: Creating Data; Components: Data
Filename: {app}\bin\postmaster.exe; Description: {cm:LaunchProgram,PostgreSQL 7.5 for Windows}; Flags: nowait postinstall skipifsilent; Parameters: {code:GetParams}

[UninstallDelete]
Type: files; Name: {app}\postmaster.url

[Types]
Name: Basic; Description: Only necessery files
Name: Full; Description: Everything
Name: Custom; Description: Custom; Flags: iscustom

[Components]
Name: Binaries; Description: bin, lib & share files; Flags: fixed; Types: Full Basic Custom
Name: Data; Description: Data files creation; Types: Full Basic Custom
Name: Docs; Description: Documentation; Types: Full Custom
Name: Includes; Description: Include files; Types: Full
Name: Mans; Description: Man pages; Types: Full

[_ISTool]
UseAbsolutePaths=false

[Code]
var
  DataDir: String;

function ScriptDlgPages(CurPage: Integer; BackClicked: Boolean): Boolean;
var
  Next: Boolean;
begin
  if ((not BackClicked and (CurPage = wpSelectComponents)) or (BackClicked and (CurPage = wpReady))) and (Pos('Data', WizardSelectedComponents(true)) > 0) then begin
    { Insert a custom wizard page between two non custom pages }
    { First open the custom wizard page }
    ScriptDlgPageOpen();
    { Set some captions }
    ScriptDlgPageSetCaption('Select Data Directory');
    ScriptDlgPageSetSubCaption1('Where should data files be installed?');
    ScriptDlgPageSetSubCaption2('Select the folder you would like Setup to install data files to, then click Next.');
    { Initialize the DataDir if necessary }
    if DataDir = '' then
      DataDir := ExpandConstant('{app}') + '\data';
    { Ask for a dir until the user has entered one or click Back or Cancel }
    Next := InputDir(False, DataDir, DataDir);
    while Next and (DataDir = '') do begin
      MsgBox(SetupMessage(msgInvalidPath), mbError, MB_OK);
      Next := InputDir(False, DataDir, DataDir);
    end;
    { See NextButtonClick and BackButtonClick: return True if the click should be allowed }
    if not BackClicked then
      Result := Next
    else
      Result := not Next;
    { Close the wizard page. Do a FullRestore only if the click (see above) is not allowed }
    ScriptDlgPageClose(not Result);
  end else begin
    Result := True;
  end;
end;

function NextButtonClick(CurPage: Integer): Boolean;
begin
  Result := ScriptDlgPages(CurPage, False);
end;

function BackButtonClick(CurPage: Integer): Boolean;
begin
  Result := ScriptDlgPages(CurPage, True);
end;

function GetDataDir(S: String): String;
begin
  { Return the selected DataDir }
  Result := DataDir;
end;

function CheckDataDir: Boolean;
begin
  Result := Pos('Data', WizardSelectedComponents(true)) > 0;
end;

function GetParams(S: string): String;
begin
  Result := '-D "' + DataDir + '"';
end;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.