Attention : support for WAPT 1.8.2 ended on June the 30th 2022.

There are known vulnerabilities in WAPT dependencies in WAPT 1.8.2 branch. Please upgrade to the latest supported version. CVE listing (non exhaustive) :
  • * python engine : python 2.7 (CVE-2020-10735, CVE-2015-20107, CVE-2022-0391, CVE-2021-23336, CVE-2021-3177, CVE-2020-27619, CVE-2020-26116, CVE-2019-20907, CVE-2020-8492, etc.)
  • * cryptography : openssl : CVE-2022-2068, CVE-2022-1292, CVE-2022-0778, CVE-2021-4160, CVE-2021-3712, CVE-2021-23841, CVE-2021-23840, CVE-2021-23839, CVE-2020-1971, CVE-2020-1968, CVE-2019-1551
  • * python dependencies : cryptography (CVE-2020-36242, CVE-2020-25659), eventlet (CVE-2021-21419), jinja2 (CVE-2020-28493), psutil (CVE-2019-18874), waitress (CVE-2022-31015), lxml (CVE-2021-4381, CVE-2021-28957, CVE-2020-27783, CVE-2018-19787), ujson (CVE-2022-31117, CVE-2022-31116, CVE-2021-45958), python-ldap (CVE-2021-46823)

Packaging simple .exe package

Note

Variation compared to MSI

WAPT prefers MSI installers because most .exe are not standardized and silent arguments can be different from one piece of software to another.

Hint

Since WAPT version 1.3.12, a new method for quickly building WAPT packages from the WAPT console has been made available.

This part of the documentation is still actual, we recommend however that you use the WAPT console to instantiate your package templates, see Creating a package template from the WAPT console.

Creating a base template from the .exe file

Launching the Windows Command Line utility as Local Administrator

Launching the Windows Command Line utility as Local Administrator

  • create a WAPT package template;

    wapt-get make-template <chemin_exe> <nom_du_paquet>
    

    Example with Mozilla Firefox ESR:

    wapt-get make-template "Firefox Setup 52.6.0esr.exe" "tis-firefox-esr"
    
    Template created. You can build the WAPT package by launching
      C:\Program Files (x86)\wapt\wapt-get.exe build-package C:\waptdev\tis-firefox-esr-wapt
    You can build and upload the WAPT package by launching
      C:\Program Files (x86)\wapt\wapt-get.exe build-upload C:\waptdev\tis-firefox-esr-wapt
    

    PyScripter loads up and opens open the .exe package project.

    PyScripter opening with focus on the *control* file

    PyScripter opening with focus on the control file

  • check the control file content;

    Mozilla Firefox-ESR does not comply to industry standards and returns an erroneous version number (it appears to be the installer packaging software version number).

    Original control file

    package           : tis-firefox-esr
    version           : 4.42.0.0-0
    architecture      : all
    section           : base
    priority          : optional
    maintainer        : user
    description       : automatic package for firefox setup 52.6.0esr
    

    Modified control file

    package           : tis-firefox-esr
    version           : 52.6.0-1
    architecture      : all
    section           : base
    priority          : optional
    maintainer        : Tranquil-IT Systems
    description       : Mozilla Firefox 52.6.0 ESR
    

    Note

    It is to be noted that a sub-version -1 has been added. It is the packaging version of WAPT package.

    It allows the Package Developer to release several WAPT package versions of the same software.

  • check the setup.py file;

    WAPT has added a generic silent /VERYSILENT flag that may or may not work with Mozilla Firefox ESR.

    In that case, we will replace the suggested silent flag with the one that we found in the Mozilla documentation.

  • make changes to the code in the setup.py file accordingly;

    :emphasize-lines: 8
    # -*- coding: utf-8 -*-
    from setuphelpers import *
    
    uninstallkey = []
    
    def install():
        print('installing tis-firefox-esr')
        run(r'"Firefox Setup 52.6.0esr.exe" -ms')
    
  • save the package;

Managing the uninstallation

With an exe installer, the uninstall key is not available until the software has been installed once.

The uninstall key is available in the Windows registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

or on 64bits systems

HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall
  • open a Windows Command Line cmd.exe prompt;

  • retrieve the software uninstall key with wapt-get list-registry firefox

UninstallKey                          Software                               Version            Uninstallstring
------------------------------------- -------------------------------------- ------------------ ------------------------------------------------------
Mozilla Firefox 52.6.0 ESR (x64 fr)   Mozilla Firefox 52.6.0 ESR (x64 fr)    52.6.0             "C:\Program Files\Mozilla Firefox\uninstall\helper.exe"
  • copy the uninstall key UninstallKey: Mozilla Firefox 45.4.0 ESR (x64 en);

  • make changes to the setup.py file with the correct uninstall key;

:emphasize-lines: 4

# -*- coding: utf-8 -*-
from setuphelpers import *

uninstallkey = ['Mozilla Firefox 52.6.0 ESR (x64 fr)']

def install():
    print('installing tis-firefox-esr')
    run(r'"Firefox Setup 52.6.0esr.exe" -ms')

Note

The UninstallKey must be the exact same as the one listed with list-registry command. The UninstallKey may be a GUID such as 95160000-0052-040C-0000-0000000FF1CE, a GUID with bracketed characters, {95160000-0052-040C-0000-0000000FF1CE}, or simply a character string such as Git_is1 or Mozilla Firefox 52.6.0 ESR (x64 fr).

  • relaunch the package setup to set the correct uninstall key in the local WAPT database;

  • test uninstalling the package;

  • launch a remove from PyScripter Run Configurations;

    After uninstallation, the software is correctly removed

    After uninstallation, the software is correctly removed

    We can notice the correct uninstallation by launching again the wapt-get list-registry command.

    UninstallKey          Software          Version            Uninstallstring
    --------------------- ----------------- ------------------ ---------------
    --------------------- ----------------- ------------------ ---------------
    

Specific case of a non-silent uninstaller

It sometimes occurs that the software installs silently, but does not uninstall silently.

In that precise case it is necessary to override the uninstall() function.

Example with Mozilla Firefox:

# -*- coding: utf-8 -*-
from setuphelpers import *

uninstallkey = ['Mozilla Firefox 52.6.0 ESR (x64 fr)']

def install():
    print('installing tis-firefox-esr')
    run(r'"Firefox Setup 52.6.0esr.exe" -ms')

def uninstall():
    print('uninstalling tis-firefox-esr')
    run(r'"C:\Program Files\Mozilla Firefox\uninstall\helper.exe" -ms')

Hint

In the uninstall() function, it is not possible to call for files included inside the WAPT package. To call files from the package, it is necessary to copy/ paste the files in a temporary directory during package installation.

Build and upload the package

Once the installation and the de-installation are configured and tested and the package is customized to your satisfaction, you may build and upload your new WAPT package onto your WAPT repository.