also uninstall libreoffice 3.4 before 3.5 install

This commit is contained in:
Mario Fetka 2012-02-26 08:01:38 +01:00
parent 2399222e0c
commit db3a9721a3
3 changed files with 22 additions and 131 deletions

View File

@ -4,17 +4,24 @@
; credits: http://www.opsi.org/credits/
Set $MsiId34$ = '{03CEFC42-378E-4467-9909-DCBAFD38CA9F}'
Set $MsiIdHelp34$ = '{F8DF795C-5865-43BB-A547-7FFD0EA753F9}'
Set $MsiId$ = '{BB21B808-F784-4883-A4D4-B1473384C1C6}'
Set $MsiIdHelp$ = '{3641CF63-7FB5-45CA-98D3-FB7D08F63056}'
Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe"
Message "Uninstalling " + $ProductId$ + " ..."
if FileExists($UninstallProgram$)
comment "Uninstall program found, starting uninstall"
Winbatch_uninstall
if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId34$ + "] DisplayName") = "")
comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall"
Winbatch_uninstall_msi_34
sub_check_exitcode
endif
if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiIdHelp34$ + "] DisplayName") = "")
comment "MSI id " + $MsiIdHelp$ + " found in registry, starting msiexec to uninstall"
Winbatch_uninstall_msi_help_34
sub_check_exitcode
endif
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
@ -35,15 +42,11 @@ Registry_uninstall /32Bit
comment "Delete program shortcuts"
LinkFolder_uninstall
[Winbatch_uninstall]
; Choose one of the following examples as basis for program uninstall
;
; === Nullsoft Scriptable Install System ================================================================
; "$UninstallProgram$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES
[Winbatch_uninstall_msi_34]
msiexec /x $MsiId34$ /qb! REBOOT=ReallySuppress
[Winbatch_uninstall_msi_help_34]
msiexec /x $MsiIdHelp34$ /qb! REBOOT=ReallySuppress
[Winbatch_uninstall_msi]
msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress
@ -55,6 +58,7 @@ msiexec /x $MsiIdHelp$ /qb! REBOOT=ReallySuppress
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
;
delete -sf "$InstallDir$\"
delete -sf "$InstallDir34$\"
[Registry_uninstall]
; Example of deleting a registry key:

View File

@ -6,17 +6,16 @@
[Actions]
requiredWinstVersion >= "4.10.8.6"
DefVar $MsiId34$
DefVar $MsiIdHelp34$
DefVar $MsiId$
DefVar $MsiIdHelp$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $InstallDir34$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
Set $LogDir$ = "%SystemDrive%\tmp"
@ -40,8 +39,7 @@ Set $ProductId$ = "libreoffice"
Set $MinimumSpace$ = "1500 MB"
; the path were we find the product after the installation
Set $InstallDir$ = "%ProgramFiles32Dir%\LibreOffice 3.5"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
Set $InstallDir34$ = "%ProgramFiles32Dir%\LibreOffice 3.4"
; ----------------------------------------------------------------
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
@ -59,11 +57,6 @@ else
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
@ -93,56 +86,10 @@ else
endif
[Winbatch_install]
; Choose one of the following examples as basis for your installation
; You can use $LicenseKey$ var to pass a license key to the installer
;
; === Nullsoft Scriptable Install System ================================================================
; "%ScriptPath%\Setup.exe" /S
;
; === MSI package =======================================================================================
; You may use the parameter PIDKEY=$Licensekey$
msiexec /i "$InstallMsi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress
;
; === InstallShield + MSI=====================================================================================
; Attention: The path to the log file should not contain any whitespaces
; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=2 REBOOT=ReallySuppress"
; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress"
;
; === InstallShield =====================================================================================
; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss"
; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt"
;
; === Inno Setup ========================================================================================
; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html
; You may create setup answer file by: setup.exe /SAVEINF="filename"
; You may use an answer file by the parameter /LOADINF="filename"
; "%ScriptPath%\setup.exe" /sp- /silent /norestart /SUPPRESSMSGBOXES
[Winbatch_install_help]
; Choose one of the following examples as basis for your installation
; You can use $LicenseKey$ var to pass a license key to the installer
;
; === Nullsoft Scriptable Install System ================================================================
; "%ScriptPath%\Setup.exe" /S
;
; === MSI package =======================================================================================
; You may use the parameter PIDKEY=$Licensekey$
msiexec /i "$InstallHelpMsi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress
;
; === InstallShield + MSI=====================================================================================
; Attention: The path to the log file should not contain any whitespaces
; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=2 REBOOT=ReallySuppress"
; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress"
;
; === InstallShield =====================================================================================
; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss"
; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt"
;
; === Inno Setup ========================================================================================
; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html
; You may create setup answer file by: setup.exe /SAVEINF="filename"
; You may use an answer file by the parameter /LOADINF="filename"
; "%ScriptPath%\setup.exe" /sp- /silent /norestart /SUPPRESSMSGBOXES
[Files_install]
; Example of recursively copying some files into the installation directory:
@ -191,44 +138,6 @@ msiexec /i "$InstallHelpMsi$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! AL
; icon_index: 2
; end_link
[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

View File

@ -8,13 +8,11 @@ requiredWinstVersion >= "4.10.8.6"
DefVar $MsiId$
DefVar $MsiIdHelp$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $InstallDir34$
Set $LogDir$ = "%SystemDrive%\tmp"
@ -33,8 +31,7 @@ Set $LogDir$ = "%SystemDrive%\tmp"
; ----------------------------------------------------------------
Set $ProductId$ = "libreoffice"
Set $InstallDir$ = "%ProgramFiles32Dir%\LibreOffice 3.5"
Set $LicenseRequired$ = "false"
Set $LicensePool$ = "p_" + $ProductId$
Set $InstallDir34$ = "%ProgramFiles32Dir%\LibreOffice 3.4"
; ----------------------------------------------------------------
@ -48,22 +45,3 @@ if FileExists("%ScriptPath%\delsub32.ins")
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$)