Table of Contents

Google Earth 6.2.2

Versions
By Matteo Cristofaro 2012/10/19 21:26

Tested with opsi 4.0.1.36
requiredWinstVersion >= 4.10.8.6 By Matteo Cristofaro 2012/10/19 21:26

Das Setup-File wird im ScriptPath in einem Unterverzeichnis “setup” abgelegt, also “CLIENT_DATA\setup\Google622EarthWin.exe”

Auf der GoogleEarth-Seite erhält man nur schwer mehr als ein kleines Initialsetup, dass dann die restlichen Dateien aus dem Internet nachladen will, also für unsere Zwecke nicht brauchbar. Unter z.B. chip.de findet sich eine vollständige Offline-Exe zum Download. Bitte diese benutzen.

Tree:
delsub32.ins
google-earth6_x32.PNG
setup\Google622EarthWin.exe
setup32.ins
uninstall32.ins

setup32.ins

[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
 
Set $LogDir$ 			= "%SystemDrive%\tmp"
Set $ProductId$       	= "google-earth6_x32"
Set $MinimumSpace$		= "200 MB"
Set $InstallDir$      	= "%ProgramFiles32Dir%\Google Earth"
Set $LicenseRequired$ 	= "false"
Set $LicensePool$     	= "p_" + $ProductId$
; ----------------------------------------------------------------
 
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
else
	comment "Show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
	if FileExists("%ScriptPath%\delsub32.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub32.ins"
	endif
 
	Message "Installing " + $ProductId$ + " ..."
 
	if $LicenseRequired$ = "true"
		comment "Licensing required, reserve license and get license key"
		Sub_get_licensekey
	endif
 
	comment "Start setup program"
	Winbatch_install
	Sub_check_exitcode
endif
 
 
[Winbatch_install]
"%ScriptPath%\setup\Google622EarthWin.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress"
 
 
 
[Sub_get_licensekey]
if opsiLicenseManagementEnabled
	comment "License management is enabled and will be used"
 
	comment "Trying to get a license key"
	Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
	; If there is an assignment of exactly one licensepool to the product the following call is possible:
	; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
	;
	; If there is an assignment of a license pool to a windows software id, it is possible to use:
	; DefVar $WindowsSoftwareId$
	; $WindowsSoftwareId$ = "..."
	; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
 
	DefVar $ServiceErrorClass$
	set $ServiceErrorClass$ = getLastServiceErrorClass
	comment "Error class: " + $ServiceErrorClass$
 
	if $ServiceErrorClass$ = "None"
		comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
	else
		if $ServiceErrorClass$ = "LicenseConfigurationError"
			LogError "Fatal: license configuration must be corrected"
			LogError getLastServiceErrorMessage
			isFatalError
		else 
			if $ServiceErrorClass$ = "LicenseMissingError"
				LogError "Fatal: required license is not supplied"
				isFatalError
			endif
		endif
	endif
else
	LogError "Fatal: license required, but license management not enabled"
	isFatalError
endif
 
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif

delsub32.ins

Set $MsiId$ = '{28E82311-8616-11E1-BEB0-B8AC6F97B88E}'
 
Message "Uninstalling " + $ProductId$ + " ..."
 
if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "")
	comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
	Winbatch_uninstall_msi
	sub_check_exitcode
endif
 
 
[Winbatch_uninstall_msi]
msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress
 
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif

uninstall32.ins

[Actions]
requiredWinstVersion >= "4.10.8.6"
 
DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir$
DefVar $LicenseRequired$
DefVar $LicensePool$
 
Set $LogDir$ 			= "%SystemDrive%\tmp"
Set $ProductId$       	= "google-earth6_x32"
Set $InstallDir$		= "%ProgramFiles32Dir%\Google Earth"
Set $LicenseRequired$ 	= "false"
Set $LicensePool$     	= "p_" + $ProductId$
; ----------------------------------------------------------------
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
Message "Uninstalling " + $ProductId$ + " ..."
 
if FileExists("%ScriptPath%\delsub32.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub32.ins"
endif
 
if $LicenseRequired$ = "true"
	comment "Licensing required, free license used"
	Sub_free_license
endif
 
[Sub_free_license]
comment "License management is enabled and will be used"
 
comment "Trying to free license used for the product"
DefVar $result$
Set $result$ = FreeLicense($LicensePool$)
; If there is an assignment of a license pool to the product, it is possible to use
; Set $result$ = FreeLicense("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)