Table of Contents

IBM Semeru Java Runtime

Tested with opsi 4.2
Windows 10 x64 Ent SAC 19.09, 20H2 & 21H2
Download IBM Semeru Runtimes from here: https://developer.ibm.com/languages/java/semeru-runtimes/

type: localboot
id: ibm-semeru-open-jre
description: Java Runtime

tree:
|-- setup.opsiscript
|-- delsub.opsiscript
|-- uninstall.opsiscript
|-- ibm-semeru-open-jre_x64_windows_8u352b08_openj9-0.35.0.msi
|-- ibm-semeru-open-jre_x86-32_windows_8u352b08_openj9-0.35.0.msi
|-- ibm-semeru-open-jre.png
|-- check_msi-exitcode.opsiscript

The “check_msi-exitcode.opsiscript” is from UIB default Repo.

setup.opsiscript

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/credits/
 
[Initial]
setLogLevel=7
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
[Actions]
requiredWinstVersion >= "4.10.8.6"
 
 
; ----------------------------------------------------------------
; - define Variables			                           		 -
; ----------------------------------------------------------------
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $InstallDir_32$
DefVar $InstallDir_SysN$
DefVar $SetupFile$
DefVar $SetupFile_32$
DefVar $SetupFile_64$
DefVar $ExitCode$
DefVar $Version$
DefVar $Version_OpenJ$
DefVar $INST_SystemType$
DefVar $INST_MsVersion$
DefVar $INST_architecture$
DefVar $InstCMD$
DefVar $UninstCMD$
DefVar $IntrestingFile$
DefVar $Product_Pic$
DefVar $DisplayName$
DefVar $UninstallCommand$
DefVar $MSIUninstStrg$
DefVar $MsiId$
DefStringList $GetDisplayName$
DefStringList $GetMSIUninstStrg$
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Setting Product values       			                     -
; ----------------------------------------------------------------
Set $INST_SystemType$ 	= GetSystemType
Set $INST_MsVersion$	= GetMsVersionInfo
Set $LogDir$ 		= "%SystemDrive%\tmp"
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       	= "IBM Semeru Runtime"
Set $MinimumSpace$    	= "200 MB"
Set $Version$		= "8u352b08"
Set $Version_OpenJ$	= "9-0.35.0"
Set $InstallDir_SysN$	= "%ProgramFilesSysnativeDir%\Java"
Set $SetupFile_32$	= "%ScriptPath%\"+"ibm-semeru-open-jre_x86-32_windows_"+$Version$+"_openj"+$Version_OpenJ$+".msi"
Set $SetupFile_64$	= "%ScriptPath%\"+"ibm-semeru-open-jre_x64_windows_"+$Version$+"_openj"+$Version_OpenJ$+".msi"
Set $InstCMD$ 		= '/log c:\tmp\OpenJDK-JRE_inst.txt /qb INSTALLDIR="C:\Program Files\Java" ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome,FeatureIcedTeaWeb,FeatureJNLPFileRunWith,FeatureOracleJavaSoft'
Set $UninstCMD$		= "/S"
Set $Product_Pic$	= "ibm-semeru-open-jre.png"
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Check System requirements		                           	 -
; ----------------------------------------------------------------
if CompareDotSeparatedNumbers($INST_MsVersion$,"<=","6.0")
	LogError "Wrong OS Version. At least Windows 7 is required for installation!"
	isFatalError
	; Stop process and set installation status to failed
endif
 
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError
	; Stop process and set installation status to failed
endif
 
; ----------------------------------------------------------------
 
 
; ----------------------------------------------------------------
; - Installation					                           	 -
; ----------------------------------------------------------------
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $Product_Pic$ $ProductId$
 
if ($INST_SystemType$ = "x86 System")
 
	comment "Check previous Version"
	if FileExists($InstallDir_SysN$)
		comment "Start uninstall sub section"
		Message "Found previous Version installed, uninstalling first."
		Sub "%ScriptPath%\delsub.opsiscript"
	endif
 
	Message "Installing " + $ProductId$ + " " + $Version$
 
	comment "Start setup program"
	Winbatch_install_32
	Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
endif
 
if ($INST_SystemType$ = "64 Bit System")
 
	comment "Check previous 64 Bit Version installed"
	if FileExists($InstallDir_SysN$)
		comment "Start uninstall sub section"
		Message "Found previous Version installed, uninstalling first."
		Sub "%ScriptPath%\delsub.opsiscript"
	endif
 
	Message "Installing " + $ProductId$ + " " + $Version$
 
	comment "Start setup program"
	Winbatch_install_64
	Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
endif
 
; ----------------------------------------------------------------
 
 
; ----------------------------------------------------------------
; - Sub's							                           	 -
; ----------------------------------------------------------------
 
[Winbatch_install_32]
msiexec /i $SetupFile_32$ $InstCMD$
 
[Winbatch_install_64]
msiexec /i $SetupFile_64$ $InstCMD$
 
; ----------------------------------------------------------------

delsub.opsiscript

; ----------------------------------------------------------------
; - Deinstallation                                               -
; ----------------------------------------------------------------
 
Set $GetMSIUninstStrg$ = getOutStreamFromSection ("DosInAnIcon_MSIUninstStrg WINST /SysNative")
Set $MSIUninstStrg$ = takestring (-1, $GetMSIUninstStrg$)
if contains ($MSIUninstStrg$,"{")
	if contains ($MSIUninstStrg$,"}")
		set $MsiId$ = $MSIUninstStrg$
	else
		logError "MSI Uninstall String misformed. Check Log."
		isFatalError "Uninst String missing }"
	endif
else
	logError "Installation not found or MSI Uninstall String misformed. Check Log."
	isFatalError "Uninst String missing {"
endif
 
Set $GetDisplayName$ = getOutStreamFromSection ("DosInAnIcon_DisplayName WINST /SysNative")
Set $DisplayName$ = takestring (-1, $GetDisplayName$)
if not ($DisplayName$ = "")
	Message "Found "+$DisplayName$+" => uninstalling first"
	Winbatch_uninstall
	Sub "%ScriptPath%\check_msi-exitcode.opsiscript"
	Files_delete
else
	logError "MSI String for old Version found, but no Display Name set."
	isFatalError "DisplayName"
endif
 
; ----------------------------------------------------------------
; - Sub's                                      			         -
; ----------------------------------------------------------------
 
[DosInAnIcon_MSIUninstStrg]
@echo off
for /f "delims=\ tokens=7" %%a in ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s /f "IBM Semeru Runtime Open Edition" ^| find "{"') do echo %%a
 
[DosInAnIcon_DisplayName]
@echo off
for /f "tokens=3*" %%c in ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall /s /f "IBM Semeru Runtime Open Edition" ^| find "DisplayName"') do echo %%c %%d
 
[Winbatch_uninstall]
MsiExec.exe /x $MsiId$ /qb-! REBOOT=ReallySuppress
 
[Registry_delete]
DeleteKey [HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft]
 
[Files_delete]
del -s -f %ProgramFilesSysNativeDir%\Java

uninstall.opsiscript

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib
; and published under the Terms of the General Public License.
 
[Initial]
setLogLevel=7
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
[Aktionen]
requiredWinstVersion >= "4.10.8.3"
; ----------------------------------------------------------------
; - define Variables			                           		 -
; ----------------------------------------------------------------
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir_SysN$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $Version$
DefVar $INST_SystemType$
DefVar $INST_MsVersion$
DefVar $INST_architecture$
DefVar $InstCMD$
DefVar $UninstCMD$
DefVar $IntrestingFile$
DefVar $Product_Pic$
DefVar $DisplayName$
DefVar $UninstallCommand$
DefVar $MSIUninstStrg$
DefVar $MsiId$
DefStringList $GetDisplayName$
DefStringList $GetMSIUninstStrg$
; ----------------------------------------------------------------
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       	= "IBM Semeru Runtime"
Set $MinimumSpace$    	= "100 MB"
Set $Version$		= "8u352b08"
Set $InstallDir_SysN$	= "%ProgramFilesSysnativeDir%\Java"
Set $LicenseRequired$ 	= "false"
Set $UninstCMD$		= "/S"
Set $Product_Pic$	= "ibm-semeru-open-jre.png"
; ----------------------------------------------------------------
 
if FileExists("%ScriptPath%\delsub.opsiscript")
	ShowBitmap "%ScriptPath%\" + $Product_Pic$ $ProductId$
	Message "Deinstalling Java Runtime"
	comment "start uninstall"
	sub "%ScriptPath%\delsub.opsiscript"
endif