We need you!

Icon

The IzPack documentation needs work, and you are invited to edit it!

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Dynamic variables can be defined by the user using the <dynamicvariables> element in the installation description.
Dynamic variables are the most powerful facility of saving and gathering values on a target system where the installation is launched. The value of dynamic variables will be evaluated every time a panel is switched. Furthermore, beginning with IzPack 5.0, dynamic variables can be also assigned from several configuration and archive files, the Windows registry, the output of a command execution and dynamically filtered using Java regular expressions. See Dynamic Variables for more information and some examples how this can be achieved.
Dynamic variables can be handled like other variable types for variable substitution.

See Dynamic Variables for more details.

Built-In variables

There is a couple of "hard-coded" variables implemented in IzPack. The value of several built-in variables might alter depending on local conditions on the target system where the installation is launched.

...

Using System Properties As Variables

System properties given on the command line can be directly included as IzPack variables when using the SYSTEM_ prefix followed by the system property name in the variable name, and substituting alls occurences of '.' by '_'. No substitution happens in this case, if the according system variable cannot be found in the execution environment. This means that for example the string ${SYSTEM_java_version} gets inserted into the output as a literal string, instead of replacing it by an environment value.

Examples:

  • java.version would be available as $SYSTEM_java_version
  • os.name would be available as $SYSTEM_os_name

 

are directly assigned to variables using the following syntax, provided the system property is variable.name:


IzPack 5.0 and later:

${SYSTEM[variable.name]}

More examples, provided -Dfeature.Enabled=true is added to launching the installer on the command line:

Code Block
titleExample 1
languagexml
<variables>
  <variable name="featureEnabled" value="${SYSTEM[feature.Enabled]}" />
</variables>

<conditions>
  <condition type="variable" id="isFeatureEnabled">
    <name>featureEnabled</name>
    <value>true</value>
  </condition>
</conditions>

 is equivalent to:

Code Block
titleExample 2
languagexml
<conditions>
  <condition type="variable" id="isFeatureEnabled">
    <name>SYSTEM[feature.Enabled]</name>
    <value>true</value>
  </condition>
</conditions>


IzPack 4 and earlier (obsolete handling in IzPack 5.0 for backward compatibility):


${SYSTEM_variable_name}

If the variable name contains '.' characters they got to be replaced by '_' here.

More examples, provided -Dfeature.Enabled=true is added to launching the installer on the command line:

Code Block
titleExample 1
languagexml
<variables>
  <variable name="featureEnabled" value="${SYSTEM_feature_Enabled}" />
</variables>

<conditions>
  <condition type="variable" id="isFeatureEnabled">
    <name>featureEnabled</name>
    <value>true</value>
  </condition>
</conditions>

 is equivalent to:

Code Block
titleExample 2
languagexml
<conditions>
  <condition type="variable" id="isFeatureEnabled">
    <name>SYSTEM_feature_Enabled</name>
    <value>true</value>
  </condition>
</conditions>

For Izpack before 5.0.0-rc2, no real substitution on demand happens but all system properties known to the JVM are added as IzPack variables by default when the installer starts.