Commit 741531a4 authored by Tim Peters's avatar Tim Peters

Move to InnoSetup 5.

InnoSetup 4 CAN NO LONGER BE USED.

Besides that there's no future in relying on obsolete
versions of tools, version 5 introduced a vastly easier
way to manage the custom dialog pages Zope wants.  That
allowed getting rid of about 60 lines of inscrutable
Pascal code.  Of course the code that replaces them is also
inscrutable, but there's about 60 fewer lines of it to
torture future generations ;-).
parent ca7e9317
...@@ -24,10 +24,9 @@ Install Microsoft Visual C++ 7.1 (aka Visual Studio .NET 2003). This is ...@@ -24,10 +24,9 @@ Install Microsoft Visual C++ 7.1 (aka Visual Studio .NET 2003). This is
needed to compile Zope's Python C extensions compatible with Python 2.4 needed to compile Zope's Python C extensions compatible with Python 2.4
(and 2.5, when that's released). (and 2.5, when that's released).
Install InnoSetup 4.2 from www.jrsofware.org (into its default location). Install InnoSetup 5.1.5 (or later) from www.jrsoftware.org, into its
Versions earlier than 4.0.11 are known to not work; any 4.2.x release default location. Inno 4.x (or earlier) cannot work: Inno 5 introduced a
or later should be fine. Inno 5.x versions do *not* work (it appears the vastly simpler way to create the custom dialog pages we want.
Inno "custom dialog" mechanism has changed in an incompatible way)
'svn switch' to, or check out, the Zope tag for which an installer is to be 'svn switch' to, or check out, the Zope tag for which an installer is to be
built. built.
......
...@@ -69,112 +69,108 @@ Root: HKLM; Subkey: "Software\Zope Corporation\Zope\<<VERSION>>"; Flags: uninsde ...@@ -69,112 +69,108 @@ Root: HKLM; Subkey: "Software\Zope Corporation\Zope\<<VERSION>>"; Flags: uninsde
[Code] [Code]
var var
PasswordPrompts, PasswordValues: array of String; { custom dialog pages }
PasswordChars: array of char;
Password: string;
DataDirValues: array of String; { for selecting an instance home directory }
DataDir: String; InstanceDirPage: TInputDirWizardPage;
function InitializeSetup(): Boolean; { for specifying the password for the "admin" account }
AdminPwdPage: TInputQueryWizardPage;
procedure InitializeWizard;
begin begin
{ set up password data structures } { The instance directory page follows the standard "select additional
SetArrayLength(PasswordPrompts, 2); tasks" page. }
PasswordPrompts[0] := 'Password:'; InstanceDirPage := CreateInputDirPage(wpSelectTasks,
PasswordPrompts[1] := 'Confirm password:'; 'Instance Setup',
SetArrayLength(PasswordValues, 2); 'Select where Zope instance files should be installed',
PasswordValues[0] := ''; 'Select the folder to which you would like Setup to install ' +
PasswordValues[1] := ''; 'Zope "instance" files, then click Next.',
SetArrayLength(PasswordChars, 2); False,
PasswordChars[0] := '*'; '');
PasswordChars[1] := '*'; InstanceDirPage.Add('');
Password := '';
{ The admin password page follows our instance directory page. }
{ set up data dir data structures } AdminPwdPage := CreateInputQueryPage(InstanceDirPage.ID,
SetArrayLength(DataDirValues, 1); 'Instance Setup',
DataDir := ''; 'Specify administrator password',
'The login name for your Zope administrator ' +
Result := True; 'account is "admin". When you first connect to the Zope ' +
'management interface, you will need to login using the ' +
'"admin" username and the password you specify below.');
AdminPwdPage.Add('Password:', True);
AdminPwdPage.Add('Confirm password:', True);
{ Set default values; use settings from last time when possible. }
InstanceDirPage.Values[0] := GetPreviousData('InstanceDir',
'C:\Zope-Instance');
AdminPwdPage.Values[0] := '';
AdminPwdPage.Values[1] := '';
end; end;
function CollectInstanceDir(): Boolean; procedure RegisterPreviousData(PreviousDataKey: Integer);
begin
{ Store settings so we can restore them next time. }
{ Note that we deliberately don't store the admin password across
runs! We want that to vanish when the installer finishes. }
SetPreviousData(PreviousDataKey, 'InstanceDir', InstanceDirPage.Values[0]);
end;
function DoInstanceHome(): Boolean;
var var
Next: Boolean; S: String;
DirOk: Boolean;
begin begin
DirOk := True; S := WizardSelectedComponents(False);
ScriptDlgPageSetSubCaption1('Select where Zope instance files should be installed'); Result := Pos('instance', S) <> 0;
ScriptDlgPageSetSubCaption2('Select the folder to which you would like Setup to install Zope "instance" files, then click Next.'); end;
if DataDir = '' then DataDir := 'C:\Zope-Instance';
if DataDirValues[0] <> '' then DataDirValues[0] := '';
{ Ask for a dir until the user has approved one or clicked Back or Cancel }
Next:= InputDir(False, DataDirValues[0], DataDir); function ShouldSkipPage(PageID: Integer): Boolean;
begin
{ Skip pages that shouldn't be shown. }
if (PageID = InstanceDirPage.ID) or (PageID = AdminPwdPage.ID) then
Result := not DoInstanceHome()
else
Result := False;
end;
if Next and FileOrDirExists(DataDir) then DirOk := False; function NextButtonClick(CurPageID: Integer): Boolean;
var
temp: String;
begin
{ Validate pages before allowing the user to proceed. }
Result := True; // innocent until proven guilty
while Next and not DirOk do begin if CurPageID = InstanceDirPage.ID then begin
if DataDir = '' then begin temp := InstanceDirPage.Values[0];
DirOk := False; if temp = '' then begin
Result := False;
MsgBox(SetupMessage(msgInvalidPath), mbError, MB_OK); MsgBox(SetupMessage(msgInvalidPath), mbError, MB_OK);
end; end
if FileOrDirExists(DataDir) then begin else if FileOrDirExists(temp) then begin
DirOk := MsgBox('Directory Exists' #13#13 'The directory ' + Result := MsgBox('Directory Exists' #13#13 'The directory ' +
DataDir + ' already exists. Would you like to create ' + temp + ' already exists. Would you like to create ' +
'instance files in that directory anyway?', 'instance files in that directory anyway?',
mbConfirmation, MB_YESNO) = idYes; mbConfirmation, MB_YESNO) = idYes;
end; end
if not DirOk then Next := InputDir(False, DataDirValues[0], DataDir); end
end; else if CurPageID = AdminPwdPage.ID then begin
temp := AdminPwdPage.Values[0];
Result := Next; if temp = '' then begin
end; Result := False;
MsgBox('You must enter an administrator password',
function CollectPassword(): Boolean; mbError, MB_OK);
var end
Next: Boolean; else if temp <> AdminPwdPage.Values[1] then begin
gotPassword: Boolean; Result := False;
begin
ScriptDlgPageSetSubCaption1('Specify administrator password');
ScriptDlgPageSetSubCaption2('The login name for your Zope administrator ' +
'account is "admin". When you first connect to the Zope management ' +
'interface, you will need to login using the "admin" username and ' +
'the password you specify below.');
gotPassword := False;
repeat
Next := InputQueryArrayEx(PasswordPrompts, PasswordChars, PasswordValues);
if Next then begin
if PasswordValues[0] = '' then
MsgBox('You must enter an administrator password', mbError, MB_OK)
else if PasswordValues[0] <> PasswordValues[1] then
MsgBox('Please try again -- the passwords don''t match', MsgBox('Please try again -- the passwords don''t match',
mbError, MB_OK) mbError, MB_OK)
else begin
gotPassword := True;
Password := PasswordValues[0]
end end
end; end
until gotPassword or not Next;
Result := Next;
end;
function DoInstanceHome(): Boolean;
var
S : String;
begin
S := WizardSelectedComponents(False);
Result := Pos('instance', S) <> 0;
end; end;
function DoService(): Boolean; function DoService(): Boolean;
var var
S : String; S: String;
begin begin
S := WizardSelectedTasks(False); S := WizardSelectedTasks(False);
Result := Pos('service', S) <> 0; Result := Pos('service', S) <> 0;
...@@ -185,59 +181,17 @@ begin ...@@ -185,59 +181,17 @@ begin
Result := not DoService(); Result := not DoService();
end; end;
function ScriptDlgPages(CurPage: Integer; BackClicked: Boolean): Boolean;
var
Next : Boolean;
CurSubPage : Integer;
begin
Next:=True;
if ( (not BackClicked and (CurPage = wpSelectTasks)) or (BackClicked and (CurPage = wpReady)) )
and DoInstanceHome() then begin
if not BackClicked then CurSubPage:=0 else CurSubPage:=1;
ScriptDlgPageOpen();
ScriptDlgPageSetCaption('Instance Setup');
while (CurSubPage >=0) and (CurSubPage <=1) and not Terminated do begin
case CurSubPage of
0: Next := CollectInstanceDir();
1: Next := CollectPassword();
end;
if Next then CurSubPage := CurSubPage +1 else CurSubPage := CurSubPage -1;
end;
if not BackClicked then
Result := Next
else
Result := not Next;
ScriptDlgPageClose(not Result);
end;
Result := Next;
end;
function NextButtonClick(CurPage: Integer): Boolean;
begin
Result := ScriptDlgPages(CurPage, False);
end;
function BackButtonClick(CurPage: Integer): Boolean;
begin
Result := ScriptDlgPages(CurPage, True);
end;
function GetPassword(Default: String): String; function GetPassword(Default: String): String;
begin begin
Result := Password; Result := AdminPwdPage.Values[0];
end; end;
function GetDataDir(Default : String):String; function GetDataDir(Default: String):String;
begin begin
Result := DataDir; Result := InstanceDirPage.Values[0];
end; { GetInstanceDir } end;
function IsAdministrator(): Boolean; function IsAdministrator(): Boolean;
begin begin
Result := IsAdminLoggedOn(); Result := IsAdminLoggedOn();
end; end;
...@@ -39,7 +39,7 @@ TOUCH=touch ...@@ -39,7 +39,7 @@ TOUCH=touch
NMAKE=nmake NMAKE=nmake
CSCRIPT=cscript CSCRIPT=cscript
ECHO=echo ECHO=echo
ISS_DIR=$(CYGROOT)/Progra~1/Inno Setup 4 ISS_DIR=$(CYGROOT)/Progra~1/Inno Setup 5
ISS_COMPILER=$(ISS_DIR)/Compil32.exe ISS_COMPILER=$(ISS_DIR)/Compil32.exe
# We need a version that understands cygwin paths, so /bin/ # We need a version that understands cygwin paths, so /bin/
UNZIP=/bin/unzip UNZIP=/bin/unzip
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment