Marking files for execution
<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.
Files must be first added to the pack using <singlefile>
, <file>
or <fileset>
before they can be marked executable.
The permission changes (Unix) and/or execution happens before afterpack listeners are executed.
Attributes
Attribute | Description | Required | Values |
---|---|---|---|
| Relative or absolute target path of a pack file added before, which should reeceive executable permissions or which should be executed. May contain IzPack variables resolved during installation. Example: | no | File path |
|
| no | "bin" | "jar" |
| If the executable is a jar file, this is the class to run for a Java program | no | A valid Java class within the jar file |
| Specifies at which stage when to launch the executable:
| no | "never" | "postinstall" | "uninstall" |
| specifies what to do when an error occurs:
| no | "ask" | "abort" | "warn" | "ignore" |
| Whether the file will be kept after execution | no | "true" | "false" |
| Limits this action on a particular OS family, works like for | no | No recommended to use any longer, use the nested |
| ID of a condition which has to be fulfilled to execute this file | no | A valid condition ID |
Nested Elements
- <os> - restrict parsing depending on the target operating system, see the OS Restriction element
- <args>
Pass one or more arguments with nested <arg> tags (one<arg>
tag per argument) to the executable
Attributes: value - the argument value
Example:
<args><arg value="-version"/></args>
<pack name="core" required="yes"> ... <file targetdir="$INSTALL_PATH" src="projectNotification.bat" /> <executable targetfile="$INSTALL_PATH/projectNotification.bat" type="bin" stage="postinstall" failure ="warn" keep="true" > <os family="windows" /> <args> <arg value="-version"/> </args> </executable> ... </pack>
Slashes get special handling (see attribute targetfile
of tag <parsable>
.)
If you need to preserve a slash in front of an argument you will need to quote the slash.
<os family="windows" /> <args> <arg value="\/arg"/> </args>
Executing Multiple Files
One or more <fileset>
tags can be used to specify multiple files executable at once. The <fileset>
which can be used here does not have all of the attributes and nested tags of a Pack FileSet. Only the attributes targetdir
, includes
and excludes
and the children <include>
and <exclude>
are allowed. The children <include>
and <exclude>
only can have the attribute name
.
There can be filesets defined here without any attribute, but just one or more includes (targetDir
defaults to "${INSTALL_PATH}" in that case).
The order of execution is not defined when multiple files are specified in the include.
If you want the the files executed in a certain order, use multiple <execute>
sections.
There is no access to the filesystem for a <parsable>
fileset, but just to files that are packed into the installer at compile time.
See the example below.
<pack name="core" required="yes"> ... <file targetdir="$INSTALL_PATH" src="projectExtractor.bat" > <file targetdir="$INSTALL_PATH" src="projectInstaller.bat" > <executable type="bin" stage="postinstall" failure ="warn" keep="true"> <os family="windows" /> <fileset targetdir="$INSTALL_PATH" includes="fileCleaner.bat,projectNotification.bat" /> </executable> ... <pack>
Note that there is no guarantee that fileCleaner.bat will run before projectNotification.bat.