Page 1 of 2
Empty package to uninstall an application
Published: March 22, 2018 - 09:44
by benoitpatin
Good morning,
- Installed WAPT version: 1.5.1.18 Community
- Linux Debian 9 server OS
- Operating system of the administration/package creation machine: Windows 10
I would like to create a source-free package with just one command to uninstall a program on my computers.
I do not have the original source code for the application.
Using the command wapt-get list-registry software_name I am able to retrieve the Uninstallstring and the uninstallkey on a target machine.
So I foolishly created an empty package with the given information:
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = ['Foxit Reader_is1']
def uninstall():
print('uninstalling Foxit Reader')
run(r'"C:\Program Files (x86)\Foxit Software\Foxit Reader\unins000.exe"')
But it doesn't seem to be working properly. Since this is my second package, I think I'm missing a couple of things to get it right.
Is there anyone who can help me?
THANKS
Re: Empty package to uninstall an application
Published: March 22, 2018 - 10:03
by agauvrit
Hello Benoît,
The function
uninstall This allows you to uninstall software deployed with WAPT. If you want to uninstall software directly, you must write this code in the function
install from the package.
If you want to uninstall software in all possible versions, it's best to use a function like this:
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
def install():
for soft in installed_softwares('Foxit Reader'):
if Version(soft['version']) < Version('18'):
run(WAPT.uninstall_cmd(soft['key']))
Re: Empty package to uninstall an application
Published: March 22, 2018 - 2:17 PM
by benoitpatin
Great, the quick response!
However, I need some clarification...
Code: Select all
def install():
for soft in installed_softwares('Foxit Reader'):
if Version(soft['version']) < Version('18'):
run(WAPT.uninstall_cmd(soft['key']))
The word "version" between a single quote and a bracket should correspond to the version in my Add/Remove Programs?
What should the word "key" between a single quote and a square bracket correspond to? The uninstallkey or the uninstallstring?
Re: Empty package to uninstall an application
Published: March 22, 2018 - 2:46 PM
by sfonteneau
benoitpatin wrote: ↑March 22, 2018 - 2:17 PM
Does the word "version" between a single quote and a bracket refer to the version in my Add/Remove Programs?
Yes
benoitpatin wrote: ↑March 22, 2018 - 2:17 PM
What should the word "key" between a single quote and a square bracket refer to? The uninstallkey or the uninstallstring?
The word 'key' should not be replaced; we will retrieve the 'key' value from the `uninstallkey` currently being tested
Re: Empty package to uninstall an application
Published: March 22, 2018 - 2:57 PM
by benoitpatin
Okay, great, here is min setup.py:
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = ['Foxit Reader_is1']
def install():
print('uninstalling Foxit Reader')
for soft in installed_softwares('Foxit Reader'):
if Version(soft['version']) < Version('8.2.1.6871'):
run(WAPT.uninstall_cmd(soft['key']))
I build, I upload, I launch the package on my machine but nothing happens.
I haven't made any mistakes anywhere. Did I miss something?
Re: Empty package to uninstall an application
Published: March 22, 2018 - 3:17 PM
by sfonteneau
I don't see any errors in your code.
On the machine you are testing on.
Can you run a:
to see what happens
Re: Empty package to uninstall an application
Published: March 22, 2018 - 3:18 PM
by agauvrit
To see the list of potentially affected software:
Code: Select all
wapt-get list-registry Foxit Reader
If the software does not appear, it will not be uninstalled; you may need to use only "Foxit" as a search keyword
Alexander
Re: Empty package to uninstall an application
Published: March 22, 2018 - 3:22 PM
by benoitpatin
Code: Select all
UninstallKey Software Version Uninstallstring
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Foxit Reader_is1 Foxit Reader 8.2.1.6871 "C:\Program Files (x86)\Foxit Software\Foxit Reader\unins000.exe"
Re: Empty package to uninstall an application
Published: March 22, 2018 - 3:27 PM
by agauvrit
the returned version is equal to the version imposed in the version test (8.2.1.6871) so it is not uninstalled.
To be more "brute forceful," you can write the complete uninstallation of all possible versions like this:
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = ['Foxit Reader_is1']
def install():
print('uninstalling Foxit Reader')
for soft in installed_softwares('Foxit Reader'):
run(WAPT.uninstall_cmd(soft['key']))
Re: Empty package to uninstall an application
Published: March 22, 2018 - 5:32 PM
by benoitpatin
It's not working and I don't see any error message anywhere (at the same time, maybe there isn't one...an error!).
How can I troubleshoot?