spacer
AntInstaller

Automated installations

``The great thing about text-auto is it gives you completely silent builds just like Ant. The downside to text-auto is that it gives you completely silent builds just like Ant.''
-- Paul Hinds
Ant Installer Group

Welcome to Automated installations, how to take the user interaction out of your user interactive installs!

A much requested feature is automated installations. Generally it is expected that programs would be delivered with AntInstaller specifically to be able to configure the installations manually, however it is useful to be able to reinstall in a particular environment without having to manually re-enter the properties. The defaults in the antinstall-config.xml file may not be the correct defaults for the specific environment on which the installation is performed.

Be carefull if delivering installers that can be fully automated to third parties, you should fully understand the consequences of the options before using this feature. That said, this feature can prevent making human errors with repeated installations in a controlled environment such as reinstalling software on a series of servers. It is generally safest to use the prompt options when delivering to third parties.

To handle these use cases an additional attribute has been added to the installer element and two new UI overrides have been added.

The loadDefaults attribute of the installer element can be set to true, false, prompt or prompt-auto.
  • When loadDefaults is true the current directory is searched for ant.install.properties and, if found, it is used to reset the default values for all properties and targets.
  • When loadDefaults is prompt the user is prompted if the file is found and has the option to load the properties or not. Automatic installs without loaded properties sets are not permitted with this option.
  • The prompt-auto loadDefaults option is not expected to be used often. It caters for the situation when it is required that the installer can be run with out any user interaction using only the default values provided in antinstall-config.xml or run with configured properties. If existing properties are found they can be loaded, but if not loaded and either text-auto or swing-auto is selected on the command line the installer will run with no user defined properties.
  • When loadDefaults is false the current directory is not checked for exiszting properties files.
When the installer is run ant.install.properties is written to the current directory, if the current directory is not writable no warning message is given since repeatable installs are not always required.

Two additional UI overrides have been added swing-auto and text-auto which can be specified as the first parameter on the command line. swing-auto loads the swing GUI and skips directly to the progress page with all default values set. text-auto runs the installer with default values with no questions asked except, potentially, the loadDefaults prompt. To enable these UI overrides the ui attribute of the installer element must be set in antinstall-config.xml.
for example
<installer
	ui="swing,text,swing-auto"
	...
Be careful if setting loadDefaults to true, if text-auto is enabled, selected by the user on the command line and the ant.install.properties file is missing or out of date, an incorrect install will be performed with no oportunity to prevent it. This is permitted because it may be requried to run the installer with no prompts using the default values specifed in the antinstall-config.xml file. Completely silent, repeatable, installs on the command line are possible with this option.

The "automated installations" feature is not compatible with multiple install types without care. If a specific -type is used when repeating the install the same -type should be specified, antinstaller does not currently check this.

Version control

Version control is provided by setting the version attribute of the installer element of antinstall-config.xml. Increment the major version to indicate that old properties files are no longer valid. Increment the minor version to indicate that old properties are valid but some additional manual entering of properties is required. -auto builds are only permitted if the major and minor versions match. The version numbers support the following syntax. 1.4.2 where 1 is the major version and 4 then 2 are minor versions. For each major or minor version the strings alpha, beta and gamma can be appended with or with out a - (as required by java) to indicate the state of the code. No additional string is considered to be the best version. 1.4.2 > 1.4 > 1.4beta.2 == 1.4-beta.2

Simple use cases

To help explain the options provided some simple use cases are described here.

To enable end users to reload the values they used in a previous install set ui="swing,text" and set loadDefaults="prompt".

To enable end users to reload the values they used in a previous install and not have to click through the pages set ui="swing,text,swing-auto,text-auto" and set loadDefaults="prompt".

To run repeatable silent server installations set ui="text,text-auto" and loadDefaults="true". First time run java -jar myinstaller.jar and enter the properties. When the installer has finished hard code any passwords.
When you wish to update the code create a new myinstaller.jar and run java -jar myinstaller.jar text-auto.
Should you wish to change the property values or add additional properties delete ant.install.properties from the current directory and run the installer with java -jar myinstaller.jar.

antinstaller- targets

antinstaller- targets that are run when pages are shown are run in the -auto modes depending on the current state if ifProperty and ifTarget tests. If you want to use antinstaller- tasks and support -auto modes you have to work out what the consequences are for your installer. You can also set appropriate properties and use the if attribute in Ant target elements to specify additional process to compensate for -auto builds.

You should notice that also if the antinstaller- targets render messages they will be run automatically during swing-auto builds causing (probably unwanted) popups.

Password handling

Passwords are not written to ant.install.properties, if a password field is missing the user is warned that the defaults from antinstall-config.xml will be used. This can be avoided by entering the password in plain text into ant.install.properties with a text editor provided that does not create security risks.
show menu