[RESOLVED] advanced *.exe install

Share here your tips or issues concerning WAPT Console or WAPT Agent / Venez ici partager vos problèmes et astuces concernants la console et l'agent WAPT
Règles du forum
* English support on www.reddit.com/r/wapt
* Le support en français se fait sur ce forum
* Afin de faciliter l'aide dans ce forum, merci de préciser dans vos posts les éléments suivants :
- Version de WAPT installée (1.3.9 / 1.3.13 / 1.5 / 1.6)
- OS du serveur (Linux / Windows)
- OS de la machine d'administration/création des paquets (Windows 7 / 10)
* Merci de préfixer le titre du thread par [RESOLU] si il est résolu.
Avatar de l’utilisateur
empbilly
Messages : 67
Inscription : 15 janv. 2018 - 20:59

25 avr. 2018 - 13:13

@htouvet,

Many thanks for all your help!!!

Below the final script version of full Installation and Uninstallation of the Miktex 2.9 software.

Code : Tout sélectionner

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

uninstallkey = []
destdir = makepath(programfiles,'MIKTEX')
startupdir = makepath(start_menu(1),"Programs","MiKTeX 2.9")

def install():
    print('Initializing installation of miktex.')
    mkdirs(destdir)
    install_exe_if_needed("basic-miktex-2.9.6643-x64.exe", timeout=2000, silentflags='--shared --unattended --common-install="%s"' % destdir)
    print('Installation OK!')
    try:
        print('Starting update miktex...')
        run(r'"%s"\miktex\bin\x64\mpm.exe --update --admin' % destdir, timeout=2000)
        print('Updated miktex OK!')
    except (RuntimeError, TypeError, NameError):
        raise

def uninstall():
    try:
        print('Starting miktex uninstall...')
        if iswin64():
            print('Uninstalling x64 version')
            run(r'"%s"\miktex\bin\x64\miktexsetup.exe --verbose --shared uninstall' % destdir, timeout=2000)
            remove_tree(destdir)
            print("%s" ' is removed successfully!' % destdir)
            remove_tree(startupdir)
            print("%s" ' is removed successfully!' % startupdir)
        else:
            print('Uninstalling x86 version')
            run(r'"%s"\miktex\bin\x64\miktexsetup.exe --verbose --shared uninstall' % destdir, timeout=2000)
            remove_tree(destdir)
            print("%s" ' is removed successfully!' % destdir)
            remove_tree(startupdir)
            print("%s" ' is removed successfully!' % startupdir)
        print('Uninstallation of miktex completed!')
    except (RuntimeError, TypeError, NameError):
        raise
Répondre