Microsoft Windows users love setup files …

… and I used to love them too. Nowadays, Linux is my favorite operating and development system, but most users of my RCP application “OpenChrom” are still using Microsoft Windows. That’s why I searched for a way to offer a nice installer/uninstaller without confusing them with sentences like “Just download, unzip and execute the application.” or other statements. Nooope, they’d like to have a good old installer. And they’ll get it. Arrggh, but I don’t want to switch to Microsoft Windows only to compile the setup executables. Good news, I don’t need to. It works also under Linux utilizing NSIS (nullsoft scriptable install system) and really, NSIS is marvelous!

The screenshots are in german, but I’m sure you’ll get the point.

Let me show you how to install a build process using “Ubuntu Linux 10.04“. It works both on the “Desktop” as well on the “Server Edition”. First of all, let’s install the NSIS package (version 2.46).

$sudo aptitude install nsis

Sometimes, we do need the zip package too. Zack, install it.

$sudo aptitude install zip

NSIS works now, but RCP applications aren’t working without an existing JRE. That’s why NSIS can be enriched by further plug-ins to make automatic JRE checks whilst installing the RCP application.

For this purpose we need the plug-ins “InetLoad

$wget http://nsis.sourceforge.net/mediawiki/images/b/b4/InetLoad.zip
$unzip InetLoad.zip
$sudo cp InetLoad.dll /usr/share/nsis/Plugins/
$sudo chown root:root /usr/share/nsis/Plugins/InetLoad.dll

and “JREDyna“.

$wget http://nsis.sourceforge.net/mediawiki/images/5/5f/JREDyna.zip
$unzip JREDyna.zip
$sudo cp JREDyna.nsh /usr/share/nsis/Include/
$sudo chown root:root /usr/share/nsis/Include/JREDyna.nsh

Ok, done. But there’s one problem left. How to delete application specific files of users we don’t actually know? Again, plug-ins are the solution. There’s a NSIS plug-in called “NT Profile Paths” to detect all user profiles whilst uninstalling the system. Copy the “NTProfiles.nsh” to your home folder.

$sudo cp NTProfiles.nsh /usr/share/nsis/Include/
$sudo chown root:root /usr/share/nsis/Include/NTProfiles.nsh

That’s it. NSIS scripts can be now compiled using the command line. Save the script “setup.nsi” for example in your home folder.

# Example script
Name "RCP Application Setup"
OutFile "setup.exe"
Section
MessageBox MB_OK "NSIS is cool!"
SectionEnd

Compile it using the following command.

$makensis setup.nsi

Here are the links:

NSIS (http://nsis.sourceforge.net)
NSIS at Wikipedia (http://en.wikipedia.org/wiki/Nullsoft_Scriptable_Install_System)
InetLoad (http://nsis.sourceforge.net/InetLoad_plug-in)
JREDyna – Java Runtime Environment Dynamic Installer (http://nsis.sourceforge.net/Java_Runtime_Environment_Dynamic_Installer)
NT Profile Paths (http://nsis.sourceforge.net/NT_Profile_Paths)
Ubuntu (http://www.ubuntu.com)

Appendix:

It would be too much to discuss all NSIS directives here, but the setup file of OpenChrom is a good example to have a look at the features of NSIS:
setup_openchrom_x86.nsi

Anyhow, OpenChrom needs further files to be ready for compilation. The project specific header files are stored in the graphics package NSIS relative to the setup_openchrom_x86.nsi script. All other NSIS icons are stored in “/usr/share/nsis/Contrib/Graphics/Icons/”.

The resulting executable can be downloaded here:
openchrom_0.4.0-PREV_x86_win32-setup.exe

About Philip Wenig

Founder of OpenChrom
This entry was posted in Uncategorized. Bookmark the permalink.

6 Responses to Microsoft Windows users love setup files …

  1. An installer… you know, a lot if not all Linux distros already have one. rpm, deb, yum, etcetera etcetera. Why not just package your product and use the installers that exist? They already have a frontend, different ones even, most of them can be driven from the command line and almost all of them have an established infrastructure behind them including the use of security.

    In all my years in the Linux environment I almost never see people using NSIS. And system administrators tend to hate installers that need to be point-and-clicked… for numerous reasons. I think that this will hold your application back and will slow down adoption of it.

  2. Manuel says:

    I am successfully using http://izpack.org/ for the same purpose.

  3. You actually make it appear so easy along with your presentation but I find this matter to be actually one thing which I feel I might never understand. It seems too complex and very huge for me. I am looking ahead for your subsequent post, I will try to get the cling of it!

    • eselmeister says:

      The installer is as easy as it is shown for end users. Just execute the setup and proceed with the installation. The steps described to build such a setup.exe are indeed a bit more complicated, especially when you’ll try to compile a Windows setup executable on a Linux operating system. Once the setup build process works, the process don’t need to be changed drastically. Finally, the complexity to install an RCP application is thereby hidden using the setup executable. I hope, that answers your questions well.

Leave a comment