# -*- coding: utf-8 -*-
##################################################
# This file is part of WAPT Enterprise
# All right reserved, (c) Tranquil IT Systems 2024
# For more information please refer to
# https://wapt.tranquil.it/store/licences.html
##################################################
from setuphelpers import *
"""
{
"key":"{26A24AE4-039D-4CA4-87B4-2F06417080FF}",
"name":"Java 7 Update 80 (64-bit)",
"version":"7.0.800",
"install_date":"2024-03-25 00:00:00",
"install_location":"C:\\Program Files\\Java\\jre7\\",
"uninstall_string":"MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F06417080FF}",
"publisher":"Oracle",
"system_component":0,
"win64":true
},
{
"key":"{26A24AE4-039D-4CA4-87B4-2F03217080FF}",
"name":"Java 7 Update 80",
"version":"7.0.800",
"install_date":"2024-03-25 00:00:00",
"install_location":"C:\\Program Files (x86)\\Java\\jre7\\",
"uninstall_string":"MsiExec.exe /X{26A24AE4-039D-4CA4-87B4-2F03217080FF}",
"publisher":"Oracle",
"system_component":0,
"win64":false
},
{
"key":"{4A03706F-666A-4037-7777-5F2748764D10}",
"name":"Java Auto Updater",
"version":"2.1.80.15",
"install_date":"2024-03-25 00:00:00",
"install_location":"",
"uninstall_string":"",
"publisher":"Oracle, Inc.",
"system_component":0,
"win64":false
}
https://docs.oracle.com/javase/7/docs/webnotes/install/windows/jre-installer-options.html
"""
bin_name_x86 = "jre-7u80-windows-i586.exe"
bin_name_x64 = "jre-7u80-windows-x64.exe"
version = bin_name_x86.split("-")[1]
app_uninstallkey_x86 = "{26A24AE4-039D-4CA4-87B4-2F0321%sFF}" % version.replace("u", "0")
app_uninstallkey_x64 = "{26A24AE4-039D-4CA4-87B4-2F0641%sFF}" % version.replace("u", "0")
def install():
silentflags = "/s STATIC=0 WEB_JAVA=0 WEB_JAVA_SECURITY_LEVEL=H SPONSORS=0"
# silentflags = "/s"
# Installing the software
if force:
uninstall()
install_exe_if_needed(
bin_name_x86,
silentflags=silentflags + r' /L "%s"' % r"C:\Windows\Temp\%s" % bin_name_x86.replace(".exe", ".log"),
# silentflags=silentflags,
key=app_uninstallkey_x86,
min_version=control.get_software_version(),
)
if iswin64():
install_exe_if_needed(
bin_name_x64,
silentflags=silentflags + r' /L "%s"' % r"C:\Windows\Temp\%s" % bin_name_x64.replace(".exe", ".log"),
# silentflags=silentflags,
key=app_uninstallkey_x64,
min_version=control.get_software_version(),
)
# Uninstalling the software updater
for to_uninstall in installed_softwares(name="Java Auto Updater"):
print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
run_notfatal(uninstall_cmd(to_uninstall["key"]))
# Disabling Automatic Updates and removing SunJavaUpdateSched startup key
print("Disabling: Automatic Java Updates")
if iswin64():
registry_delete(HKEY_LOCAL_MACHINE, r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run", "SunJavaUpdateSched")
registry_set(HKEY_LOCAL_MACHINE, r"SOFTWARE\Wow6432Node\JavaSoft\Java Update\Policy", "EnableJavaUpdate", 0)
registry_delete(HKEY_LOCAL_MACHINE, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "SunJavaUpdateSched")
registry_set(HKEY_LOCAL_MACHINE, r"SOFTWARE\JavaSoft\Java Update\Policy", "EnableJavaUpdate", 0)
def uninstall():
# Uninstalling the software
for to_uninstall in installed_softwares("Java 7 "):
print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
killalltasks(ensure_list(control.impacted_process))
run(uninstall_cmd(to_uninstall["key"]))
wait_uninstallkey_absent(to_uninstall["key"])
# Uninstalling the software updater
for to_uninstall in installed_softwares(name="Java Auto Updater"):
print("Removing: %s (%s)" % (to_uninstall["name"], to_uninstall["version"]))
run_notfatal(uninstall_cmd(to_uninstall["key"]))