Page 1 of 1
How to install software that is already installed?
Published: January 5, 2016 - 6:40 AM
by dominix
I already have a lot of software installed on my machines that Wapt offers.
However, Wapt doesn't offer to update them.
So here's something I'd like to know: how do I integrate the software that's already installed?
Thanks for your help, and Happy New Year 111110000 to all.
Re: How to install Wapit software?
Published: January 5, 2016 - 8:47 AM
by Floflobel
It all depends on your Python script. If you just install it, it will reinstall over the existing software even if it's already present.
You can add a condition so that if it's already present, it doesn't reinstall.
You can also play around with the version...
Re: How to install Wapit software?
Published: January 5, 2016 - 8:57 AM
by htouvet
Indeed, well-written packages test the already installed version and only perform post-configuration if the software is already present on the machine (functions install_exe_if_needed or install_msi_if_needed for example)
If the fleet is homogeneous (the PCs all have roughly the same software), then a group software package applied to all PCs will do the job.
Alternatively, one solution is to create a package that detects the software present and installs the corresponding WAPT package.
Then, updates are done via Wapt.
Example of a corresponding setup.py script:
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
softs = (
('adobe flash','tis-flash'),
('java update','tis-java'),
('irfanview','tis-irfanview'),
('7-zip','tis-7zip'),
('notepad++','tis-notepadplusplus'),
('mozilla firefox esr','tis-firefox-esr'),
)
def update_control(control):
import re
# replace description with list of keywords
control.description = re.sub('\(.*\)','(%s)'%(','.join([s for s,p in softs])),control.description)
def install():
for (keywords,package) in softs:
found = installed_softwares(keywords)
if found and not WAPT.is_installed(package):
print('%s %s installed, adding package'%(found[0]['name'],found[0]['version']))
WAPT.install(package)
Re: How to install Wapit software?
Published: January 5, 2016 - 9:44 AM
by Floflobel
Good morning,
A slightly off-topic question.
Does this printout correctly return the package name and version?
Code: Select all
print('%s %s installed, adding package'%(found[0]['name'],found[0]['version']))
WAPT.install(package)
Re: How to install Wapit software?
Published: January 5, 2016 - 12:08 PM
by htouvet
not quite
Code: Select all
print('%s %s installed, adding package'%(found[0]['name'],found[0]['version']))
WAPT.install(package)
displays the first software name found in the Windows registry that matches the keywords, not Wapt packages.
By the way, there's an indentation problem in my previous post.
It is :
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
softs = (
('adobe flash','tis-flash'),
('java update','tis-java'),
('irfanview','tis-irfanview'),
('7-zip','tis-7zip'),
('notepad++','tis-notepadplusplus'),
('mozilla firefox esr','tis-firefox-esr'),
)
def update_control(control):
import re
# replace description with list of keywords
control.description = re.sub('\(.*\)','(%s)'%(','.join([s for s,p in softs])),control.description)
def install():
for (keywords,package) in softs:
found = installed_softwares(keywords)
if found and not WAPT.is_installed(package):
print('%s %s installed, adding package'%(found[0]['name'],found[0]['version']))
WAPT.install(package)