[SOLVED] uninstall function def

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
JPBUTT
Messages: 8
Registration: March 1, 2021 - 3:36 PM

October 10, 2023 - 3:21 PM

Hello,
I'm trying to understand how the `uninstall` function works.
How does the package retrieve the script defined in `uninstall`
if an executable or registry key is defined in the function where it's stored? Because when uninstalling from a package using the console, it doesn't redownload the package.
I tried using the WAPT self-service without logging in, and the package uninstalls correctly.
If you have any information to share,

thank you
Benoit
Messages: 43
Registration: June 26, 2023 - 11:52
Location: Tarbes

October 12, 2023 - 09:09

Good morning,

There are no specific functions for uninstallation in all packages.

Depending on what you want to uninstall, the method will be different.

For example, to uninstall an executable, you will find an uninstallation key in the wapt console after installing your software.
This uninstallation key corresponds to a registry key that you can find in regedit.
Within this registry key, you will find an 'uninstallstring' line which will point to the uninstallation command. There is a function called 'uninstall_cmd()' in the setuphelpers module that allows you to use this uninstallation key.
Picture

But this doesn't always work. Sometimes it's necessary to run the uninstallation command directly within the script using a subprocess.

Code: Select all

command = 'MsiExec.exe /X{00000022-9040-3CA8-8868-36F59DEFD14D} /qn'

def uninstall():
    # Exécute la commande de désinstallation
    subprocess.run(command, shell=True)
    print(name_software+" a été désinstallé")
To uninstall a portable application, you will need to delete the entire folder and desktop shortcuts.

I hope this has helped you.

Regards,
Attachments
Captureregedit.PNG
Captureregedit.PNG (51.45 KB) Viewed 3726 times
JPBUTT
Messages: 8
Registration: March 1, 2021 - 3:36 PM

October 12, 2023 - 4:27 PM

Hello,
thank you for your feedback, but my question was:
How and when is the scrypt uninstall def executed?

For example, if it's in an uninstallation script with an uninstall file, then registry keys, and a folder deletion
? Where is this stored?
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

October 12, 2023 - 5:38 PM

Hello Jean-Philippe,

the setup.py script is stored in the local SQLite database of the WAPT service (c:\program files (x86)\wapt\db\waptdb.sqlite).

The installation package is not retained after installation (otherwise it would consume too much space).

Therefore, if you have resources needed for uninstallation, you need to store them somewhere where they can be retrieved during uninstallation (either a "persistent" directory or the application's own directory).

Regards,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
JPBUTT
Messages: 8
Registration: March 1, 2021 - 3:36 PM

October 13, 2023 - 11:13

Hello,
thank you for your feedback.
I understand better now how it works.
Locked