tis-java8 8.144-1

  • package : tis-java8
  • version : 8.144-1
  • description : Java JRE 32 et 64 bits, ferme IE, FF, TB avant install, Désactive mises à jour auto, Ne marche pas avec Windows XP
  • maintainer : TIS <technique@tranquil-it-systems.fr>
  • date : 2017-09-13 10:20:36
  • signer : TRANQUIL IT SYSTEMS
  • signature_date : 20170913-102034
  • min_os_version :
  • min_wapt_version :

setup.py

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

uninstallkey = []


def install():
    # if you want to modify the keys depending on environment (win32/win64... params..)
    if windows_version()<=Version('5.1'):
        # plus compatible avec windows XP
        prefix = control.package.split('-')[0]
        WAPT.install('%s-java8-xp'%prefix)
    else:
        allmsi = glob.glob('*.msi')
        for msi in allmsi :
            java_version = get_msi_properties(msi)['ProductVersion']
            print ('Installation de Java version : ' + java_version)
            break

        print('Checking old java 8...')
        old_java8 = installed_softwares('{26A24AE4-039D-4CA4-87B4')
        for uninstall in old_java8:
            if Version(uninstall['version'].split('.',1)[0]) == Version(java_version.split('.',1)[0]) :
                if Version(uninstall['version']) < Version(java_version):
                    killalltasks(['firefox.exe','chrome.exe','iexplore.exe','jushed.exe'])
                    print('Removing %s'%uninstall['name'])
                    cmd = uninstall_cmd(uninstall['key'])
                    print run_notfatal(cmd)

        for msi in allmsi :
            if '(64-bit)' in get_msi_properties(msi)['ProductName'] :
                if iswin64():
                    install_msi_if_needed(msi,killbefore=['iexplore.exe','jushed.exe'])
            else:
                install_msi_if_needed(msi,killbefore=['iexplore.exe','jushed.exe'])

        print("desactivation des mises a jour automatiques")
        if iswin64():
            key=reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy',sam=KEY_WRITE,create_if_missing=True)
            reg_setvalue(key,'EnableJavaUpdate',0,REG_DWORD)
        else:
            key=reg_openkey_noredir(HKEY_LOCAL_MACHINE,r'SOFTWARE\JavaSoft\Java Update\Policy',sam=KEY_WRITE,create_if_missing=True)
            reg_setvalue(key,'EnableJavaUpdate',0,REG_DWORD)

def uninstall():
    # if you want to modify the keys depending on environment (win32/win64... params..)
    if Version(platform.win32_ver()[1])<=Version('5.1'):
        # plus compatible avec windows XP
        prefix = control.package.split('-')[0]
        WAPT.remove('%s-java8-xp'%prefix)


def sendmessagebox(msg,title,boxtype=4096):
    import win32ui
    titlebox = title.decode('utf-8','ignore').encode('cp1252','ignore')
    txt=msg.decode('utf-8','ignore').encode('cp1252','ignore')
    resultask = win32ui.MessageBox(txt, titlebox, boxtype)


def update_sources():

    import requests,BeautifulSoup
    page = requests.get('https://www.java.com/en/download/manual.jsp',headers={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64)'}).text
    bs = BeautifulSoup.BeautifulSoup(page)
    url32 = bs.find(title = "Download Java software for Windows Offline")["href"]
    url64 = bs.find(title = "Download Java software for Windows (64-bit)")["href"]


    print('Download Java 32')
    wget(url32,'java32.exe')

    print('Download Java 64')
    wget(url64,'java64.exe')

    if not iswin64():
        error('Update source only on x64')

    sendmessagebox("Sur les fenetres suivantes vous devez cliquer sur annuler pour annuler l'installation de JAVA",'Attention')

    allmsi = glob.glob('*.msi')
    for msi in allmsi :
            remove_file(msi)

    remove_tree(makepath(user_appdata(),'..','LocalLow','Oracle'))

    allexe = glob.glob('*.exe')
    for exe in allexe :
            run(exe)
            remove_file(exe)

    currentpath = os.path.dirname(os.path.realpath(__file__))
    allmsi = glob.glob(makepath(user_appdata(),'..','LocalLow','Oracle','Java','*','*.msi'))
    for msi in allmsi:
       filecopyto(msi,currentpath)

    allmsi = glob.glob('*.msi')
    for msi in allmsi:
        realversion = get_msi_properties(msi)['ProductName'].replace('Java ','').replace('Update ','').replace(' (64-bit)','').replace(' ','.')

    versionmajeur = realversion.split('.',1)[0]
    print versionmajeur
    os.chdir(os.path.dirname(__file__))

    from waptpackage import PackageEntry
    pe = PackageEntry()
    pe.load_control_from_wapt(os.getcwd())
    pe.version = realversion + '-0'
    pe.package = pe.package[:-1] + versionmajeur
    pe.save_control_to_wapt(os.getcwd())

if __name__ == '__main__':

    update_sources()

    

manifest

[["WAPT/icon.png", "6989229fb91c47c606324a24167f1ec2c35870ac"], ["WAPT/certificate.crt", "0db563dc9077b268ca07ba834322d0fc5e21f8e5"], ["WAPT/wapt.psproj", "7ccbe65afd42ee7794a86ed74eef48e3f5812c93"], ["jre1.8.0_144.msi", "1dd02ea1982fe994a26cf3bd843e89e233d2aef4"], ["setup.py", "c95f084609bdb4a7777c4782c1974711e4ee98da"], ["jre1.8.0_14464.msi", "e0f5a55ba79654698c6325cce67047d922056402"], ["WAPT/control", "155532575baf365e402b98ee0554382f82adb161"]]