[1022] | 1 | ; Copyright (c) uib gmbh (www.uib.de)
|
---|
| 2 | ; This sourcecode is owned by uib
|
---|
| 3 | ; and published under the Terms of the General Public License.
|
---|
| 4 | ; credits: http://www.opsi.org/en/credits/
|
---|
| 5 |
|
---|
| 6 | [Actions]
|
---|
| 7 | requiredWinstVersion >= "4.10.8.6"
|
---|
| 8 |
|
---|
| 9 | DefVar $MsiId32$
|
---|
| 10 | DefVar $UninstallProgram32$
|
---|
| 11 | DefVar $MsiId64$
|
---|
| 12 | DefVar $UninstallProgram64$
|
---|
| 13 | DefVar $LogDir$
|
---|
| 14 | DefVar $ProductId$
|
---|
| 15 | DefVar $ProductVer$
|
---|
| 16 | DefVar $MinimumSpace$
|
---|
[1023] | 17 | DefVar $InstallDir$
|
---|
[1022] | 18 | DefVar $InstallDir32$
|
---|
| 19 | DefVar $InstallDir64$
|
---|
[1098] | 20 | DefVar $InstallDirOpsi$
|
---|
[1022] | 21 | DefVar $ExitCode$
|
---|
| 22 | DefVar $LicenseRequired$
|
---|
| 23 | DefVar $LicenseKey$
|
---|
| 24 | DefVar $LicensePool$
|
---|
| 25 | DefVar $INST_SystemType$
|
---|
| 26 | DefVar $INST_architecture$
|
---|
| 27 |
|
---|
[1023] | 28 | DefVar $filedaemon_full_name$
|
---|
| 29 | DefVar $filedaemon_full_password$
|
---|
| 30 | DefVar $filedaemon_monitor_name$
|
---|
| 31 | DefVar $filedaemon_monitor_password$
|
---|
| 32 | DefVar $director_name$
|
---|
| 33 | DefVar $director_address$
|
---|
| 34 | DefVar $director_password$
|
---|
| 35 |
|
---|
| 36 |
|
---|
[1022] | 37 | Set $INST_SystemType$ = GetSystemType
|
---|
| 38 | set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
|
---|
| 39 |
|
---|
[1029] | 40 | set $filedaemon_full_name$ = GetProductProperty( "filedaemon_full_name", "" )
|
---|
[1023] | 41 | set $filedaemon_full_password$ = GetProductProperty( "filedaemon_full_password", "filedaemon_full_password" )
|
---|
[1029] | 42 | set $filedaemon_monitor_name$ = GetProductProperty( "filedaemon_monitor_name", "" )
|
---|
[1023] | 43 | set $filedaemon_monitor_password$ = GetProductProperty( "filedaemon_monitor_password", "filedaemon_monitor_password" )
|
---|
| 44 | set $director_name$ = GetProductProperty( "director_name", "director_name" )
|
---|
| 45 | set $director_address$ = GetProductProperty( "director_address", "director_address.example.com" )
|
---|
| 46 | set $director_password$ = GetProductProperty( "director_password", "director_password" )
|
---|
[1022] | 47 |
|
---|
| 48 | Set $LogDir$ = "%SystemDrive%\tmp"
|
---|
| 49 |
|
---|
| 50 | ; ----------------------------------------------------------------
|
---|
| 51 | ; - Please edit the following values -
|
---|
| 52 | ; ----------------------------------------------------------------
|
---|
| 53 | ;$ProductId$ should be the name of the product in opsi
|
---|
| 54 | ; therefore please: only lower letters, no umlauts,
|
---|
| 55 | ; no white space use '-' as a seperator
|
---|
| 56 | Set $ProductId$ = "bacula"
|
---|
| 57 | Set $ProductVer$ = "5.2.10"
|
---|
[1023] | 58 | Set $MinimumSpace$ = "30 MB"
|
---|
[1022] | 59 | ; the path were we find the product after the installation
|
---|
[1023] | 60 | Set $InstallDir$ = "%ProgramFilesDir%\Bacula"
|
---|
| 61 | Set $InstallDir32$ = "%ProgramFiles32Dir%\Bacula"
|
---|
| 62 | Set $InstallDir64$ = "%ProgramFiles64Dir%\Bacula"
|
---|
[1098] | 63 | ; opsi requires path seperation by "\\" instead of "\"
|
---|
| 64 | Set $InstallDirOpsi$ = composeString( splitString ( $InstallDir$, "\"), "\\" )
|
---|
[1022] | 65 | Set $LicenseRequired$ = "false"
|
---|
| 66 | Set $LicensePool$ = "p_" + $ProductId$
|
---|
| 67 | ; ----------------------------------------------------------------
|
---|
| 68 |
|
---|
| 69 | if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
|
---|
| 70 | LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
|
---|
| 71 | isFatalError
|
---|
| 72 | ; Stop process and set installation status to failed
|
---|
[1023] | 73 | endif
|
---|
| 74 |
|
---|
| 75 | comment "Show product picture"
|
---|
| 76 | ShowBitmap "%ScriptPath%\logo.png" $ProductId$
|
---|
| 77 |
|
---|
| 78 | if FileExists("%ScriptPath%\delsub3264.ins")
|
---|
| 79 | comment "Start uninstall sub section"
|
---|
| 80 | Sub "%ScriptPath%\delsub3264.ins"
|
---|
| 81 | endif
|
---|
| 82 |
|
---|
| 83 | ;if $LicenseRequired$ = "true"
|
---|
| 84 | ; comment "Licensing required, reserve license and get license key"
|
---|
| 85 | ; Sub_get_licensekey
|
---|
| 86 | ;endif
|
---|
| 87 |
|
---|
| 88 | comment "installing"
|
---|
| 89 |
|
---|
[1029] | 90 | if $filedaemon_full_name$ = ""
|
---|
| 91 | set $filedaemon_full_name$ = "%HostID%-fd"
|
---|
| 92 | opsiservicecall_set_product_property_filedaemon_full_name
|
---|
[1023] | 93 | endif
|
---|
[1022] | 94 |
|
---|
[1029] | 95 | if $filedaemon_monitor_name$ = ""
|
---|
| 96 | set $filedaemon_monitor_name$ = "%HostID%-mon"
|
---|
| 97 | opsiservicecall_set_product_property_filedaemon_monitor_name
|
---|
| 98 | endif
|
---|
[1022] | 99 |
|
---|
[1029] | 100 |
|
---|
[1023] | 101 | if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
|
---|
| 102 | Message "Installing " + $ProductId$ + " 32 Bit..."
|
---|
| 103 | comment "Start setup program"
|
---|
| 104 | Winbatch_install_32
|
---|
| 105 | Sub_check_exitcode
|
---|
| 106 | ;comment "Copy files"
|
---|
| 107 | ;Files_install_32 /32Bit
|
---|
| 108 | ;comment "Patch Registry"
|
---|
| 109 | ;Registry_install /32Bit
|
---|
| 110 | ;comment "Create shortcuts"
|
---|
| 111 | ;LinkFolder_install
|
---|
[1022] | 112 | endif
|
---|
| 113 |
|
---|
[1023] | 114 | if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
|
---|
| 115 | Message "Installing " + $ProductId$ + " 64 Bit..."
|
---|
| 116 | comment "Start setup program"
|
---|
| 117 | Winbatch_install_64
|
---|
| 118 | Sub_check_exitcode
|
---|
| 119 | ;comment "Copy files"
|
---|
| 120 | ;Files_install_64 /64Bit
|
---|
| 121 | ;comment "Patch Registry"
|
---|
| 122 | ;Registry_install /64Bit
|
---|
| 123 | ;comment "Create shortcuts"
|
---|
| 124 | ;LinkFolder_install
|
---|
| 125 | endif
|
---|
| 126 |
|
---|
| 127 | ;Patches_bacula_conf $InstallDir$+"\bacula-fd.conf"
|
---|
| 128 | DosBatch_bacula-fd.conf
|
---|
| 129 |
|
---|
[1022] | 130 | ;
|
---|
[1023] | 131 | ; end
|
---|
[1022] | 132 | ;
|
---|
| 133 |
|
---|
| 134 |
|
---|
| 135 |
|
---|
[1023] | 136 | ; winbatch installer:
|
---|
| 137 | ; /S silent installl
|
---|
| 138 | ; /D destination path
|
---|
| 139 | ; use this, otherwise it installs to "program files" for all languages.
|
---|
| 140 | ; don't use " around argument, otherwise argument is ignored
|
---|
[1022] | 141 |
|
---|
[1023] | 142 | [Winbatch_install_32]
|
---|
| 143 | "%ScriptPath%\data\bacula-win32-$ProductVer$.exe" /S /D=$InstallDir32$
|
---|
[1022] | 144 |
|
---|
| 145 | [Winbatch_install_64]
|
---|
[1023] | 146 | "%ScriptPath%\data\bacula-win64-$ProductVer$.exe" /S /D=$InstallDir64$
|
---|
[1022] | 147 |
|
---|
[1023] | 148 | [DosBatch_bacula-fd.conf]
|
---|
| 149 | (
|
---|
[1038] | 150 | echo #
|
---|
[1023] | 151 | echo # managed by opsi
|
---|
| 152 | echo #
|
---|
| 153 | echo # "Global" File daemon configuration specifications
|
---|
| 154 | echo #
|
---|
| 155 | echo FileDaemon { # this is me
|
---|
| 156 | echo Name = $filedaemon_full_name$
|
---|
| 157 | echo FDport = 9102 # where we listen for the director
|
---|
[1098] | 158 | echo WorkingDirectory = "$InstallDirOpsi$\\working"
|
---|
| 159 | echo Pid Directory = "$InstallDirOpsi$\\working"
|
---|
| 160 | echo Plugin Directory = "$InstallDirOpsi$\\plugins"
|
---|
[1023] | 161 | echo Maximum Concurrent Jobs = 10
|
---|
| 162 | echo }
|
---|
| 163 | ;echo
|
---|
| 164 | echo #
|
---|
| 165 | echo # List Directors who are permitted to contact this File daemon
|
---|
| 166 | echo #
|
---|
| 167 | echo Director {
|
---|
| 168 | echo Name = $director_name$
|
---|
| 169 | echo Password = "$filedaemon_full_password$"
|
---|
| 170 | echo }
|
---|
| 171 | ;echo
|
---|
| 172 | echo #
|
---|
| 173 | echo # Restricted Director, used by tray-monitor to get the
|
---|
| 174 | echo # status of the file daemon
|
---|
| 175 | echo #
|
---|
| 176 | echo Director {
|
---|
| 177 | echo Name = $filedaemon_monitor_name$
|
---|
| 178 | echo Password = "$filedaemon_monitor_password$"
|
---|
| 179 | echo Monitor = yes
|
---|
| 180 | echo }
|
---|
| 181 | ;echo
|
---|
| 182 | echo # Send all messages except skipped files back to Director
|
---|
| 183 | echo Messages {
|
---|
| 184 | echo Name = Standard
|
---|
| 185 | echo director = $director_name$ = all, !skipped, !restored
|
---|
| 186 | echo }
|
---|
[1038] | 187 | ) > $InstallDir$/bacula-fd.conf
|
---|
[1022] | 188 |
|
---|
[1029] | 189 | [opsiservicecall_set_product_property_filedaemon_full_name]
|
---|
| 190 | "method": "setProductProperty",
|
---|
| 191 | "params": [
|
---|
| 192 | 'bacula',
|
---|
| 193 | 'filedaemon_full_name',
|
---|
| 194 | '$filedaemon_full_name$',
|
---|
| 195 | '%HostID%'
|
---|
| 196 | ]
|
---|
[1022] | 197 |
|
---|
[1029] | 198 | [opsiservicecall_set_product_property_filedaemon_monitor_name]
|
---|
| 199 | "method": "setProductProperty",
|
---|
| 200 | "params": [
|
---|
| 201 | 'bacula',
|
---|
| 202 | 'filedaemon_monitor_name',
|
---|
| 203 | '$filedaemon_monitor_name$',
|
---|
| 204 | '%HostID%'
|
---|
| 205 | ]
|
---|
[1022] | 206 |
|
---|
[1029] | 207 |
|
---|
[1023] | 208 | [Files_install_32]
|
---|
| 209 | ; Example of recursively copying some files into the installation directory:
|
---|
| 210 | ;
|
---|
| 211 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
|
---|
| 212 |
|
---|
[1022] | 213 | [Files_install_64]
|
---|
| 214 | ; Example of recursively copying some files into the installation directory:
|
---|
| 215 | ;
|
---|
| 216 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
|
---|
| 217 |
|
---|
| 218 | [Registry_install]
|
---|
| 219 | ; Example of setting some values of an registry key:
|
---|
| 220 | ;
|
---|
| 221 | ; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
---|
| 222 | ; set "name1" = "some string value"
|
---|
| 223 | ; set "name2" = REG_DWORD:0001
|
---|
| 224 | ; set "name3" = REG_BINARY:00 af 99 cd
|
---|
| 225 |
|
---|
| 226 | [LinkFolder_install]
|
---|
| 227 | ; Example of deleting a folder from AllUsers startmenu:
|
---|
| 228 | ;
|
---|
| 229 | ; set_basefolder common_programs
|
---|
| 230 | ; delete_subfolder $ProductId$
|
---|
| 231 | ;
|
---|
| 232 | ; Example of creating an shortcut to the installed exe in AllUsers startmenu:
|
---|
| 233 | ;
|
---|
| 234 | ; set_basefolder common_programs
|
---|
| 235 | ; set_subfolder $ProductId$
|
---|
| 236 | ;
|
---|
| 237 | ; set_link
|
---|
| 238 | ; name: $ProductId$
|
---|
| 239 | ; target: <path to the program>
|
---|
| 240 | ; parameters:
|
---|
| 241 | ; working_dir: $InstallDir$
|
---|
| 242 | ; icon_file:
|
---|
| 243 | ; icon_index:
|
---|
| 244 | ; end_link
|
---|
| 245 | ;
|
---|
| 246 | ; Example of creating an shortcut to the installed exe on AllUsers desktop:
|
---|
| 247 | ;
|
---|
| 248 | ; set_basefolder common_desktopdirectory
|
---|
| 249 | ; set_subfolder ""
|
---|
| 250 | ;
|
---|
| 251 | ; set_link
|
---|
| 252 | ; name: $ProductId$
|
---|
| 253 | ; target: <path to the program>
|
---|
| 254 | ; parameters: <some_param>
|
---|
| 255 | ; working_dir: $InstallDir$
|
---|
| 256 | ; icon_file: <path to icon file>
|
---|
| 257 | ; icon_index: 2
|
---|
| 258 | ; end_link
|
---|
| 259 |
|
---|
| 260 | [Sub_get_licensekey]
|
---|
| 261 | comment "License management is enabled and will be used"
|
---|
| 262 |
|
---|
| 263 | comment "Trying to get a license key"
|
---|
| 264 | Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
|
---|
| 265 | ; If there is an assignment of exactly one licensepool to the product the following call is possible:
|
---|
| 266 | ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
|
---|
| 267 | ;
|
---|
| 268 | ; If there is an assignment of a license pool to a windows software id, it is possible to use:
|
---|
| 269 | ; DefVar $WindowsSoftwareId$
|
---|
| 270 | ; $WindowsSoftwareId$ = "..."
|
---|
| 271 | ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
|
---|
| 272 |
|
---|
| 273 | DefVar $ServiceErrorClass$
|
---|
| 274 | set $ServiceErrorClass$ = getLastServiceErrorClass
|
---|
| 275 | comment "Error class: " + $ServiceErrorClass$
|
---|
| 276 |
|
---|
| 277 | if $ServiceErrorClass$ = "None"
|
---|
| 278 | comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
|
---|
| 279 | else
|
---|
| 280 | if $ServiceErrorClass$ = "LicenseConfigurationError"
|
---|
| 281 | LogError "Fatal: license configuration must be corrected"
|
---|
| 282 | LogError getLastServiceErrorMessage
|
---|
| 283 | isFatalError
|
---|
| 284 | else
|
---|
| 285 | if $ServiceErrorClass$ = "LicenseMissingError"
|
---|
| 286 | LogError "Fatal: required license is not supplied"
|
---|
| 287 | isFatalError
|
---|
| 288 | endif
|
---|
| 289 | endif
|
---|
| 290 | endif
|
---|
| 291 |
|
---|
| 292 | [Sub_check_exitcode]
|
---|
| 293 | comment "Test for installation success via exit code"
|
---|
| 294 | set $ExitCode$ = getLastExitCode
|
---|
| 295 | ; informations to exit codes see
|
---|
| 296 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
| 297 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
| 298 | if ($ExitCode$ = "0")
|
---|
| 299 | comment "Looks good: setup program gives exitcode zero"
|
---|
| 300 | else
|
---|
| 301 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
| 302 | if ($ExitCode$ = "1605")
|
---|
| 303 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
| 304 | comment "Uninstall of a not installed product failed - no problem"
|
---|
| 305 | else
|
---|
| 306 | if ($ExitCode$ = "1641")
|
---|
| 307 | comment "looks good: setup program gives exitcode 1641"
|
---|
| 308 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
| 309 | else
|
---|
| 310 | if ($ExitCode$ = "3010")
|
---|
| 311 | comment "looks good: setup program gives exitcode 3010"
|
---|
| 312 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
| 313 | else
|
---|
| 314 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
| 315 | isFatalError
|
---|
| 316 | endif
|
---|
| 317 | endif
|
---|
| 318 | endif
|
---|
| 319 | endif
|
---|
| 320 |
|
---|