[SOLVED] Overloading the remove() function

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
sebastien4444
Messages: 22
Registration: Sep 14, 2023 - 08:53

June 14, 2024 - 11:37

Good morning,

I created a package for installing Office 2019 via the officedeploymenttool and I am providing the uninstallation key in the parameters of the install_exe_if_needed() function.
The installation is OK, but when I run a remove command to uninstall, I get the following error:

Code: Select all

Command Line : remove "C:\waptdev\pilote-regtest_1.0_x64_Windows_PROD-wapt\WAPT\.."
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
Removing C:\waptdev\pilote-regtest_1.0_x64_Windows_PROD-wapt\WAPT\.. ...
2024-06-14 11:19:04,815 CRITICAL Critical error during uninstall: CalledProcessErrorOutput: Command ['"C:\\Program Files\\Common Files\\Microsoft Shared\\ClickToRun\\OfficeClickToRun.exe" scenario=install scenariosubtype=ARP sourcetype=None productstoremove=Standard2019Volume.16_fr-fr_x-none culture=fr-fr version.16=16.0'] returned non-zero exit status 1.
Output:La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte.
My first question is therefore: what exactly does this message mean? :?:

So, as a workaround, I created an uninstall.xml config file which allows the uninstallation of my version of Office, and during the installation, I will copy this file and the necessary setup.exe into an Office directory.
My idea is to override the remove() function to make it execute "setup.exe /configure uninstall.xml".
But here too I encounter a problem: I don't feel that my override is working when I run the config remove since I get the same error as above.

Here is my setup.py:

Code: Select all

from setuphelpers import *

def install():

    uninstall_key = "Standard2019Volume - fr-fr"
    office_path = makepath("C:","Program Files","Microsoft Office")
    office_uninstall_path = makepath("C:","Program Files","Microsoft Office","Uninstall")

    print("Debut")

    install_exe_if_needed("setup.exe", silentflags="/configure Install.xml", key=uninstall_key, timeout=None, min_version='')

    print('Install ok')

    mkdirs(office_uninstall_path)
    filecopyto("setup.exe",office_uninstall_path)
    filecopyto("Uninstall.xml",office_uninstall_path)

    print("Répertoire et fichiers desinstallation OK")

def remove():
    office_uninstall_path_setup = makepath("C:","Program Files","Microsoft Office","Uninstall","setup.exe")
    office_uninstall_path_config = makepath("C:","Program Files","Microsoft Office","Uninstall","Uninstall.xml")

    print('Debut uninstall')
    run(office_uninstall_path_setup + ' /configure ' + office_uninstall_path_config)

    print('uninstall OK')
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

June 14, 2024 - 12:45

Good morning

Since you left the key, Wapt is trying to uninstall it

Add the following to the end of your `def install()`:

Code: Select all

def install(): 
    ...
    uninstallkey.clear()
to tell Wapt not to try to uninstall automatically.
Locked