Installer - Mailing list pgsql-hackers-win32

From Martin Kanich
Subject Installer
Date
Msg-id cai80e$a98$1@sea.gmane.org
Whole thread Raw
List pgsql-hackers-win32
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
; 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
postinstallskipifsilent; 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;


pgsql-hackers-win32 by date:

Previous
From: Martin Kanich
Date:
Subject: Re: backslash in psql win32
Next
From: Andrew Dunstan
Date:
Subject: pg_ctl vs. Windows locking