source: opsi/products/bacula/CLIENT_DATA/setup3264.ins@ 1233

Last change on this file since 1233 was 1112, checked in by joergs, on Sep 24, 2012 at 10:24:15 AM

bugfix: tray-monitor.conf

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