bii internals: How to do your own Windows Installer

As a continuation of the previous post, which introduces the way in which installers for several systems are automatically generated, we will discuss now the solution adopted for windows.
The main tool used for packaging and installing the client binaries for Windows is the popular Inno Setup program. This tool is completely free of charge and supports almost every windows release since 2000.

Installators are created by means of scripts, which are ASCII text files with an “.iss” extension. The concept is quite similar to the distribution definition file described for MacOS.
The script file controls every aspect of the installation.  It specifies which files have to be installed and where, what short-cuts have to be created and what are they in order to be named, and so on. It ‘s arranged into sections and each section controls a different part of the installation.
A quite simple and small script could be the next one:

The script could have a lot of different sections that allow almost all the operations required for a correct installation and uninstallation in windows systems. It includes a integrated Pascal scripting engine for advanced run-time customization. For example, we use that section to make a nice uninstalling and to modify the register in an intelligent way, avoiding unnecessary register operations.

As it’s done in MacOS installers, in our automation repo we have prepared  a resource file that contains all the files used by the script (images, icons, text files, and the script itself) :

Before calling the external tool (InnoSetup) all the required files (installer resources and biicode binaries) are copied into a temporal folder. The main python script that automates the process is executed in a windows virtual machine in which InnoSetup is installed. In order to avoid the hard-coding of the external command  we are retreiving that info through a registry request for both, win32 and win64:

 

Finally, an important but simple pre-build step: we update the version info through a simple but effective search and replace text operation, looking for a key string included into the script and the text documents.

As you can see, a product executable has been created and renamed as “bii-setup” and placed in a convenient directory for publishing.
The InnoSetup tool creates a wonderful installer with a brief and simple script file:

Biicode Wizard Windows

Hope you enjoy installing!

Stay tuned


Related Posts