Page 1 of 1

IBM Notes Package

Published: June 18, 2015 - 1:56 PM
by Intern FGA
Good morning,

I need to create a package for an application that is not available in the official TIS repositories.
IBM Notes 9.0.1

I have two executables; the first cleanly uninstalls any version of Lotus Notes that might be installed on the client machine. The second installs IBM Notes 9.0.1.

I managed to create one package for uninstalling and another for installing separately, it works very well, but unfortunately it does not handle remote uninstallation, you have to alternate with the packages and it's not really a great technique.

So I end up with two packages, two scripts, completely independent.

Code: Select all

def install():
    print('Désinstallation de IBM Notes')
    run(r'"nice.exe" -rp -rd -wipe /qn+')

Code: Select all

def install():
    print('Installation de IBM Notes 9.0.1')
    run(r'"IBM_NOTES_CLIENT_9.0.1_WIN_FR.exe" -s -a /s /v"ADDFEATURES=NotesPlugin /qn+"')
I would like :
  1. Merge the two codes so that you can install or uninstall from the console using the dedicated button, instead of switching between two separate packages.
  2. When installing on a machine, check if Notes is already installed; if so, uninstall it first
  3. Knowing how to stop services and processes in Python.
I am not necessarily asking you to provide the code directly (that would be really nice, but I am not asking for that much), among the applications in the official repository, there must surely be an example using the same installation scheme to inspire me.

Having no knowledge of Python or any other language, it is very difficult for me to create a script without an example.

Thank you in advance.

Re: IBM Notes Package

Published: June 18, 2015 - 2:23 PM
by Frédéric Bonnier
Hello,

I think the LibreOffice package can help you: http://wapt.tranquil.it/wapt/tis-libreo ... 0_all.wapt.

It detects if OpenOffice is installed, and if so, it uninstalls it. The same goes for other versions of LibreOffice.

As a last resort, we organize WAPT training sessions. :D

- Frédéric

Re: IBM Notes Package

Published: June 19, 2015 - 10:34
by Intern FGA
Thank you, I was inspired by the LibreOffice suite to a lesser extent. Here is the code I created:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
import os

uninstallkey = []
uninstallstring = []

def install():
	if os.path.exists("C:\Program Files (x86)\IBM\Notes" or "C:\Program Files (x86)\IBM\Lotus\Notes"):
		print('Désinstallation des anciennes version de Notes')
		run(r'"IBM_Notes\nice.exe" -rp -rd -wipe /qn+')
		print('Installation de IBM Notes 9.0.1')
		run(r'"IBM_Notes\IBM_NOTES_CLIENT_9.0.1_WIN_FR.exe" -s -a /s /v"ADDFEATURES=NotesPlugin /qn+"')
	else:
		print('Installation de IBM Notes 9.0.1')
		run(r'"IBM_Notes\IBM_NOTES_CLIENT_9.0.1_WIN_FR.exe" -s -a /s /v"ADDFEATURES=NotesPlugin /qn+"')
I don't quite understand how uninstalling from the console works.
Notably
uninstallkey = []
uninstallstring = []

In the documentation, for uninstallstring it says "command line to launch the software uninstallation." So I quickly added:

Code: Select all

run(r'"IBM_Notes\IBM_NOTES_CLIENT_9.0.1_WIN_FR.exe" -s -a /s /v"ADDFEATURES=NotesPlugin /qn+"')
I tried it in brackets, but without success.

For uninstallkey = [], is it up to us to find the registry key that allows us to uninstall the software, or does WAPT handle retrieving it during installation? Because I've noticed that it's not often filled in, and the same goes for uninstallstring = [], which isn't always used.

Thank you for your time.

Re: IBM Notes Package

Published: June 24, 2015 - 3:33 PM
by Intern FGA
I managed on my own and eventually I understood how packages work, especially uninstallation using the registry.
Here is my script, perhaps it will be useful to others.

Code: Select all

# -*- coding: utf-8 -*-

from setuphelpers import *
import platform

uninstallkey = []

def uninstall():
	# liste des logiciels nommés notes
	notes = installed_softwares('notes')
	# si cette liste n'est pas vide, on desinstalle explicitement chaque logiciel
	if notes:
		# boucle pour chaque logiciel trouvé
		for uninstall in notes:
			# on regarde si la version 9 est installée
			if uninstall['version'].startswith('9.'):
				# on recupere la commande de desinstallation correspondant à la clé du logiciel
				cmd = WAPT.uninstall_cmd(uninstall['key'])
				print(u'uninstalling %s' % (uninstall['name'],))
				# on execute la commande de desinstallation
				run_notfatal(cmd)
				# on supprime les dossiers restants
				run_notfatal(r'rmdir "C:\Program Files (x86)\IBM" /s /q ')

def install():
	# liste des logiciels nommés notes
	old_notes = installed_softwares('notes')
	zipmail = installed_softwares('zipmail')
	swiftfile = installed_softwares('swiftfile')
	# si zipmail est installé on desinstalle explicitement chaque logiciel
	if zipmail:
		# boucle pour chaque logiciel trouvé
		for uninstall in zipmail:
			# on regarde si la version 12 est installée
			if uninstall['version'].startswith('12.'):
				# on recupere la commande de desinstallation correspondant à la clé du logiciel SwiftFile 4.2
				cmd = WAPT.uninstall_cmd(uninstall['key'])
				print(u'uninstalling %s' % (uninstall['name'],))
				# on execute la commande de desinstallation
				run_notfatal(cmd)
	# pour désinstaller les anciennes version de zipmail
	zipmail = installed_softwares('zipmail')
	if zipmail:
		print('Supression de Zipmail v10')
		run_notfatal(r'C:\Windows\IsUn040c.exe -a -x -f"c:\Program Files (x86)\IBM\Lotus\Notes\Data\zmlnl.isu" -c"C:\Program Files (x86)\IBM\Lotus\Notes\Uninst.dll')
	# si swiftfile est installé on desinstalle explicitement chaque logiciel
	if swiftfile:
		# boucle pour chaque logiciel trouvé
		for uninstall in swiftfile:
			# on regarde si la version 4.2 est installée
			if uninstall['version'].startswith('4.2'):
				# on recupere la commande de desinstallation correspondant à la clé du logiciel SwiftFile 4.2
				cmd = WAPT.uninstall_cmd(uninstall['key'])
				print(u'uninstalling %s' % (uninstall['name'],))
				# on execute la commande de desinstallation
				run_notfatal(cmd)
	# pour désinstaller les anciennes version de zipmail
	zipmail = installed_softwares('zipmail')
	if swiftfile:
		print('Supression de SwiftFile 4.00')
		run_notfatal(r'MsiExec.exe /qn /x {34843AB3-8DBA-4388-8838-080635E1EDB6}')
	# si notes est installé, on desinstalle explicitement chaque logiciel
	if old_notes:
		# boucle pour chaque logiciel trouvé
		for uninstall in old_notes:
			# on regarde si la version 8 est installée
			if uninstall['version'].startswith('8.'):
				print('Supression de Notes 8.x')
				run_notfatal(r'"nice.exe" -rp -rd -wipe /qn')
			if uninstall['version'].startswith('9.'):
				print('Supression de Notes 9.x')
				run_notfatal(r'"nice.exe" -rp -rd -wipe /qn')
			# on supprime les dossiers restants
			run_notfatal(r'rmdir "C:\Program Files (x86)\IBM" /s /q ')
	
	# on installe ibm notes
	print('Installation de IBM Notes 9.0.1')
	run_notfatal(r'"IBM_NOTES_CLIENT_9.0.1_WIN_FR.exe" -s -a /s /v"ADDFEATURES=NotesPlugin,ClientSingleLogon /qn+"')
ZipMail and SwftFile software are specific to the workstations on which our software is deployed; adapt the script according to your needs.