[1022] | 1 | ; Copyright (c) uib gmbh (www.uib.de)
|
---|
| 2 | ; This sourcecode is owned by uib gmbh
|
---|
| 3 | ; and published under the Terms of the General Public License.
|
---|
| 4 | ; credits: http://www.opsi.org/en/credits/
|
---|
| 5 |
|
---|
| 6 |
|
---|
[1023] | 7 | ;Set $MsiId32$ = 'Bacula'
|
---|
[1022] | 8 | Set $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe"
|
---|
| 9 |
|
---|
[1023] | 10 | ;Set $MsiId64$ = 'Bacula'
|
---|
[1022] | 11 | Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe"
|
---|
| 12 |
|
---|
| 13 | if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
|
---|
| 14 | Message "Uninstalling " + $ProductId$ + " 32 Bit..."
|
---|
| 15 |
|
---|
| 16 | if FileExists($UninstallProgram32$)
|
---|
| 17 | comment "Uninstall program found, starting uninstall"
|
---|
| 18 | Winbatch_uninstall_32
|
---|
| 19 | sub_check_exitcode
|
---|
| 20 | endif
|
---|
| 21 |
|
---|
[1023] | 22 | ;if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "")
|
---|
| 23 | ; comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall"
|
---|
| 24 | ; Winbatch_uninstall_msi_32
|
---|
| 25 | ; sub_check_exitcode
|
---|
| 26 | ;endif
|
---|
[1022] | 27 |
|
---|
[1023] | 28 | ;comment "Delete files"
|
---|
| 29 | ;Files_uninstall_32 /32Bit
|
---|
| 30 | ;comment "Cleanup registry"
|
---|
| 31 | ;Registry_uninstall /32Bit
|
---|
[1022] | 32 | endif
|
---|
| 33 |
|
---|
| 34 | if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
|
---|
| 35 | Message "Uninstalling " + $ProductId$ + " 64 Bit..."
|
---|
| 36 |
|
---|
| 37 | if FileExists($UninstallProgram64$)
|
---|
| 38 | comment "Uninstall program found, starting uninstall"
|
---|
| 39 | Winbatch_uninstall_64
|
---|
| 40 | sub_check_exitcode
|
---|
| 41 | endif
|
---|
| 42 |
|
---|
[1023] | 43 | ;if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "")
|
---|
| 44 | ; comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall"
|
---|
| 45 | ; Winbatch_uninstall_msi_64
|
---|
| 46 | ; sub_check_exitcode
|
---|
| 47 | ;endif
|
---|
[1022] | 48 |
|
---|
[1023] | 49 | ;comment "Delete files"
|
---|
| 50 | ;Files_uninstall_64 /64Bit
|
---|
| 51 | ;comment "Cleanup registry"
|
---|
| 52 | ;Registry_uninstall /64Bit
|
---|
[1022] | 53 | endif
|
---|
| 54 |
|
---|
[1023] | 55 | ;comment "Delete program shortcuts"
|
---|
| 56 | ;LinkFolder_uninstall
|
---|
[1022] | 57 |
|
---|
| 58 | [Winbatch_uninstall_32]
|
---|
[1023] | 59 | "$UninstallProgram32$" /S
|
---|
[1022] | 60 |
|
---|
| 61 |
|
---|
[1023] | 62 | [Winbatch_uninstall_64]
|
---|
| 63 | "$UninstallProgram64$" /S
|
---|
| 64 |
|
---|
| 65 |
|
---|
[1022] | 66 | [Winbatch_uninstall_msi_32]
|
---|
| 67 | msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress
|
---|
| 68 |
|
---|
| 69 | [Files_uninstall_32]
|
---|
| 70 | ; Example for recursively deleting the installation directory (don't forget the trailing backslash):
|
---|
| 71 | ;
|
---|
| 72 | ; delete -sf "$InstallDir32$\"
|
---|
| 73 |
|
---|
| 74 |
|
---|
| 75 |
|
---|
| 76 | [Winbatch_uninstall_msi_64]
|
---|
| 77 | msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress
|
---|
| 78 |
|
---|
| 79 | [Files_uninstall_64]
|
---|
| 80 | ; Example for recursively deleting the installation directory (don't forget the trailing backslash):
|
---|
| 81 | ;
|
---|
| 82 | ; delete -sf "$InstallDir64$\"
|
---|
| 83 |
|
---|
| 84 | [Registry_uninstall]
|
---|
| 85 | ; Example of deleting a registry key:
|
---|
| 86 | ;
|
---|
| 87 | ; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
---|
| 88 |
|
---|
| 89 | [LinkFolder_uninstall]
|
---|
| 90 | ; Example of deleting a folder from AllUsers startmenu:
|
---|
| 91 | ;
|
---|
| 92 | ; set_basefolder common_programs
|
---|
| 93 | ; delete_subfolder $ProductId$
|
---|
| 94 | ;
|
---|
| 95 | ; Example of deleting a shortcut from AllUsers desktop:
|
---|
| 96 | ;
|
---|
| 97 | ; set_basefolder common_desktopdirectory
|
---|
| 98 | ; set_subfolder ""
|
---|
| 99 | ; delete_element $ProductId$
|
---|
| 100 |
|
---|
| 101 | [Sub_check_exitcode]
|
---|
| 102 | comment "Test for installation success via exit code"
|
---|
| 103 | set $ExitCode$ = getLastExitCode
|
---|
| 104 | ; informations to exit codes see
|
---|
| 105 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
| 106 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
| 107 | if ($ExitCode$ = "0")
|
---|
| 108 | comment "Looks good: setup program gives exitcode zero"
|
---|
| 109 | else
|
---|
| 110 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
| 111 | if ($ExitCode$ = "1605")
|
---|
| 112 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
| 113 | comment "Uninstall of a not installed product failed - no problem"
|
---|
| 114 | else
|
---|
| 115 | if ($ExitCode$ = "1641")
|
---|
| 116 | comment "looks good: setup program gives exitcode 1641"
|
---|
| 117 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
| 118 | else
|
---|
| 119 | if ($ExitCode$ = "3010")
|
---|
| 120 | comment "looks good: setup program gives exitcode 3010"
|
---|
| 121 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
| 122 | else
|
---|
| 123 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
| 124 | isFatalError
|
---|
| 125 | endif
|
---|
| 126 | endif
|
---|
| 127 | endif
|
---|
| 128 | endif
|
---|
| 129 |
|
---|