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
needed to compile Zope's Python C extensions compatible with Python 2.4
(and 2.5, when that's released).
Install InnoSetup 4.2 from www.jrsofware.org (into its default location).
Versions earlier than 4.0.11 are known to not work; any 4.2.x release
or later should be fine. Inno 5.x versions do *not* work (it appears the
Inno "custom dialog" mechanism has changed in an incompatible way)
Install InnoSetup 5.1.5 (or later) from www.jrsoftware.org, into its
default location. Inno 4.x (or earlier) cannot work: Inno 5 introduced a
vastly simpler way to create the custom dialog pages we want.
'svn switch' to, or check out, the Zope tag for which an installer is to be
built.
......
......@@ -69,175 +69,129 @@ Root: HKLM; Subkey: "Software\Zope Corporation\Zope\<<VERSION>>"; Flags: uninsde
[Code]
var
PasswordPrompts, PasswordValues: array of String;
PasswordChars: array of char;
Password: string;
{ custom dialog pages }
DataDirValues: array of String;
DataDir: String;
{ for selecting an instance home directory }
InstanceDirPage: TInputDirWizardPage;
function InitializeSetup(): Boolean;
begin
{ set up password data structures }
SetArrayLength(PasswordPrompts, 2);
PasswordPrompts[0] := 'Password:';
PasswordPrompts[1] := 'Confirm password:';
SetArrayLength(PasswordValues, 2);
PasswordValues[0] := '';
PasswordValues[1] := '';
SetArrayLength(PasswordChars, 2);
PasswordChars[0] := '*';
PasswordChars[1] := '*';
Password := '';
{ set up data dir data structures }
SetArrayLength(DataDirValues, 1);
DataDir := '';
Result := True;
end;
function CollectInstanceDir(): Boolean;
var
Next: Boolean;
DirOk: Boolean;
{ for specifying the password for the "admin" account }
AdminPwdPage: TInputQueryWizardPage;
procedure InitializeWizard;
begin
DirOk := True;
ScriptDlgPageSetSubCaption1('Select where Zope instance files should be installed');
ScriptDlgPageSetSubCaption2('Select the folder to which you would like Setup to install Zope "instance" files, then click Next.');
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);
if Next and FileOrDirExists(DataDir) then DirOk := False;
while Next and not DirOk do begin
if DataDir = '' then begin
DirOk := False;
MsgBox(SetupMessage(msgInvalidPath), mbError, MB_OK);
end;
if FileOrDirExists(DataDir) then begin
DirOk := MsgBox('Directory Exists' #13#13 'The directory ' +
DataDir + ' already exists. Would you like to create ' +
'instance files in that directory anyway?',
mbConfirmation, MB_YESNO) = idYes;
end;
if not DirOk then Next := InputDir(False, DataDirValues[0], DataDir);
end;
Result := Next;
{ The instance directory page follows the standard "select additional
tasks" page. }
InstanceDirPage := CreateInputDirPage(wpSelectTasks,
'Instance Setup',
'Select where Zope instance files should be installed',
'Select the folder to which you would like Setup to install ' +
'Zope "instance" files, then click Next.',
False,
'');
InstanceDirPage.Add('');
{ The admin password page follows our instance directory page. }
AdminPwdPage := CreateInputQueryPage(InstanceDirPage.ID,
'Instance Setup',
'Specify administrator password',
'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.');
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;
function CollectPassword(): Boolean;
var
Next: Boolean;
gotPassword: Boolean;
procedure RegisterPreviousData(PreviousDataKey: Integer);
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',
mbError, MB_OK)
else begin
gotPassword := True;
Password := PasswordValues[0]
end
end;
until gotPassword or not Next;
Result := Next;
{ 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
S : String;
S: String;
begin
S := WizardSelectedComponents(False);
Result := Pos('instance', S) <> 0;
end;
function DoService(): Boolean;
var
S : String;
begin
S := WizardSelectedTasks(False);
Result := Pos('service', S) <> 0;
end;
function DontDoService(): Boolean;
function ShouldSkipPage(PageID: Integer): Boolean;
begin
Result := not DoService();
{ Skip pages that shouldn't be shown. }
if (PageID = InstanceDirPage.ID) or (PageID = AdminPwdPage.ID) then
Result := not DoInstanceHome()
else
Result := False;
end;
function ScriptDlgPages(CurPage: Integer; BackClicked: Boolean): Boolean;
function NextButtonClick(CurPageID: Integer): Boolean;
var
Next : Boolean;
CurSubPage : Integer;
temp: String;
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;
{ Validate pages before allowing the user to proceed. }
Result := True; // innocent until proven guilty
if CurPageID = InstanceDirPage.ID then begin
temp := InstanceDirPage.Values[0];
if temp = '' then begin
Result := False;
MsgBox(SetupMessage(msgInvalidPath), mbError, MB_OK);
end
else if FileOrDirExists(temp) then begin
Result := MsgBox('Directory Exists' #13#13 'The directory ' +
temp + ' already exists. Would you like to create ' +
'instance files in that directory anyway?',
mbConfirmation, MB_YESNO) = idYes;
end
end
else if CurPageID = AdminPwdPage.ID then begin
temp := AdminPwdPage.Values[0];
if temp = '' then begin
Result := False;
MsgBox('You must enter an administrator password',
mbError, MB_OK);
end
else if temp <> AdminPwdPage.Values[1] then begin
Result := False;
MsgBox('Please try again -- the passwords don''t match',
mbError, MB_OK)
end
end
end;
function NextButtonClick(CurPage: Integer): Boolean;
function DoService(): Boolean;
var
S: String;
begin
Result := ScriptDlgPages(CurPage, False);
S := WizardSelectedTasks(False);
Result := Pos('service', S) <> 0;
end;
function BackButtonClick(CurPage: Integer): Boolean;
function DontDoService(): Boolean;
begin
Result := ScriptDlgPages(CurPage, True);
Result := not DoService();
end;
function GetPassword(Default: String): String;
begin
Result := Password;
Result := AdminPwdPage.Values[0];
end;
function GetDataDir(Default : String):String;
function GetDataDir(Default: String):String;
begin
Result := DataDir;
end; { GetInstanceDir }
Result := InstanceDirPage.Values[0];
end;
function IsAdministrator(): Boolean;
begin
Result := IsAdminLoggedOn();
end;
......@@ -39,7 +39,7 @@ TOUCH=touch
NMAKE=nmake
CSCRIPT=cscript
ECHO=echo
ISS_DIR=$(CYGROOT)/Progra~1/Inno Setup 4
ISS_DIR=$(CYGROOT)/Progra~1/Inno Setup 5
ISS_COMPILER=$(ISS_DIR)/Compil32.exe
# We need a version that understands cygwin paths, so /bin/
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