tis-java8 8.171-1

  • package : tis-java8
  • version : 8.171-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 : 2018-04-18 10:31:03

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'):
        print('plus compatible avec windows XP')
        prefix = control.package.split('-')[0]
        WAPT.install('%s-java8(=8.151-2)' % prefix)
    else:
        allmsi = glob.glob('*.msi')
        for msi in allmsi :
            java_version = get_msi_properties(msi)['ProductVersion']
            print ('Installation de Java version : %s' % 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)

    if isdir(makepath(user_appdata(),'..','LocalLow','Oracle')):
        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()

    

Changelog

No changelog
    

manifest.sha256

[["WAPT/icon.png", "d31eb412a45b4188140002a309a8f7787b772c6649256f7783d2e051f3d2b761"], ["WAPT/certificate.crt", "79e5388683c0b6cb03f4f81e4e58e3a11463b2b6cf169dd9c453098027dcfaa4"], ["WAPT/wapt.psproj", "b6db619daee03b47d37e5766a6a743091bfd8efc2ddada421708ae7d2d044ac0"], ["jre1.8.0_171.msi", "fd6ce77b2d8c46bd78687b3f11993c230efb3dd14ebd5567b229c3c67b54e482"], ["setup.py", "cd0e034a173bd63dcfebb6ef7c99cda2c6f54f163d90b1608c435893008b0d6d"], ["jre1.8.0_17164.msi", "a4293705e47771a651f1c53637ec855383472135c33f8fd761e2056940b65fc1"], ["WAPT/control", "41ec38f3360207d5f91565df2301a1933e9daa6c37b7fcb3ca793a873302934d"]]