...
- 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" 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. - escape := "
true
" | "false
" (optional: defaults to "true
")
Whether to apply escape sequences escaped by backslashes, like defined for Java properties files.
Set "false
" especially if you want to read values with backslashes where backslashes are not assumed to introduce escape sequences, like Windows paths.
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 read a XML file. - key
The XPath path to the entry to read the value for.
Note: Currently, the XPath language revision depends on the JRE version the installer runs on. JRE 6/7 support XPath 1.0.
Example:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<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 XPath, INI, option or property entry key to read the value for. - escape := "
true
" | "false
" (optional: defaults to "true
")
Whether to apply escape sequences escaped by backslashes, like defined for Java properties files.
Set "false
" especially if you want to read values with backslashes where backslashes are not assumed to introduce escape sequences, like Windows paths.
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 | ||||||
---|---|---|---|---|---|---|
| ||||||
<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 | ||||||
---|---|---|---|---|---|---|
| ||||||
<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> |
...
- 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 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 | ||||||
---|---|---|---|---|---|---|
| ||||||
<dynamicvariables> <!-- Read the property value of release.version in the resource release.properties from the root of the config.jar file. Filter just the version string from the result, if there is one, otherwise return 'none'. --> <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"> <filters> <regex regexp="([0-9]+(\.[0-9]+){2})" select="\1" defaultvalue="none"/> </filters> </variable> <!-- Read the value of the Windows system environment variable %PATH% directly from the Windows registry (can done smarter by ${SYSTEM[PATH]}). Filter just the first single path (if there are more separated by the ';' character). If there was a valid value, otherwise return '(unmatched)'. --> <variable name="RegExTest.Select.Windows" checkonce="true" regkey="HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" regvalue="Path"> <filters> <regex regexp="([^;]*)(.*)" select="\1" defaultValuedefaultvalue="(unmatched)" casesensitive="false"/> </filters> </variable> <!-- Read the value of the Windows system environment variable %PATH% directly from the Windows registry (can done smarter by ${SYSTEM[PATH]}). Filter just the first single path (if there are more separated by the ';' character). Prepend and append three plus signs to the resulting value, if there was a valid value, otherwise return '(unmatched)'. --> <variable name="RegExTest.ReplaceFirst.Windows" checkonce="true" regkey="HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment" regvalue="Path"> <filters> <regex regexp="([^;]*)" replace="+++ \1 +++" defaultValuedefaultvalue="(unmatched)" casesensitive="false" global="false"/> </filters> </variable> </dynamicvariables> |
...