Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

This is a crucial section as it is used to specify the files that need to be installed. The <packs> section consists of several <pack>, <refpack> and <refpackset> tags.

Defining a <pack>

The <pack> takes the following attributes :

Attribute

Usage

name

defines the pack name

required

takes yes or no and specifies whether the pack must be installed (yes) or is optional (no)

os

optional. Lets you make the pack targeted to a specific operating system, for instance unix, mac and so on

preselected

optional. Lets you choose whether the pack is selected for installation by default or not. Possible values are yes and no. A pack which is not preselected needs to be explicitly selected by the user during installation to get installed

loose

can be used so that the files are not located in the installer Jar. The possible values are true or false, the default being false. The author of this feature needed to put his application on a CD so that the users could run it directly from this media. However, he also wanted to offer them the possibility to install the software localy. Enabling this feature will make IzPack take the files on disk instead of from the installer. Please make sure that your relative files paths are correct!

id

this attribute is used to give a unique id to the pack to be used for internationalization via packsLang.xml file

packImgId

this attribute is used to reference a unique resource that represents the pack's image for the ImgPacksPanel. The resource should be defined in the <resources> element of the installation XML using the same value for the id attribute of the <res> element.

condition

an id of a condition which has to be fullfilled to install this package

hidden

takes true or false and specifies whether the pack shall be shown in the packs panel. The size of a hidden pack will be used to calculate the required space, but the pack itself won't be shown. A hidden pack can be preselected or selected conditionally. For the latter, you have to specify a condition. The default for this attribute is false.

The <refpack> takes only one attribute file, which contains the relative path (from the installation compiler) to an externally defined packs-definition. This external packs definition is a regular IzPack installation XML. However the only elements that are used from that XML file are the <packs> and the <resources> elements. This enables a model in which a single developer is responsible for maintaining the packs and resources (e.g. separate packsLang.xml_xyz files providing internationalization; see Internationalization of the PacksPanel) related to the development-package assigned to him. The main install XML references these xml-files to avoid synchronization efforts between the central installation XML and the developer-maintained installer XMLs.

The <refpackset> tag can be used in situations were there is no predefined set of <refpack> files, but a given directory should be scanned for <refpack> files to be included instead. This element takes the following parameters:

dir

the base directory for the refpackset (relative path)

includes

a pattern of files in <refpack> format that must be included

An example: <refpackset dir="" includes="**/refpack.xml" />

The following sections describe the tags available for a <pack> section.

<description> - pack description

The contents of the <description> tag describe the pack contents. This description is displayed if the user highlights the pack during installation.

<depends> - pack dependencies

This can be used to make this pack selectable only to be installed only if some other is selected to be installed. The pack can depend on more than one by specifying more than one <depends> elements. Circular depedencies are not supported and the compiler reports an error if one occurs.

This tag takes the following attribute:

packname

The name of the pack that this one depends on

<os> - OS restrictions

It is possible to restrict a pack to a certain list of operating systems. This tag takes the following attributes:

family

unix, windows or mac

name

the exact OS name (ie Windows, Linux, ...)

version

the exact OS version (see the JVM os.version property)

arch

the machine architecture (see the JVM os.arch property)

<updatecheck>

This feature can update an already installed package, therefore removing superfluous files after installation. Here's how this feature's author (Tino Schwarze) described it on the IzPack development mailing-list:

Each pack can now specify an <updatecheck> tag. It supports a subset of ant fileset syntax, e.g.:

<updatecheck>
  <include name="lib/**" />
  <exclude name="config/local/** />
</updatecheck>

If the paths are relative, they will be matched relative to $INSTALL_PATH. Update checks are only enabled if at least one <include> is specified. See {{com.izforge.izpack.installer.Unpacker
for details.

<file> - add files and/or directories

The <file> tag specifies a single file (a directory is a file, too!) to include into the pack. It takes the following attributes:

src

the file location (relative path) - if this is a directory its content will be added recursively. It may contain previously defined static variables (see <variables>).

targetdir

the destination directory, could be something like $INSTALL_PATH/subdirX

os

can optionally specify a target operating system (unix, windows, mac) - this means that the file will only be installed on its target operating system

override

if true than the file will be overwritten, if already installed. (use false otherwise). Alternative values: asktrue and askfalse - ask the user what to do and supply default value for non-interactive use. Another possible value is update. It means that the new file is only installed if it's modification time is newer than the modification time of the already existing file (note that this is not a reliable mechanism for updates - you cannot detect whether a file was altered after installation this way.) By default it is set to update.

unpack

if true and the file is an archive then its content will be unpacked and added as individual files

condition

an id of a condition which has to be fullfilled to install this file

<additionaldata>

This tag can also be specified in order to pass additional data related to a file tag for customizing.

<key>

key to identify the data

<value>

value which can be used by a custom action

<singlefile> - add a single file

Specifies a single file to include. The difference to <file> is that this tag allows the file to be renamed, therefore it has a target attribute instead of targetdir.

src

the file location (relative path). It may contain previously defined static variables (see <variables>).

target

the destination file name, could be something like $INSTALL_PATH/subdirX/fileY

os

can optionally specify a target operating system (unix, windows, mac) - this means that the file will only be installed on its target operating system

override

see <file> for description

condition

an id of a condition which has to be fullfilled to install this file

An <additionaldata> tag can also be specified for customizing.

<fileset> - add a fileset

The <fileset> tag allows files to be specified using the powerful Jakarta Ant set syntax. It takes the following parameters:

dir

the base directory for the fileset (relative path)

targetdir

the destination path, works like for <file>

casesensitive

optionally lets you specify if the names are case- sensitive or not - takes yes or no

defaultexcludes

optionally lets you specify if the default excludes will be used - takes yes or no.

os

specifies the operating system, works like for <file>

override

see <file> for description

includes

comma- or space-separated list of patterns of files that must be included; all files are included when omitted. This is an alternative for multiple include tags.

excludes

comma- or space-separated list of patterns of files that must be excluded; no files (except default excludes) are excluded when omitted. This is an alternative for multiple exclude tags.

condition

an id of a condition which has to be fullfilled to install the files in this fileset

You specify the files with <include> and <exclude> tags that take the name parameter to specify the Ant-like pattern :

** : means any subdirectory
* : used as a wildcard.
Here are some examples of Ant patterns :

<include name="lib"/>

will include lib and the subdirectories of lib

<exclude name="*/.java"/>

will exclude any file in any directory starting from the base path ending by .java

<include name="lib/*.jar"/>

will include all the files ending by .jar in lib

<exclude name="lib/**/FOO"/>

will exclude any file in any subdirectory starting from lib whose name contains FOO.

There is a set of definitions that are excluded by default file-sets, just as in Ant. IzPack defaults to the Ant list of default excludes. There is currently no equivalent to the <defaultexcludes> task. Default excludes are:

**/*\~{}
**/\#*\#
**/.\#*
**/%*%
**/.\_*
**/CVS
**/CVS/**
**/.cvsignore
**/SCCS
**/SCCS/**
**/vssver.scc
**/.svn
**/.svn/**
**/.DS\_Store

An <additionaldata> tag can also be specified for customizing.

<parsable> - parse a file after installation

Files specified by <parsable> are parsed after installation and may have variables substituted.

targetfile

the file to parse, could be something like $INSTALL_PATH/bin/launch-script.sh A slash will be changed to the system dependant path separator (e.g. to a backslash on Windows) only if no backslash masks the slash.

type

specifies the type (same as for the resources) - the default is plain

encoding

specifies the file encoding

os

specifies the operating system, works like for <file>

condition

an id of a condition which has to be fullfilled to parse this file

<executable> - mark file as executable and optionally execute it

The <executable> tag is a very useful thing if you need to execute something during the installation process. It can also be used to set the executable flag on Unix-like systems. Here are the attributes:

targetfile

the file to run, could be something like $INSTALL_PATH/bin/launch-script.sh Slashes are handled special (see attribute targetfile of tag <parsable>).

class

If the executable is a jar file, this is the class to run for a Java program

type

bin or jar (the default is bin)

stage

specifies when to launch :

  • never (default) will never launch it (useful to set the +x flag on Unix)
  • postinstall is just after the installation is done
  • uninstall will launch the executable when the application is uninstalled. The executable is executed before any files are deleted.

failure

specifies what to do when an error occurs:

  • ask (default) will ask the user what to do
  • abort will abort the installation process
  • warn will just tell the user that something is wrong
  • ignore don't tell the user, just continue

os

specifies the operating system, works like for <file>

keep

takes true or false (default for backward compatibility). specifies whether the file will be kept after execution.

condition

an id of a condition which has to be fullfilled to execute this file

Takes an <args> tag to pass one or more arguments (one <arg> tag per argument) to the executable.
<arg> passes the argument specified in the value attribute. Slashes are handled special (see attribute targetfile of tag <parsable>.

<os> - make a file OS-dependent

The <os> tag can be used inside the <file>, <fileset>, <singlefile>, <parsable>, <executable> tags to restrict it's effect to a specific operating system family, architecture or version using the following attributes:

family

unix, windows, mac to specify the operating system family

name

the operating system name

version

the operating system version

arch

the operating system architecture (for instance the Linux kernel can run on i386, sparc, and so on)

Example

<packs>
(...)
    <pack name="Core" required="yes">
    (...)
        <executable targetfile="$INSTALL_PATH/bin/compile" stage="never">
            <os family="unix"/>
        </executable>
    (...)
    </pack>
(...)
</packs>

Internationalization of the PacksPanel

In order to provide internationalization for the PacksPanel, so that your users can be presented with a different name and description for each language you support, you have to create a file named packsLang.xml_xyz where xyz is the ISO3 code of the language in lowercase. Please be aware that case is significant. This file has to be inserted in the resources section of `` install.xml`` with the id and src attributes set at the name of the file. The format of these files is identical with the distribution langpack files located at `` $IZPACK_HOME/bin/langpacks/installer``. For the name of the panel you just use the pack id as the txt id. For the description you use the pack id suffixed with .description.

An example:

<resources>
    <res id="packsLang.xml_eng" src="i18n/myPacksLang.xml_eng"/>
</resources>

The packsLang.xml_eng file:

<langpack>
    <str id="myApplication" txt="Main Application"/>
    <str id="myApplication.description" txt="A description of my main application"/>
    [...]
</langpack>
  • No labels