|
|
|
The package file can be used to specify a number of options to be offered to the user. The installation file performs different actions depending on the selected option, e.g. installs a different set of files.
The process is:
Create a text file with extension .pkg.
Specify the supported languages and the package header. These are discussed in the “How to” topics for a simple installation and for installing a multilingual application.
Specify an options block. The block defines, in a comma separated block, the text identifying each option, and hence the number of options.
For each option, specify the source and target destinations for
the files to be installed. The files are specified in condition blocks between
if optionx and endif condition
statements. There is normally a condition block for every option defined in the
option block.
Specify the source and target destinations for any other files to be installed.
Invoke the Installation File Generator on the package file.
How to create a simple installation file
How to create an installation file for a multilingual application
The project file for an installation in which files may be
conditionally installed is provided in
examples\ToolsAndUtilities\Install\HelloWorldOptions.pkg. A
listing of the file is given below:
#{"Minimal application"},(0x10004299),1,0,0
!({"Install sample document (1Kb)"},
{"Install sample document2 (1Kb)"})
If option1
"sample.txt"-"!:\Documents\sample.txt";
endif
if option2
"sample2.txt"-"!:\Documents\sample2.txt";
endif
"HelloWorld.app"-"!:\system\apps\HelloWorld\HelloWorld.app"
"HelloWorld.rsc"-"!:\system\apps\HelloWorld\HelloWorld.rsc".
The package file installs exactly the same application as described in the “How to” for a simple installation. Consequently the package header, and the final lines in which the application files are installed are the same as for the simple installation.
However the installation also specifies two sample documents, either or both of which the user can choose to install.
The second line defines an option block with two options. The text in these options is displayed to the user at installation time. Note that the size of the file is displayed to the user in parenthesis, so that the user can judge the disk space cost of selecting the option.
The condition blocks control the installation of the sample files, depending on the user’s selection.
To create the installation file HelloWorldOptions.sis,
invoke the Installation File Generator on the package file:
> makesis HelloWorldOptions.pkg
option1 and option2 are global
variables with which can hold one of two values — 0 signifies that the
option is not selected, 1 signifies that the option is selected. If the first
option is selected the value of option1 is 1 and the file
sample.txt is installed. If the value of sample 2 is 0 the
optional file sample2.txt is not installed.
Any option lines should ideally appear towards the start of the
pkg file so that the user is prompted at the start of
installation, however this is not required and the options may be displayed at
any point in the installation.
There are a number of concepts in the file which are explained in the “How To” for a simple installation (e.g. UID, Build number, comments). See this topic for more information.