...
- name
The name of the dynamic variable used to refer to it. - checkonce:= "true" | "false" (optional, defaults to "false")
Mark the dynamic variable to be evaluated just once, either when the installation starts or as soon as an optional condition gets true. This makes it behave like a normal variable, although with enhanced capabilities to gather a value.
Values gathered by a dynamic variable definition with checkonce="true" can be overridden, if there is another dynamic variable with the same key (and different conditions which evaluate to true ) found later. - ignorefailure:= "true" | "false" (optional, defaults to "true")
Might be used to allow the installation to continue or abort if an error occurred during gathering the value for a certain dynamic variable. - condition (optional)
The assignment of a dynamic variable itself can be made dependent on a certain condition, using the condition attribute, which refers to the ID of condition defined in the installer description elsewhere. - unset:= "true" | "false" (optional, defaults to "true")
By defaut, if none of the conditions of a dynamic variable of one and the same name isn't met, a dynamic variable is unset for cleanup purposes.
Setting unset false prevents unsetting a variable if the complex condition above is not met and leaves the variable value unchanged for that definition.
Note |
---|
As dynamic variables almost completely integrate with static IzPack variables, which means they are mapped to a normal IzPack variable, they can be used as direct variables in user input fields. Take care to have stable evaluation conditions after the user entered a value or use checkonce="true" for this purpose to not override the user value after leaving the panel. |
...
Code Block | ||||
---|---|---|---|---|
| ||||
<dynamicvariables> <variable name="XML_Comment_Start" condition="\!izpack.selected.mycoolfeature"> <value><\!\[CDATA[<!--]\]></value> </variable> <variable name="XML_Comment_End" condition="\!izpack.selected.mycoolfeature"> <value><\!\[CDATA[-->]\]></value> </variable> <variable name="XML_Comment_Start" value="" condition="izpack.selected.mycoolfeature" /> <variable name="XML_Comment_End" value="" condition="izpack.selected.mycoolfeature" /> </dynamicvariables> |
The condition "izpack.selected.mycoolfeature"
...
The condition "izpack.selected.mycoolfeature" is generated automatically when a pack with the ID "mycoolfeature" was specified. You could now use ${XML_Comment_Start} and ${XML_Comment_End} in a file which should be parsed.
is generated automatically when a pack with the ID "mycoolfeature" was specified. You could now use ${XML_Comment_Start} and ${XML_Comment_End} in a file which should be parsed.
For example, there might be an input file test.xml installed to ${INSTALL_PATH}:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0"?>
<test>
<a></a>
${XmlCommentStart}<b></b>${XmlCommentEnd}
</test> |
parsed like this in install.xml:
Code Block | ||
---|---|---|
| ||
<parsable targetfile="$INSTALL_PATH/test.xml" encoding="UTF-8"/> |
If the pack mycoolfeature would be enabled during the installation, the file would look like this at the end:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0"?>
<test>
<a></a>
<b></b>
</test> |
otherwise the <b></b> element would be commented out:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0"?>
<test>
<a></a>
<!-- <b></b> -->
</test> |
Values from Environment Variables
...
Code Block | ||||
---|---|---|---|---|
| ||||
<dynamicvariables> <variable ... <!-- other nested arguments might go here --> <filters> <filter1 .../> <filter2 .../> ... <!-- more filters might go here --> </filters> </variable> </dynamicvariable> |
...
Regular Expression Filter
...