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

Last change on this file since 1101 was 1101, checked in by joergs, 11 years ago

bugfix

File size: 12.0 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
137if ($INST_NTVersion$ >= "6.0")
138        DosShell_open_firewall_nt6
139else
140        DosShell_open_firewall
141endif
142
143; start FD immediatly, not only after reboot
144DosBatch_start_bacula-fd
145
146;
147; end
148;
149
150
151
152; winbatch installer:
153; /S silent installl
154; /D destination path
155;       use this, otherwise it installs to "program files" for all languages.
156;       don't use " around argument, otherwise argument is ignored
157
158[Winbatch_install_32]
159"%ScriptPath%\data\bacula-win32-$ProductVer$.exe" /S /D=$InstallDir32$
160
161[Winbatch_install_64]
162"%ScriptPath%\data\bacula-win64-$ProductVer$.exe" /S /D=$InstallDir64$
163
164[DosBatch_bacula-fd.conf]
165(
166echo #
167echo # managed by opsi
168echo #
169echo # "Global" File daemon configuration specifications
170echo #
171echo FileDaemon {                            # this is me
172echo   Name                    = "$filedaemon_full_name$"
173echo   FDport                  = 9102                # where we listen for the director
174echo   WorkingDirectory        = "$InstallDirOpsi$\\working"
175echo   Pid Directory           = "$InstallDirOpsi$\\working"
176echo   Plugin Directory        = "$InstallDirOpsi$\\plugins"
177echo   Maximum Concurrent Jobs = 10
178echo }
179;echo
180echo #
181echo # List Directors who are permitted to contact this File daemon
182echo #
183echo Director {
184echo   Name     = "$director_name$"
185echo   Password = "$filedaemon_full_password$"
186echo }
187;echo
188echo #
189echo # Restricted Director, used by tray-monitor to get the
190echo #   status of the file daemon
191echo #
192echo Director {
193echo   Name     = "$filedaemon_monitor_name$"
194echo   Password = "$filedaemon_monitor_password$"
195echo   Monitor  = yes
196echo }
197;echo
198echo # Send all messages except skipped files back to Director
199echo Messages {
200echo   Name = Standard
201echo   director = $director_name$ = all, !skipped, !restored
202echo }
203) > $InstallDir$/bacula-fd.conf
204
205
206
207[DosBatch_bconsole.conf]
208(
209echo #
210echo # managed by opsi
211echo #
212echo Director {
213echo   Name        = "$director_name$"
214echo   Address     = "$director_address$"
215echo   DIRport     = 9101
216echo   Password    = "$director_password$"
217echo }
218) > $InstallDir$/bconsole.conf
219
220
221
222[DosBatch_bat.conf]
223(
224echo #
225echo # managed by opsi
226echo #
227echo Director {
228echo   Name        = "$director_name$"
229echo   Address     = "$director_address$"
230echo   DIRport     = 9101
231echo   Password    = "$director_password$"
232echo }
233) > $InstallDir$/bat.conf
234
235
236
237[DosBatch_tray-monitor.conf]
238(
239echo #
240echo # managed by opsi
241echo #
242echo Monitor {
243echo   Name            = "$filedaemon_monitor_name$"
244echo   Password        = "$filedaemon_monitor_password$"
245echo   RefreshInterval = 30 seconds
246echo }
247echo
248echo Client {
249echo   Name            = "$filedaemon_full_name$"
250echo   Address         = localhost
251echo   FDport          = 9102
252echo   Password        = "$filedaemon_monitor_password$"
253echo }
254) > $InstallDir$/tray-monitor.conf
255
256
257
258[DosBatch_open_firewall]
259netsh firewall add portopening protocol=TCP port=9102 name=bacula-fd-port
260
261[DosBatch_open_firewall_nt6]
262netsh advfirewall firewall add rule name="bacula-fd-port" dir=in action=allow protocol=TCP localport=9102
263
264[DosBatch_start_bacula-fd]
265net start bacula-fd
266
267[opsiservicecall_set_product_property_filedaemon_full_name]
268"method": "setProductProperty",
269"params": [
270        'bacula',
271        'filedaemon_full_name',
272        '$filedaemon_full_name$',
273        '%HostID%'
274]
275
276[opsiservicecall_set_product_property_filedaemon_monitor_name]
277"method": "setProductProperty",
278"params": [
279        'bacula',
280        'filedaemon_monitor_name',
281        '$filedaemon_monitor_name$',
282        '%HostID%'
283]
284
285
286[Files_install_32]
287; Example of recursively copying some files into the installation directory:
288;
289; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
290
291[Files_install_64]
292; Example of recursively copying some files into the installation directory:
293;
294; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
295
296[Registry_install]
297; Example of setting some values of an registry key:
298;
299; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
300; set "name1" = "some string value"
301; set "name2" = REG_DWORD:0001
302; set "name3" = REG_BINARY:00 af 99 cd
303
304[LinkFolder_install]
305; Example of deleting a folder from AllUsers startmenu:
306;
307; set_basefolder common_programs
308; delete_subfolder $ProductId$
309;
310; Example of creating an shortcut to the installed exe in AllUsers startmenu:
311;
312; set_basefolder common_programs
313; set_subfolder $ProductId$
314;
315; set_link
316;       name: $ProductId$
317;       target: <path to the program>
318;       parameters:
319;       working_dir: $InstallDir$
320;       icon_file:
321;       icon_index:
322; end_link
323;
324; Example of creating an shortcut to the installed exe on AllUsers desktop:
325;
326; set_basefolder common_desktopdirectory
327; set_subfolder ""
328;
329; set_link
330;       name: $ProductId$
331;       target: <path to the program>
332;       parameters: <some_param>
333;       working_dir: $InstallDir$
334;       icon_file: <path to icon file>
335;       icon_index: 2
336; end_link
337
338[Sub_get_licensekey]
339comment "License management is enabled and will be used"
340
341comment "Trying to get a license key"
342Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
343; If there is an assignment of exactly one licensepool to the product the following call is possible:
344; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
345;
346; If there is an assignment of a license pool to a windows software id, it is possible to use:
347; DefVar $WindowsSoftwareId$
348; $WindowsSoftwareId$ = "..."
349; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
350
351DefVar $ServiceErrorClass$
352set $ServiceErrorClass$ = getLastServiceErrorClass
353comment "Error class: " + $ServiceErrorClass$
354
355if $ServiceErrorClass$ = "None"
356        comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
357else
358        if $ServiceErrorClass$ = "LicenseConfigurationError"
359                LogError "Fatal: license configuration must be corrected"
360                LogError getLastServiceErrorMessage
361                isFatalError
362        else
363                if $ServiceErrorClass$ = "LicenseMissingError"
364                        LogError "Fatal: required license is not supplied"
365                        isFatalError
366                endif
367        endif
368endif
369
370[Sub_check_exitcode]
371comment "Test for installation success via exit code"
372set $ExitCode$ = getLastExitCode
373; informations to exit codes see
374; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
375; http://msdn.microsoft.com/en-us/library/aa368542.aspx
376if ($ExitCode$ = "0")
377        comment "Looks good: setup program gives exitcode zero"
378else
379        comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
380        if ($ExitCode$ = "1605")
381                comment "ERROR_UNKNOWN_PRODUCT  1605    This action is only valid for products that are currently installed."
382                comment "Uninstall of a not installed product failed - no problem"
383        else
384                if ($ExitCode$ = "1641")
385                        comment "looks good: setup program gives exitcode 1641"
386                        comment "ERROR_SUCCESS_REBOOT_INITIATED 1641    The installer has initiated a restart. This message is indicative of a success."
387                else
388                        if ($ExitCode$ = "3010")
389                                comment "looks good: setup program gives exitcode 3010"
390                                comment "ERROR_SUCCESS_REBOOT_REQUIRED  3010    A restart is required to complete the install. This message is indicative of a success."
391                        else
392                                logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
393                                isFatalError
394                        endif
395                endif
396        endif
397endif
398
Note: See TracBrowser for help on using the repository browser.