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