Adding or unpacking a single file to a target directory
The <file>
element
The <file>
tag is a nested element of the <pack> element. It specifies a single file to be added to that pack.
You can use <fileset>
to add multiple files.
Attributes
Attribute | Description | Required | Values |
---|---|---|---|
| the file location (relative path). The src name may contain previously defined static variables (see | yes | |
| the destination directory, could be something like | yes | |
| Limit installation of this particular file only to the given target OS type. | no | "unix" | "windows" | "mac" |
| Whether to overwrite existing files.
|
| "true" | "false" | "asktrue" | "askfalse" | "update" |
| Globmapper to rename a conflicting file to. This works similar to the <globmapper> in File Name Mappers, whereby the mapper's from attribute is set to the empty string and the to attribute exactly to the value given here. Example: | no | String - valid globmapper target expression |
| For Windows only, ignored on non-Windows systems: Pending file operations are introduced during the installation in two phases:
Notes:
| no |
|
| if true and the file is an archive then its contents will be unpacked and added as individual files. One or more nested Before IzPack 5.1.0, only ZIP archives were supported (including jar, war and zip files). Since IzPack 5.1.0, all compression supported by the Apache common-compress library are automatically recognized by analyzing the file metadata and are extracted correctly. These include bzip2, Pack200, XZ, gzip, lzma, Z, deflate as well as archive types such as ar, arj, cpio, dump, tar, 7z, zip and their combinations like tar.gz. Note: Unpacking 7z during compiling does not support all methods the format specifies, see Known Limitations (we use commons-compress 1.12 at the moment). The file extension is ignored for this auto-recognition. | no | "true" | "false" |
| Limit installation of this particular file to the given condition, which must be true during the file installation. | no | String - a valid condition ID |
| Whether to treat the file name case-sensitive. | no | "true" | "false" |
| Whether to use global default excludes. */~{} */## */.# */%% */._ **/CVS */CVS/* **/.cvsignore **/SCCS */SCCS/* **/vssver.scc **/.svn */.svn/* **/.DS_Store Since IzPack 5.0 | no | "true" | "false" |
| Whether to follow symbolic links on target systems which support them. | no | "true" | "false" |
Nested Elements
The following nested elements can be used in the <file>
tag:
<os>
Limit the installation of this file to conditions depending on the target OS, see OS Restrictions.
<additionaldata>
This tag can also be specified in order to pass additional data related to a file tag for customizing.
Attribute | Description |
---|---|
| key to identify the data |
| value which can be used by a custom action |
;<additionaldata> is an element which may provide additional information as key-value pairs to certain custom actions. The particular key-value pairs will depend on the particular custom action.
Currently, there are two built-in custom actions consuming such data, ChmodCompilerListener
and ChmodInstallerListener
, where relevant keys are
permission.dir
,permission.file
with integer values interpreted as permissions like in the Unix chmod:
If value begins with "0
" -> octal number,
otherwise is is a decimal number representing some permission.
These permissions are applied to the appropriate files either during the compilation of the package or while installing them later, depending on whether the consumer implements a CompilerListener or InstallerListener.
<archivefileset>
If the unpack
attribute is set to "true"
, one or more nested <archivefileset>
elements can be added to define the patterns for include and exclude paths similar to the <fileset>
element nested to a <pack>
. In comparison to <pack>, an <archivefileset>
does not permit the specification of a targetdir
and its dir
attribute is optional (defaults to the root directory of the archive contents). Furthermore the dir
attribute of an <archivefileset>
can not refer to an absolute path, but must be relative to the archive root.
<pack name="Oracle JRE" required="yes" id="pack.oracle.jre"> <description>Oracle JRE</description> <file src="plain/jre-8u121-windows-x64.tar.gz" targetdir="${INSTALL_PATH}" unpack="true" override="true"> <archivefileset dir="jre1.8.0_121" /> </file> </pack>
This part extracts the contents of the original Oracle JRE archive as received from the download site, but without the root directory jre1.8.0_121 from the archive to an installation folder of your choice, which can be referred to as %JAVA_HOME%
.
An <archivefileset> does not allow the targetdir
attribute to be defined. The target dir for that filter operation is taken from the targetdir attribute of the embedding <file> tag.
Since: IzPack 5.1
<pack200>
The <pack200> element adds Java bytecode compression to all files in this set of files.
Make sure to apply it only to JAR files or similar files containing Java bytecode.
See Compressing pack files for more information how to cutomize this feature.
Since: IzPack 5.1