[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
* Questions can be asked in English or in French. If the thread is started in English, stick to English, if it is started in French, stick to French.
* Vous pouvez poser vos questions en Français ou en Anglais. Si un sujet est commencé en français, merci de répondre en français. Si un sujet est commencé en anglais, merci de répondre en anglais.
Avatar de l’utilisateur
empbilly
Messages : 66
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