Managing Bundled Files

In this entry we are going to discuss how to manage files bundled within an installer.

It is common to have a separate tool or program that must be bundled with and run from the installer, but before the file copying part of the installation process has completed. A common example would be a license validation program. Typically, all files bundled within an installer are unpacked and then any tools would be run. In the case of a license validator, that is less than ideal because the user may end up waiting for the files to be unpacked only to find that the license is not valid. The user would then have to wait for the installation to be rolled back.

InstallBuilder provides you with actions to deal with these situations. The most important are <unpackFile> and <unpackDirectory>. Let's assume we are in the situation detailed above. A typical project XML file would look something like:


How to use Rules with InstallBuilder

The installation of your application does not have to be a rigid, linear sequence of actions. For example, maybe you need to copy certain files only if the target platform is Mac or Linux, but not if it is Windows. Or you may want to modify or add some content to a file, but only if it is needed (you don't want to duplicate configuration settings). Here's another example of common functionality: You may want to discard or accept user input depending on whether it meets certain criteria.

Rules in InstallBuilder allow you to determine when to perform certain actions depending on the circumstances, variables and user inputs that are involved in the installation. It allows you to set conditions related to an action or an action group at any step of the installation, and they will be performed only if the condition is met. You can set not only one, but a set of multiple conditions that can be evaluated with an AND/OR group logic statement.

This article will explain how to implement conditional rules in your actions, how to select the appropriate rule for each case, and how this can help you to optimize your project and avoid duplicating code.


How to Use the AutoUpdater in InstallBuilder

In version 6.0 of InstallBuilder, we started shipping a new tool called AutoUpdater . This tool allows you to enable users to check for, download and apply updates for your software on their machines, getting the necessary files through HTTP or FTP. Although the Autoupdater is not yet available through the InstallBuilder GUI, it is very simple to configure.

How Does it Work?

There is a binary file which will poll the server to get information about the software versions available. The behavior of this binary is:
  • Read the INI file that contains information about where to contact the server and which version is currently installed (which should be delivered together with the binary)

  • Get the XML file from the server, which contains available versions for each platform.

  • If there's a newer version available (checking that the version ID received is higher than the current one stored in INI file), download and install it or notify the user (return code = 0) if it is run in unattended mode.
This binary may be customized to fit your needs using the command line tool 'customize' which is available in the AutoUpdater directory after performing InstallBuilder installation. The binary may be generated for several platforms: windows, linux or linux-x64; and an XML file will be used to indicate the tool how should the updater be customized.


How to Add Components and Make them Optional

BitRock InstallBuilder allows you to create cross platform installers that make it easy for end users to install your software. Though users are often presented with a simple 5-click process, the software bundled inside and its configuration are typically very complex and difficult to set up manually. Examples of this are posted on BitNami.org, where stacks like Redmine, Alfresco or KnowledgeTree, which are fairly complex to install manually, can be installed in minutes thanks to installers that automate the process.

All of the applications available via BitNami have many different dependencies, such as: libraries, databases, web servers, programming languages, run-times, etc. Apart from that, each of them has to be configured a certain way and then all of the pieces need to be integrated to work together. The installation process gets even more complicated if you want to make those 'modules' optional and allow the end user choose which ones should be installed and how they should be configured. BitRock InstallBuilder's components make the task easier.

What is a Component?

You can think of a component as a 'black box' you use to simplify the way you build the installer. It is kind of a partial installer inside the primary installer that only applies to a subset of the software you are packaging (such as Apache, MySQL, etc). This makes it very easy to re-use pieces of your installer and add and remove them as necessary. You can bundle files within components and add rules, scripts, actions, variables or parameter pages (which are used to ask the user how they want to configure that piece of software). Various components are then bundled inside the primary installer to present end users with a complete package. If you are familiar with DRY (Do not Repeat Yourself) or KISS (Keep It Simple Stupid) terms, then InstallBuilder components will surely make you happy.