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

Last change on this file since 1099 was 1099, checked in by joergs, on Sep 21, 2012 at 4:52:27 PM

5.2.10-5

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