How to create a gvSIG installer with installjammer
A quick howto prepared in the process of creating the gvSIG 2.0 installer using installjammer:
- Download last final version of installjammer (http://www.installjammer.com/. While creating this document the last final version available was the 1.2.15 one, but it had a bug with link files, so we have used an hourly build of the 1.2 branch.
- Run installjammer and click on the new installer icon.
- Go through the wizard options filling the required information. Of special interest for gvSIG:
- Theme selection: Modern Wizard
- Platforms: Linux X86, Linux X86 64 and Windows. (tar and zip ones kill installjammer when building)
- Additional features: all checked but the "Allow users to select custom components in your install", as that will be managed through the gvSIG own installer.
- Add files to install.
- Create a file group for the common files non platform dependent, called gvSIG base. Add to it the product directory, checking everything but the platform dependent files and the plugins that won't be installed in the minimal installation.
Add to it also the $HOME/.depman/data folder to be copied to the root installation folder.
- Create a file group for each supported platform (linux, windows, etc.). Add to them the product and $HOME/.depman/lib and bin folders and select only the files or folders of each platform
When you add a folder or file to a group, InstallJammer stores the absolute path. That would make a bit difficult to share the installer configuration. To solve it, Virtual Text variables can be used:
- Add a %BaseDir% Virtual Text variable pointing to your gvSIG installation. Then, for each product folder added in the file groups, edit the *Location* property and set it to *<%BaseDir%>*.
- Add three more variables to point to the *data*, *lib* and *bin* folders too, called:
- BaseNativeLibsDir: path to the $HOME/.depman folder.
- Lini386NativeLibsDir: path to the $HOME/.depman/lib folder.
- Wini386NativeLibsDir: path to the $HOME/.depman/bin folder.
- Add license panel:
#. Open *Install Panes and Actions > Standard Install*
#. After the *Welcome screen* add a *License agreement* pane.
#. By default the license must be written in the configuration pane options. To read the license from a file, add a *Execute script* after the pane, with *Execute action = Before pane is displayed* and the tcl script::
set file [::InstallAPI::FindObjects -alias "ProgramLicense"]
set file [$file srcfile]
::InstallAPI::SetVirtualText -virtualtext LicenseText -value [read_file $file]
#. The file with the license contents must be updated with the alias *ProgramLicense*. Go to *Groups and files*, look for the license file *LICENSE.txt* and into the properties update the *Alias* field.
- Find java executable while installing:
#. Create an action group called *Find Java Actions*, with the same name in its alias property (very important or it won't be shown when called from a pane action).
#. Add a *Locate Java Runtime* action to the group and set the *Minimum Version* property to *1.5*.
#. Add a *Message Box* action to the group to be shown when the java executable is not found. Set the properties:
- Icon: error
- VirtualTextField: JavaNotFound
- Message: <%JavaNotFound%>
- Add a condition of type *String is Condition* with the properties:
- Operator: false
- String: <%JavaFound%>
#. Add a *Exit* action to the group to exit the installer after the previous message box is shown if the java executable is not found. Set properties:
- Exit code: -1
- Add a condition of type *String is Condition* with the properties:
- Operator: false
- String: <%JavaFound%>
#. Add a *Execute Action* to the *Welcome Screen* pane with the properties:
- Alias: Find Java
- Action: Find Java Actions
- Replace variables in the gvSIG linux launcher (gvSIG.sh):
#. Add a *Replace Text In File* action into the *Copying files* pane, just after the *Install Everything* one.
#. Configure the added action with the properties:
- Files: gvSIG.sh
- String Map::
"JAVA_HOME=${JAVA_HOME}" "JAVA_HOME='<%JavaHome%>'"
"GVSIG_HOME=`pwd`" "GVSIG_HOME='<%InstallDir%>'"
- Launch the gvSIG add-ons installer before the installation process end:
#. Add a Custom Text Pane 1. To internationalize the text properties, save the project and look for the stored values in the *.mpi* file. It will be something like::
54A9E67A-F932-CDD4-6F9A-8842AAE31ACC,Title
Add the properties to be translated to the msg files located in *build/projects/gvsig-standard/gvsig-standard-installer/src/main/installjammer*
#. Add a new Action group called *Install addons actions*, with the same value for the *Alias* property.
#. Add to the group an action to launch the Addons manager in linux (or other non windows OS), using a *Execute External Program* action with the properties:
- Alias: Launch addons manager not windows
- Console title: <%AppName%> add-ons manager
- Program command line: <%ProgramExecutable%> --install --installURL=http://gvsig-desktop.forge.osor.eu/gvSIG-desktop/dists/<%Version%>/packages.gvspki language=<%Language%>
- Working Directory: <%InstallDir%>
- Add a condition of type *Platform Condition* so it is launched only in non windows OSs, with the properties:
- Operator: is not
- Platform: Windows
#. Add to the group an action to launch the Addons manager in windows, using a *Execute External Program* action with the properties:
- Alias: Launch addons manager windows
- Console title: <%AppName%> add-ons manager
- Program command line: <%InstallDir%>/gvsig-package-installer.exe --install --installURL=http://gvsig-desktop.forge.osor.eu/gvSIG-desktop/dists/<%Version%>/packages.gvspki language=<%Language%>
- Working Directory: <%InstallDir%>
- Add a condition of type *Platform Condition* so it is launched only in windows, with the properties:
- Operator: is
- Platform: Windows
#. Add a *Execute Action* to the *Welcome Screen* pane with the properties:
- Alias: Install addons
- Execute action: before next pane is displayed
- Action: Install addons actions
- Add support to show the README contents in Spanish of English. By default installjammer configures the project to show the contents of only one file. To add this support is easy:
#. Add a README panel with the Spanish contents by creating a copy (Copy and then Paste) of the *View Readme Window* action into the *Finish actions* group. Rename it to *View Leeme Window* and set the properties:
- Text File: <%InstallDir%>/LEEME.txt
- Add a condition so it only runs in Spanish, of type *String Match Condition* with the properties:
- Match Case: No
- Operator: matches
- Pattern: es*
- String: <%Language%>
- Change the *File Exists Condition* property:
- Filename: <%InstallDir%>/LEEME.txt
#. Add a condition to the *View Readme Window* action so it only runs in non Spanish languages, of type *String Match Condition* with the properties:
- Match Case: No
- Operator: does not match
- Pattern: es*
- String: <%Language%>