...
- value
The plain value to be assigned to the dynamic variable.
Example:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<dynamicvariables> <variable name="previous.version" value="4.3.3"/> </dynamicvariable> |
...
- environment
The name of the environment variable to get the assignment value from.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<dynamicvariables> <variable name="search.path" environment="PATH"/> </dynamicvariables> |
...
The attribute type="options" is to be used to make this file parsed as an option file. Separators between the key and value might be for instance '=', ':' including their escaped variants '\=', '\:', where leading and trailing whitespaces are trimmed off.
Example:
Code Block | |||||
---|---|---|---|---|---|
| |||||
<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> |
...
- file
The INI file path to read from. - type := "options" | "ini" | "xml" (optional, defaults to "options")
The file type, must be "ini" to read INI keys. - section
The INI section to lookup the entry in. - key
The INI entry key to read the value for.
Example:
Code Block | |||||
---|---|---|---|---|---|
| |||||
<dynamicvariables> <variable name="ini.1" checkonce="true" file="C:/Program Files/freesshd/FreeSSHDService.ini" type="ini" section="SSH server" key="SSHCMD"/> </dynamicvariables> |
...
- file
The XML file path to read from. - type := "options" | "ini" | "xml" (optional, defaults to "options")
The file type, must be "XML" to assume a XML file. - key
The XPath path to the entry to read the value for.
Example:
Code Block | lang | xml|||
---|---|---|---|---|
| ||||
<dynamicvariables> <variable name="XMLReadTest.1" checkonce="true" ignorefailure="false" file="${INSTALL_PATH}/../old_installation/test.xml" type="xml" key="/installations/installation[path='/usr/local']/title[@lang='en']/text()"/> <variable name="XMLReadTest.2" checkonce="true" ignorefailure="false" file="${INSTALL_PATH}/../old_installation/test.xml" type="xml" key="//title[@lang='en']/text()"/> </dynamicvariables> |
...
- jarfile
The jar file path to read from. - zipfile
The zip file path to read from. - type := "options" | "ini" | "xml" (optional, defaults to "options")
The archived file's type. - section
The INI section to lookup the entry in, is evaluated only if type = "ini". - key
The INI, option or property entry key to read the value for.
Example:
Code Block | |||||
---|---|---|---|---|---|
| |||||
<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"> </variable> <variable name="other.stuff" zipfile="${INSTALL_PATH}/${INSTALL_SUBPATH}/libs/misc.zip" entry="app.ini" type="ini" section="Global Settings" key="AUTOSTART" checkonce="true" ignorefailure="true"> </variable> </dynamicvariables> |
...
- regkey
The registry entry root key to find the registry value to read from. - regvalue
The registry value to read from, which is in Microsoft terms equivalent to a key in ordinary INI files.
Example:
Code Block | lang | xml|||
---|---|---|---|---|
| ||||
<dynamicvariables> <variable name="RegistryReadTest" checkonce="true" regkey="HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" regvalue="Path"/> </dynamicvariables> |
...
- executable
Absolute or relative path to the command to be launched. If the "dir" attribute is used, than relative paths are computed against the mentioned directory. The characters '.' and '..' inside the command path are resolved to a canonical path according to the operating system. - type := "process" | "shell" (optional, defaults to "process")
"process" - launch the command directly without an underlying shell invocation
"shell" - launch the command over the system shell, assuming it to be a shell script - dir (optional)
Absolute or relative path to a work directory, from where the command should be launched. The characters '.' and '..' inside the directory path are resolved to a canonical path according to the operating system. - stderr := "true" | "false" (optional, defaults to "false")
Whether the standard error output of the command should be used instead of the standard output.
This can be useful for some commands which deliver certain information only as error, for instance 'java -version'..
Example 1:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<dynamicvariables> <variable name="hostname" checkonce="true" executable="hostname" type="process"/> <variable name="result.value" checkonce="true" executable="${INSTALL_PATH}/bin/init.sh" type="shell"/> </dynamicvariables> |
Example 2:
Code Block | lang | xml|||
---|---|---|---|---|
| ||||
<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> <regex regexp="java version[^\d]+([\d\._]+)" select="\1"/> </variable> </dynamicvariables> |
Filtering Values
...
After straight evaluation, each dynamic variable assignment value can be filtered using a Java regular expression. This is done by the nested regex element.
Attributes:
predefined filters. Each filter might have a number of attributes to configure its behavior.
Multiple nested filters can be used. In this case, the order of defining them is the order they will be executed at installation time.
Regular Expression Filter
After straight evaluation, each dynamic variable value can be filtered using a Java regular expression. This is done by the nested regex element.
Attributes:
- regexp
The Java regular expression to be used for selecting from the variable value or for replacing certain parts of the variable value. For more information see the Java Platform SE 6 API and other documents describing the according regular expression syntax more in detail. - select (one of both, select or replace must be given)
Selection expression according to regexp, used to select certain groups from the expression defined in regexp and possibly combine them with several text around. - replace (one of both, select or replace must be given)
Replacement expression according to regexp, used to replace the regular expression defined in regexp and possibly combine them with several text around. - defaultValue (optional)
The default value to be used if the expression defined in regexp does not match the enclosing variable value at all. - casesensitive (optional, defaults to "true")
Whether the regular expression matching should consider the case of alphabetic letters or not for matching. - global (optional, defaults to "false")
Whether the replacement operation should be performed on the entire variable value, rather than just the first occurance. This has effect only on using together with replace.
Example:
Code Block | lang | xml|||
---|---|---|---|---|
| ||||
<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" condition="upgradecheck"> <regex regexp="([0-9]+(\.[0-9]+){2})" select="\1" defaultvalue="none"/> </variable> <variable name="RegExTest.Select.Windows" checkonce="true" regkey="HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" regvalue="Path"> <regex regexp="([^;]*)(.*)" select="\1" defaultValue="(unmatched)" casesensitive="false"/> </variable> <variable name="RegExTest.ReplaceFirst.Windows" checkonce="true" regkey="HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" regvalue="Path"> <regex regexp="([^;]*)" replace="+++ \1 +++" defaultValue="(unmatched)" casesensitive="false" global="false"/> </variable> <variable name="RegExTest.ReplaceAll.Windows" checkonce="true" regkey="HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" regvalue="Path"> <regex regexp="([^;]*)" replace="+++ \1 +++" defaultValue="(unmatched)" casesensitive="false" global="true"/> </variable> </dynamicvariables> |
Location Filter
After straight evaluation, each dynamic variable value can be filtered to be canonicalized like a filename. This is done by the nested location element.
Attributes:
- basedir
The root directory relative path to be assumed when the origin value is not an absolute path. If not set, the current working directory is assumed as the base directory, instead.
Code Block | ||||
---|---|---|---|---|
| ||||
<variable name="previous.wrapper.java.command.canonical" value="${previous.wrapper.java.home.canonical}/bin/java"
condition="haveInstallPath+isCompatibleUpgrade+haveWrapperJavaCmd+isSetCanonicalJavaHome">
<location basedir="${INSTALL_PATH}"/>
</variable> |