Software installer

From Inforail
Jump to: navigation, search

Before one can use your program, they have to install it. Some applications are "portable" and they can be used by simply running the main executable. However, in most cases the software requires more than that (ex: create new user accounts, set up a new database, open a port, etc) - those actions are performed by the installer.


Keywords

installer, MSI, WiX, RPM, DEB, update, remove, web-based installers

Objectives

  • Familiarize yourself with MSI and WiX, understand how to create a basic installer for an application.
  • If Windows is not your platform of choice,
    • build a DEB or an RPM package to distribute your software;
    • OR use a virtual machine with Windows for your magic.
  • As a test subject, if you have no program to experiment with, build an installer for the Winfortune
    • The screencasts walk you through the development process, the resulting files can be found in the last videos
    • This project is also available on github, feel free to tinker with it.

Overview

  • The installer will copy your binaries to the 'Program Files' directory
  • Create shortcuts in the 'Start' menu
  • The installer must also be able to remove the program, if people choose to do so; no traces of the program will be left in the system, unless a user-defined setting allows that (ex: "leave my databases intact")

Requirements

  • You must use WiX to build your MSI, not a GUI tool that generates MSIs for you (ex: Advanced Installer)
  • Per-user files (ex: configuration, templates, etc) must be kept in user directories, not in the program's folder

Generally, the requirements are defined by your system. If it requires registry entries, the presence of certain modules, etc - it should take care of all of that.


Grading policy

Assuming that everything works right,

  • 7 - make an installer that implements the basic requirements;
  • 8 - make a multi-lingual installer;
  • 9 - make an installer that can distinguish between x86 and x64 platforms, and behave differently (ex: copy different files to different locations), depending on the platform;
  • 10 - customize the installer in such a way that at least one of the points below is true
    • it takes a minimal number of clicks to get the program installed
    • the installer's interface is just one screen with a large photo or logo of the program
    • the installation progress bar is on the same screen as the start page, just under the picture.

Notes

Shortcuts

An easy way to get things done is to use a GUI tool such as Advanced Installer, then reverse engineer it and see how things were done, then do it yourself with WiX.

Web based applications

A case in which things begin to not make sense is if you are building a web-based application. If that applies to you, take this into consideration.

You must write an installation script that will conduct the following operations:

  • create a database and the necessary tables;
  • create users for the web-based system;
  • conduct a few security checks and verify the access permissions for the system's files (to make sure they cannot be overwritten or downloaded by evil people);
  • change the ACLs such that the system is secure;
  • verify if all the needed components are there (ex: it may require a certain PHP version, or the presence of a library such as ImageMagick or GDLib);
  • propose the user to install the missing components (or at least make a list of them and provide instructions on how to install them).

The installation script will be used by the server's administrator in order to set up the system (i.e. it is not for end users who will be using the services of said system).


Linux installers

Consider creating a DEB or RPM for the "Web based applications" scenario, though any other program will do, as long as you take into account the following aspects:

  • software dependencies (other software, specific versions, etc)
  • creation of config files
    • the config file must have an option called jubric, set to the value jvompiha by default
    • however, the installer will ask you to input a value for this option, so people can override it
      • the prompt must be graphical (a text-mode prompt will do), people will be shown an edit field with the explanation Set the value of `jubric` for optimal jubrication
      • this can be done with something like ncurses,or urwid
    • the next version of the program will detect the presence of an earlier one and:
      • set jubric to trubosaur, if it was set to jvompiha (it turns out that trubosaurs are more efficient that jvompihas)
      • otherwise, if it was customized, leave it intact
  • creating a user for your software (if it is a daemon; like `www-data` for Apache)
    • adjusting file permissions accordingly



References