Home | New Stuff | About Us | Site Blog | Link to Us | Contact Us | Privacy Policy | Terms of Service

Options
Categories/Articles

Extending the Application Runtimes View

By: Candice Jones

Introduction

InstallAware version 5.0 introduces a new Application Runtimes visual view which lets the setup author add or remove application runtimes that are required by his/her installation with a single click on a checkbox. This view is intelligent - it automatically selects any nested runtimes required by the chosen runtime, sets conditions for hardware and software requirements, runs custom scripts that detect the presence of the runtime and install it if necessary, and even provides an optional configuration mechanism that tweaks the settings for the runtime being installed.

This view can be customized without any programming work. Unlike writing an InstallAware plug-in DLL or a custom format DLL, both of which have been ways to extend the InstallAware environment in previous versions, this customization can be done entirely in InstallAware. This article describes the open specifications for extending the new Application Runtimes visual view in InstallAware v5.0.

The Runtimes Repository

The list of one-click installable runtimes in the Application Runtimes visual view of the InstallAware IDE is not hard-coded. This list is dynamically populated from the following location:

<Your InstallAware Folder>\runtimes

For instance, in a default installation of InstallAware Studio Admin, this folder would be:

C:\Program Files\InstallAware Studio Admin 5\runtimes

The following types of files exist in this folder:

1. RTM files: Runtime description files

2. MIA files: Runtime detection/installation script files

3. FLD files: Code-folding data files for MIA files

4. BRK files: Breakpoint data files for MIA files

5. BAK files: Save backup files for MIA files

Of these, only the first two are significant: the RTM files that describe new runtimes (and populate the list of available runtimes for installation in the IDE's respective visual view), and the MIA files which are the actual InstallAware scripts that perform necessary scripting to check for and install the runtimes in question.

The contents of this folder may be freely customized with new additions (or removals, if necessary). Of course, when making additions to the folder, the FLD and BRK files that accompany the MIA script files should be placed in this folder, alongside the scripts themselves and the RTM file. These accompanying files are generated automatically by the IDE whenever a script file is saved. Copying BAK backup files is not necessary.

The RTM File Format

RTM files are plain text files that can be created and edited using any text editor, such as the infamous Notepad.

The name of the RTM file (excluding the file extension) should be the exact name of the runtime, as intended for display in the InstallAware IDE. For instance, the Microsoft SQL Server Express 2005 runtime is defined in the file Microsoft_SQL_Server_Express_2005.rtm. Name your own custom runtime file as you wish for it to be listed in the IDE.

The contents of the RTM file are summarized below:

[runtime dependency 1]

[runtime dependency n]
$
[runtime hardware or software requirement 1]

[runtime hardware or software requirement n]
$
<runtime detection script>
<runtime installation script>
"configurable line prefix 1",…,"configurable line prefix n"

The Runtime Dependencies Block

This block lists every additional runtime that is a dependency of the runtime being described in the RTM file. It may be empty, or contain one or more lines of runtime names for the runtimes that are required. When empty, do not leave a blank line - simply skip this section entirely, and begin the file with the $ character that denotes the end of the section. When specifying multiple runtimes, list each runtime in an individual line. Always follow the correct install order when listing runtimes (list the most basic runtime first, moving on to other runtimes next).

When your runtime is selected for installation in the IDE, the IDE will also select each runtime listed in the runtime dependencies block automatically. Note that the IDE does not recursively resolve runtime dependencies listed in this block - so enumerate each runtime explicitly here.

The Runtime Hardware and Software Requirements Block

The next section of the RTM file describes the various hardware and software requirements that the runtime has. The format of this section is similar to the previous one. Simply skip with a single $ sign when defining an empty section. When listing multiple requirements, list each requirement on its own line.

The strings used in this section must come from the Application Requirements visual view of the InstallAware IDE. You may use any string displayed under the various drop-down boxes in the hardware and software categories in this visual view to specify your requirements.

When the setup author selects your runtime, the IDE scans this block of the RTM file and automatically selects any hardware/software requirements specified herein. Switching to the Application Requirements visual view will reveal fields that have been auto-selected as part of this process.

The Runtime Detection Script

The next line in the file specifies the name of the script file that checks for the presence of the runtime. Just include the file name - the .mia extension is assumed and should not be given. You may create this script file as you would create any ordinary include file in the InstallAware IDE, save it, and then copy it to the InstallAware runtimes folder when ready.

The runtime detection script should test for the presence of the runtime. This is necessary to prevent duplicate (and unnecessary) re-installations of the runtime in question. You may use any InstallAware scripting commands to facilitate this check.

If the runtime is not found, include the following statements in your script:

Set Variable <RUNTIMETESTVAR> to FALSE

Set Variable PREREQ to TRUE

Set Variable PRELIST to $PRELIST$$NEWLINE$ <Runtime Name>

If the runtime is not found, your script may wish to check for additional conditions to see if it is installable on the target system (in addition to the software/hardware checks specified in the RTM file, and the nested pre-requisites). Simply use scripting normally to perform such checks, and if you determine that the runtime is not installable, include the following statements in your script:

MessageBox: $TITLE$ Setup, $TITLE$ requires at least <condition> . Please <apply resolution> and try again. $NEWLINE$$NEWLINE$ $TITLE$ Setup cannot continue.

Terminate Installation

If the runtime is found, include the following statement in your script:

Set Variable <RUNTIMETESTVAR> to TRUE

The above standard bits of code are standard in most InstallAware setups and recommended for inclusion in your own scripts to facilitate the best development and end-user experience with your runtimes.

The Runtime Installation Script

The next line in the runtime description file specifies the name of the script file that actually installs the runtime.

The runtime installation script should perform a full-blown installation of the runtime. You may use any InstallAware scripting commands to facilitate this installation. The installation routine should be encapsulated in an If block as shown below:

if Variable <RUNTIMETESTVAR> Equals FALSE

Set Variable PROGRESSTEXT to Installing <Runtime Name>

...

end

This block assures that the installation executes only if the detection script above has already requested it, thus avoiding duplicate installs. It also updates the progress text displayed on the pre-requisite installer dialog, providing a consistent and reassuring installation experience for the end-user.

If the runtime installation fails, the script should correctly report the failure reason, suggest remedy, and terminate setup, as below:

MessageBox: $TITLE$ Setup, <Runtime Name> could not be installed. Please <apply resolution>. $NEWLINE$$NEWLINE$ $TITLE$ Setup cannotcontinue.

Terminate Installation

If the runtime installation succeeds, but requires a restart of the computer, the script should ask for the end-users permission for a reboot, before continuing the installation. The setup should not be allowed to continue until the system has been rebooted:

MessageBox: $TITLE$ Setup, Your computer needs to be restarted before $TITLE$ Setup can continue. $NEWLINE$$NEWLINE$ Please save your work inall running programs and click OK to restart your computer. Setup will resume once your computer restarts. $NEWLINE$$NEWLINE$ If you click CANCEL, setup will exit. You will have to run setup again at a later time to install $TITLE$.

if Variable REBOOTNOW Equals OK

Reboot Computer and Resume Setup

else

Terminate Installation

end

Again, the above standard bits of code are standard in most InstallAware setups. Inclusion in your own scripts facilitates the best experience with your custom runtimes.

Configurable Line Prefixes

The last line of the RTM file enables runtime installs to be customized at design time. The Options button in the Application Runtimes visual view is disabled for most runtimes, but not all. To disable this button, leave this line blank (an empty line is required). To enable this button, enter one or more strings here, enclosed in double quotes, and separated with commas when entering more than one string.

The strings you enter here should be exact matches of prefixes found in commands that are used inside the check and install scripts for your runtime. When the Options button is clicked, the IDE will scan the check and install scripts line by line, to see if it can match one of the strings entered here with the beginning of one of the commands of your scripts, as visible in the IDE script editor. If the match succeeds, the IDE will display the command editor for that line, as if the setup author had double-clicked the command in the script editor to customize it.

Therefore, the configurable lines section offers a way to provide quick, visual entry points into vital commands that are used by your runtime check/installation routines via the Options button; without requiring for the setup developer to manually review the check and install scripts included by your runtime.

Examples

The easiest way to look at existing check/install scripts is by adding some pre-requisites to your installation, swapping to the Code view in the IDE, and studying the code that has been added to your setup. These can be used as starting templates to create your own runtime check/install scripts. Similarly, if you would like to study some RTM files before building your own, remember that they are available in the runtimes subfolder of your InstallAware IDE folder.

Some notable RTM files are mentioned below:

• Microsoft Visual C++ Runtime 6.0 with Service Pack 6 (includes ATL and MFC).rtm: Very basic runtime, has no hardware/software or pre-requisite requirements, no customizations.

• Microsoft JSharp Runtime 2.0.rtm: Has nested pre-requisites of its own, each singly specified.

• Microsoft Internet Explorer 6 with Service Pack 1.rtm: Has a single customizable command.

• Microsoft SQL Server Express 2005.rtm: Has two customizable commands.

Article Source: http://www.thecaymanhost.com/articles

Candice Jones is employed at InstallAware Software Corporation.

Please Rate this Article

 

Not yet Rated

Click the XML Icon Above to Receive Software Articles Via RSS!