… 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
$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.
Here are the links:
NSIS at Wikipedia (http://en.wikipedia.org/wiki/Nullsoft_Scriptable_Install_System)
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)
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:
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: