Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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:

  • plain values
  • environment variables
  • INI files
  • option/property files (key-value pairs)
  • XML files (using XPath-like queries)
  • INI/option/XML files from within an ZIP or JAR file
  • Windows registry
  • output of a command execution

and filter them optionally using regular expressions. A particular dynamic variable can be evaluated based on a certain condition.

Other variables and dynamic variables can be used withing ${ and } to be replaced in the assignment expressions below.

The attribute checkonce[ = "true"|"false"] might be added to assign a dynamic variable only one time at the beginning of the installation process, which makes it behave as a normal variable, although with enhanced capabilities to gather a value.

Plain Values

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

Example:

Assigning a plain value to a dynamic variable
<dynamicvariables>
    <variable name="previous.version" value="4.3.3"/>
</dynamicvariable>

The above example is functionally equivalent to

<variables>
    <variable name="previous.version" value="4.3.3"/>
</variable>

since there are no replacements used which might be refreshed on a panel change.

Values from Environment Variables
Assigning the value of an environment variable to a dynamic variable
<dynamicvariables>
    <variable name="search.path" environment="PATH"/>
</dynamicvariables>

The above example is functionally equivalent to

<variables>
    <variable name="search.path" value="${ENV[PATH]}"/>
</variable>

since there are no replacements used which might be refreshed on a panel change and the environment variable PATH won't change during the runtime of an installation process.

Values from Property/Option Files

Dynamic variables can be also assigned from a value in configuration files with key-value pairs, as property files.

Example:

Assigning a dynamic variable from properties/option files
<dynamicvariables>
    <variable name="option.1" checkonce="true"
              file="${INSTALL_PATH}/../old_installation/test.properties" type="options"
              key="first.setting"/>
    <variable name="option.2" checkonce="true"
              file="${INSTALL_PATH}/../old_installation/test.conf" type="options"
              key="work.dir"/>
</dynamicvariables>
Values From Configuration Files in an Archive (JAR/ZIP)

All of the above variants of reading a dynamic variable value from a configuration file can be also applied if that configuration files is packaged as an entry into a ZIP or JAR file.

Example:

Assigning a dynamic variable from an configuration entry in a JAR/ZIP file
<dynamicvariables>
    <variable name="previous.version" jarfile="${INSTALL_PATH}/${INSTALL_SUBPATH}/libs/config.jar"
              entry="release.properties" type="options"
              key="release.version"
              checkonce="false" ignorefailure="true">
      <regex regexp="([0-9]+(\.[0-9]+){2})" select="\1" defaultvalue="XX.XX.XX"/>
    </variable>
</dynamicvariables>
  • No labels