Adding or renaming a single file

The <singlefile> Element

The <singlefile> tag is a nested element to the <pack> element and allows a single file to be added to that pack.

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

Attributes

Attribute

Description

Required

Values
(Default)

src

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

yes


target

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

yes


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

no

"unix" | "windows" | "mac"

override

Whether to overwrite existing files.
Use asktrue or askfalse if the user should be interactively asked 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.)

no

"true" | "false" | "asktrue" | "askfalse" | "update"
("update")

overrideRenameTo

Globmapper to rename a conflicting file to. This works similar like the <globmapper> in File Name Mappers, whereby the mapper's from attribute is set to "*" and the to attribute exactly to the value given here. Example "*.bak" will rename the target file by appending the suffix .bak instead of overwriting it. The override attribute must be set "true" to activate this feature.

Since IzPack 5.0

no

String - valid globmapper target expression

blockable

For Windows only, ignored on non-Windows systems: 
Defines whether and how blocked target files on Windows should be handled. This might result in pending file operations which require a system reboot.

Pending file operations are introduced during the installation in two phases:

  1. The blockable attribute marks files pending to be replaced after a system reboot if they are blocked. Blocked files are recognized during physically installing them.
  2. How and whether the system should be really rebooted directly from the installer in case there are such pending file operations at the end of the installation can be controlled by the <rebootaction> tag nested to <info>.

Note:
Using blockable does not necessarily force you to limit such files on Windows systems. For multi-platform installations there is a compiler warning shown that blockable will be ignored on non-Windows systems.
The native library WinSetupAPI must be explicitely included using this feature.

Possible values:

  • none
    No recognition of blocked target files will be done at all, this is the default behavior of previous IzPack versions.
  • auto
    Automatic recognition of a blocked target file by the operating system, resulting in leaving a pending file operation to be finished after system reboot. Using auto this applies only for files that are really blocked, the other files are copied normally, which can result in mixed, old and new target files at the end of the installation, unless the system won't be really rebooted.
  • force
    Forces target file to be always assumed a blocked, resulting in leaving a pending file operation to be finished after system reboot. Using force this applies for each file, regardless whether it is really blocked during installation. This makes sense if you don't want to mix files old and new files at the end of the installation to not disturbing a running process, but having the complete set of target files installed after system reboot.


Since IzPack 5.0

no

"none" | "auto" | "force"
("none")

condition

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



Nested Elements

The following nested elements can be used in the <singlefile> 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

key to identify the data

value

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 you might use 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.


<pack200>


The <pack200> element adds Java bytecode compression to this file.


Make sure to apply it only to a JAR file or similar file containing Java bytecode.


See Compressing pack files for more information how to cutomize this feature.

Since: IzPack 5.1