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.
download the exe installer from a reliable source;
Download the installer in exe format (for example: Firefox ESR x64):
look up documentation relating to silent flags;
On the Official Mozilla website;
other methods for finding information on silent flags:
search on the Internet with the search terms: Firefox silent install;
Creating a base template from the .exe file¶
start up a Windows Command Line utility cmd.exe 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.
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
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.