Il s'agit d'un serveur WAPT entreprise 2.5.4 15342
Sur serveur Centos 7 avec des clients Windows 10 22H2
Est-il possible de modifier le setup.py par défaut ?
Voila le genre de template que j'aimerai :
Code : Tout sélectionner
# -*- coding: utf-8 -*-
from setuphelpers import *
r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()
"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
import collections
import os
def count_lines(filename, maxlines=10):
with open(filename, 'r') as file:
lines = file.readlines()
ilines = len(lines)
if 0 < ilines < maxlines:
return ilines
elif ilines > maxlines:
return maxlines
else:
return 0
def read_last_n_lines(filename, n=10):
with open(filename, 'r') as file:
lines = collections.deque(file, n)
return list(lines)
# -------- A modifier --------
progName = 'Test'
setupExe = 'Setup_TEST.exe'
UninstallExePath='C:\\MESAPPLIS\\TEST\\unins000.exe'
UninstallRegKey='704E94B1-8A91-4728-B343-33B4EAC1031A_is1'
logfile = 'C:\\MESLOGS\\WAPT_Setup_TEST.LOG'
unins_logfile = 'C:\\MESLOGS\\Uninstall_TEST.LOG'
def install():
# Declaring local variables
# Installing the software
print("Installing: " + progName)
install_exe_if_needed(setupExe,
silentflags='/VERYSILENT /LOG=' + logfile,
key=UninstallRegKey
)
if os.path.exists(logfile):
nbLines = count_lines(logfile)
if nbLines > 0:
for line in read_last_n_lines(logfile, nbLines):
print(line.strip())
else:
print('no log found')
def uninstall():
run(UninstallExePath + ' /VERYSILENT /LOG=' + unins_logfile)