Quantcast
Channel: Planet Plone - Where Developers And Integrators Write
Viewing all articles
Browse latest Browse all 3535

Karl Johan Kleist: Windows findings, part one: Installation

$
0
0

Trying to fix #10441 (the single remaining blocker for Plone 4.0 rc1)

Everything below applies to the latest available Windows installer for Plone 4.0: http://launchpad.net/plone/4.0/4.0b3/+download/Plone-4.0b3.exe .

NOTE: Since beta 3, several Windows bugs have been fixed. If you want to try the Windows service, you might want to apply these to your beta 3 installation :

  • “console” mode (i.e. foreground without debug) now works (changeset 121480 in collective)
  • make the Windows Local Service start Zope in “console” mode rather than in “fg” mode (changeset 121463 in collective)
  • Windows service installed using incorrect service name (changeset 121449 in collective)
  • the button “View Plone” in the Plone controller renamed to “Create/View Plone site”, clicking it now opens the new fancy Zope root page (changesets 121433 and 121431 in collective)

Installation

Plone-4.0b3.exe is an Inno Setup installer, some notes about how it is put together are available here. (The mentioned “Enfold’s internal build system” is available here.)

I have used the (unofficial) “Inno Setup Unpacker” innounp to reverse engineer its content, which obviously is very similar to that of the unified installer. The most interesting of the extracted files is “install_script.iss”:

;InnoSetupVersion=5.3.6 (Unicode)

[Setup]
AppName=Plone
AppVerName=Plone (version 4.0.0) (build 36062)
DefaultDirName={pf}\Plone
DefaultGroupName=Plone
OutputBaseFilename=Plone-4.0b3
Compression=lzma

[Files]
Source: "{app}\LICENSE.GPL"; DestDir: "{app}"; MinVersion: 4.0,5.0;
Source: "{app}\plone.ico"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\buildout-patch-script.py"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\fixup-scripts.py"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\runner.py"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\README.txt"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\bootstrap.py"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\distribute_setup.py"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\base.cfg"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\buildout.cfg"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\versions.cfg"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\zope_versions.cfg"; DestDir: "{app}"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion
Source: "{app}\buildout-cache\eggs\Acquisition-2.13.3-py2.6-win32.egg\EGG-INFO\not-zip-safe"; DestDir: "{app}\buildout-cache\eggs\Acquisition-2.13.3-py2.6-win32.egg\EGG-INFO"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion

;;; almost seventeen thousand more files in "\buildout-cache\eggs\"

Source: "{app}\python\Lib\site-packages\distribute-0.6.10-py2.6.egg\EGG-INFO\PKG-INFO"; DestDir: "{app}\python\Lib\site-packages\distribute-0.6.10-py2.6.egg\EGG-INFO"; MinVersion: 4.0,5.0; Flags: restartreplace ignoreversion

;;; almost three thousand more files in "\python\Lib\"

[Dirs]
Name: "{app}\products";
Name: "{app}\buildout-cache\downloads";

[Run]
Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: "{code:SafeRunnerPrefix|None} ""{code:DirName|None}\buildout-patch-script.py"" -c ""{code:Dirname|None}\buildout.cfg"" -r ""plone.recipe.zope2instance"" -o ""user"" ""{code:GetUserName|None}:{code:GetPassword|None}"""; WorkingDir: "{app}"; StatusMsg: "Adjusting buildout configuration"; MinVersion: 4.0,5.0;
Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: "{code:SafeRunnerPrefix|None} ""{code:DirName|None}\bootstrap.py"" --distribute_setup-source=distribute_setup.py --version=1.4.3 --eggs=buildout-cache\eggs --download-base=buildout-cache"; WorkingDir: "{app}"; StatusMsg: "Running buildout"; MinVersion: 4.0,5.0;
Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: "{code:SafeRunnerPrefix|None} ""{code:DirName|None}\bin\buildout-script.py"" -q -U -N buildout:install-from-cache=true buildout:download-cache=buildout-cache"; WorkingDir: "{app}"; StatusMsg: "Running buildout"; MinVersion: 4.0,5.0;
Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: "{code:SafeRunnerPrefix|None} ""{code:DirName|None}\bin\cluster-control-script.py"" ""--cfg-file={code:DirName|None}\buildout.cfg"" remove install manual"; WorkingDir: "{app}"; StatusMsg: "Registering services"; MinVersion: 4.0,5.0;
Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: "{code:SafeRunnerPrefix|None} ""{code:DirName|None}\bin\cluster-control-script.py"" ""--cfg-file={code:DirName|None}\buildout.cfg"" remove install auto"; WorkingDir: "{app}"; StatusMsg: "Registering services"; Description: "Start Plone automatically when starting this computer"; MinVersion: 4.0,5.0;
Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: "{code:SafeRunnerPrefix|None} ""{code:DirName|None}\bin\plonectl-script.py"" init"; WorkingDir: "{app}"; StatusMsg: "Creating Plone Site"; MinVersion: 4.0,5.0;
Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: "{code:SafeRunnerPrefix|None} ""{code:DirName|None}\fixup-scripts.py"" ""{code:DirName|None}\bin"" ""{code:DirName|None}\python\Scripts"""; WorkingDir: "{app}"; StatusMsg: "Fixing scripts to point to the right Python executable"; MinVersion: 4.0,5.0;
Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: """{code:DirName|None}\bin\plone-controller-script.py"" ""{code:DirName|None}\buildout.cfg"""; WorkingDir: "{code:DirName|None}"; Description: "Start the Plone Controller"; MinVersion: 4.0,5.0;

[UninstallRun]
Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: "{code:SafeRunnerPrefix|None} ""{code:DirName|None}\bin\cluster-control-script.py"" ""--cfg-file={code:DirName|None}\buildout.cfg"" remove"; WorkingDir: "{app}"; StatusMsg: "Stopping and removing services"; MinVersion: 4.0,5.0;

[Icons]
Name: "{group}\Plone Controller"; Filename: "{code:DirName|None}\python\pythonw.exe"; Parameters: """{code:DirName|None}\bin\plone-controller-script.py"" ""{code:DirName|None}\buildout.cfg"""; WorkingDir: "{code:DirName|None}"; IconFilename: "{code:DirName|None}\plone.ico"; Comment: "Start/Stop Plone Services"; MinVersion: 4.0,5.0;

[Types]
Name: "full"; Description: "Full installation"; MinVersion: 4.0,5.0;

[CustomMessages]
NameAndVersion=%1 version %2
AdditionalIcons=Additional icons:
CreateDesktopIcon=Create a &desktop icon
CreateQuickLaunchIcon=Create a &Quick Launch icon
ProgramOnTheWeb=%1 on the Web
UninstallProgram=Uninstall %1
LaunchProgram=Launch %1
AssocFileExtension=&Associate %1 with the %2 file extension
AssocingFileExtension=Associating %1 with the %2 file extension...

Let’s now study the [Run] section…

The first three lines do something very similar to “install.sh” of the unified installer, the rest is Windows specific.

  • “bin\cluster-control-script.py” just sets sys.path and then calls collective.buildout.cluster.cluster.main() to install the Zope server as a Windows service. The actual service installation is done by collective.buildout.cluster.base.ClusterBase.install() using “win32serviceutil.InstallService()“.ASIDE: Compare the code in Zope2.Startup.zopectl.do_windows()which installs a Windows service when “bin/instance.exe install” is run. Or rather attempts to. This doesn’t seem to work.I don’t understand why this script is called two times… The first call installs a Windows service which is not started automatically when the computer starts. The second call first removes the service, and then installs it again in auto start mode.
  • bin\plonectl-script.py is supposed to create a Plone site (ultimately using mkPloneSite.py, which possibly is deprecated/obsolete). However, this fails (although the log messages claim otherwise).
  • bin\plone-controller-script.py starts the Plone Controller, which will be the subject of the next part. Stay tuned…

ERRATA: Sidnei “dreamcatcher” da Silva has kindly corrected a few details:

You shouldn’t need to unpack the installer to figure out what it does. In fact, it’s misleading because the unpacked iss seems to be missing some key information.

The original source can be found here: http://svn.plone.org/svn/plone/Installers/Windows/trunk/4.0/inno/plone.iss

The script to install the service is *not* called two times. There’s two separate lines in the [Run] section yes, but one of them is only run when the ‘Start Plone automatically when starting this computer’ is checked (or unchecked, can’t remember).

The ‘create a plone site’ part is inherited from the 3.0 installer, and should probably be removed or replaced with something else that works better.


Viewing all articles
Browse latest Browse all 3535

Trending Articles