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.

Usage

Dynamic variables behave like "normal" static variables defined by the <variable> tag, except that they are evaluated on each panel change. They are maintained as normal variables in an installation process, but in comparison to them dynamic variables have been enhanced by many more facilities. You can set dynamic variables values from the following sources on the target computer:

...

Note

Although dynamic variables almost completely integrate with static IzPack variables, which means they are mapped to a normal IzPack variable, be aware of using them as direct variables in user input fields. Even on using checkonce="true" they always refresh to the previous value matching the original dynamic variable definition of the according dynamic variable and override the "normal" IzPack variable after leaving a panel. Thus, user input field variables which are also defined as dynamic variable will not have the user input as effective value, but the value they had when entering the panel.

 

Lifecycle of Dynamic Variables

Each dynamic variable is mapped to an Izpack variable by its unique name.

It is possible to define a dynamic variable more times based on different conditions:

Code Block
titleExample
languagexml
<dynamicvariables>
  <variable name="thechoice" value="choice1" condition="cond1">
  <variable name="thechoice" value="choice2" condition="cond2">
</dynamicvariables>

A dynamic variable becomes a "normal" IzPack variable with a static key-value pair if it has set the attribute checkonce="true" and an optional condition for its evaluation becomes true. After this, it will be removed from the list of dynamic variables at installation time, but can be accessed further like a static IzPack variable if there is no further dynamic variable definition for the same key.

A dynamic variable is unset at installation time as static IzPack variable as soon as it cannot be evaluated any longer from any of the definitions for the same key. It is reinitialized with a value as soon as at least one dynamic variable definition can be evaluated in some later phase, again.

Types of Dynamic Variable Assignments

Plain Values

The easiest way to assign a value to a dynamic variable is a plain value.

...

Code Block
titleAssigning a dynamic variable value from the output of a command execution
langxml
<dynamicvariables>

    <variable name="previous.java.version" checkonce="true"
              dir="${INSTALL_PATH}"
              executable="jre/bin/java" stderr="true"
              type="process" ignorefailure="true"
              condition="haveInstallPath+isUpgrade">
      <arg>-version</arg>
      <filters>
        <regex regexp="java version[^\d]+([\d\._]+)" select="\1"/>
      </filters>
    </variable>

</dynamicvariables>

Filtering Values

After straight evaluation, each dynamic variable value can be filtered using predefined filters. Each filter might have a number of attributes to configure its behavior.

...