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