Questo è un server WAPT Enterprise 2.5.4, versione 15342
Su un server CentOS 7 con client Windows 10 22H2
È possibile modificare il file setup.py predefinito?
Questo è il tipo di modello che vorrei:
Codice: Seleziona tutto
# -*- 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)
