Copyright (c) Hyperion Entertainment and contributors.

Installation Utility

From AmigaOS Documentation Wiki
Revision as of 01:57, 14 June 2013 by Steven Solie (talk | contribs)
Jump to navigation Jump to search
How the installer works
-----------------------

The installer executes a python script that sets up the installation. At the
basic level, there are only a few script commands required. A minimal install
script looks like this:


- BEGIN ------------------------------------------------------------------------
# Simple, basic installation script
from installer import installer

# These will be used for the first page (welcome) and last page (finish)
welcomeText = "This is a welcome text, displayed at the first page"
finishText = "This is the finish message"

# Create the installer
myInstall = installer()

# Set up the installer for a basic default setup. This means
# - A welcome page with the above text	
# - A page to select the installation directory
# - A selection page for the features to install	
# - A progress page that is shown during the installation
# - A "finish" page.

myInstall.Setup(installer.SETUP_DEFAULT)

# Set the welcome and finish texts
myInstall.WelcomeText(welcomeText)
myInstall.FinishText(finishText)

# This adds an installable feature. The name is displayed in the selection list.
# The optional parameter determines whether this can be left out or not (it is
# made mandatory in this case). selected means that the feature is initially
# selected for installation. The description is displayed to the right of the
# feature list when the feature is selected.
# Finally, files is a list of files, directories, or archives that belong to
# this feature, relative to the installation's base directory (i.e. where the 
# install script resides).
myInstall.AddInstallableFeature(
	name = "Basic Installation",
	optional = False,
	selected = True,
	description = "Descriptional text displayed on the right",
	files = ["base.lha"]
)

# this sets the default path to "SYS:". In addition, it also tells the installer
# that the path should not be changed.
myInstall.SetDefaultPath("SYS:", installer.RECOMMENDED)

# Finally, this runs the installation.
myInstall.Run()
- END --------------------------------------------------------------------------

This script is a very basic installer without any additional bells and whistles.
If you need something more complicated that this, then the setup will be a bit
more complicated. The following script results in the same installer as the 
previous one, but it does most of the setup "by hand".

- BEGIN ------------------------------------------------------------------------
# The same installer, just done manually
from installer import installer

# These will be used for the first page (welcome) and last page (finish)
welcomeText = "This is a welcome text, displayed at the first page"
finishText = "This is the finish message"

# Create the installer
myInstall = installer()

# Set up the installer without any pages.

myInstall.Setup(installer.SETUP_EMPTY)

# This adds a welcome text page
myInstall.AddWelcomePage(welcomeText);

# This adds an installation directory page
myInstall.AddDirectoryPage(text = "Please select an installation directory",
	default="SYS:",
	recommendation=installer.RECOMMENDED);

# Add the feature selection page. If you ommit this page, the feature selection
# cannot be changed by the user.
myInstall.AddFeaturePage("Select the features to be installed");

# This adds an installable feature. The name is displayed in the selection list.
# The optional parameter determines whether this can be left out or not (it is
# made mandatory in this case). selected means that the feature is initially
# selected for installation. The description is displayed to the right of the
# feature list when the feature is selected.
# Finally, files is a list of files, directories, or archives that belong to
# this feature, relative to the installation's base directory (i.e. where the 
# install script resides).
myInstall.AddInstallableFeature(
	name = "Basic Installation",
	optional = False,
	selected = True,
	description = "Descriptional text displayed on the right",
	files = ["base.lha"]
)

myInstall.AddFinishPage(finnishText);

# Finally, this runs the installation.
myInstall.Run()
- END --------------------------------------------------------------------------