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

Last change on this file since 1098 was 1098, checked in by joergs, on Sep 21, 2012 at 1:01:12 PM

added $InstallDirOpsi$

File size: 10.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_architecture$
27
28DefVar $filedaemon_full_name$
29DefVar $filedaemon_full_password$
30DefVar $filedaemon_monitor_name$
31DefVar $filedaemon_monitor_password$
32DefVar $director_name$
33DefVar $director_address$
34DefVar $director_password$
35
36
37Set $INST_SystemType$ = GetSystemType
38set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
39
40set $filedaemon_full_name$ = GetProductProperty( "filedaemon_full_name", "" )
41set $filedaemon_full_password$ = GetProductProperty( "filedaemon_full_password", "filedaemon_full_password" )
42set $filedaemon_monitor_name$ = GetProductProperty( "filedaemon_monitor_name", "" )
43set $filedaemon_monitor_password$ = GetProductProperty( "filedaemon_monitor_password", "filedaemon_monitor_password" )
44set $director_name$ = GetProductProperty( "director_name", "director_name" )
45set $director_address$ = GetProductProperty( "director_address", "director_address.example.com" )
46set $director_password$ = GetProductProperty( "director_password", "director_password" )
47
48Set $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
56Set $ProductId$ = "bacula"
57Set $ProductVer$ = "5.2.10"
58Set $MinimumSpace$ = "30 MB"
59; the path were we find the product after the installation
60Set $InstallDir$ = "%ProgramFilesDir%\Bacula"
61Set $InstallDir32$ = "%ProgramFiles32Dir%\Bacula"
62Set $InstallDir64$ = "%ProgramFiles64Dir%\Bacula"
63; opsi requires path seperation by "\\" instead of "\"
64Set $InstallDirOpsi$ = composeString( splitString ( $InstallDir$, "\"), "\\" )
65Set $LicenseRequired$ = "false"
66Set $LicensePool$ = "p_" + $ProductId$
67; ----------------------------------------------------------------
68
69if 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
73endif
74
75comment "Show product picture"
76ShowBitmap "%ScriptPath%\logo.png" $ProductId$
77
78if FileExists("%ScriptPath%\delsub3264.ins")
79 comment "Start uninstall sub section"
80 Sub "%ScriptPath%\delsub3264.ins"
81endif
82
83;if $LicenseRequired$ = "true"
84; comment "Licensing required, reserve license and get license key"
85; Sub_get_licensekey
86;endif
87
88comment "installing"
89
90if $filedaemon_full_name$ = ""
91 set $filedaemon_full_name$ = "%HostID%-fd"
92 opsiservicecall_set_product_property_filedaemon_full_name
93endif
94
95if $filedaemon_monitor_name$ = ""
96 set $filedaemon_monitor_name$ = "%HostID%-mon"
97 opsiservicecall_set_product_property_filedaemon_monitor_name
98endif
99
100
101if (($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
112endif
113
114if ($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
125endif
126
127;Patches_bacula_conf $InstallDir$+"\bacula-fd.conf"
128DosBatch_bacula-fd.conf
129
130;
131; end
132;
133
134
135
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
141
142[Winbatch_install_32]
143"%ScriptPath%\data\bacula-win32-$ProductVer$.exe" /S /D=$InstallDir32$
144
145[Winbatch_install_64]
146"%ScriptPath%\data\bacula-win64-$ProductVer$.exe" /S /D=$InstallDir64$
147
148[DosBatch_bacula-fd.conf]
149(
150echo #
151echo # managed by opsi
152echo #
153echo # "Global" File daemon configuration specifications
154echo #
155echo FileDaemon { # this is me
156echo Name = $filedaemon_full_name$
157echo FDport = 9102 # where we listen for the director
158echo WorkingDirectory = "$InstallDirOpsi$\\working"
159echo Pid Directory = "$InstallDirOpsi$\\working"
160echo Plugin Directory = "$InstallDirOpsi$\\plugins"
161echo Maximum Concurrent Jobs = 10
162echo }
163;echo
164echo #
165echo # List Directors who are permitted to contact this File daemon
166echo #
167echo Director {
168echo Name = $director_name$
169echo Password = "$filedaemon_full_password$"
170echo }
171;echo
172echo #
173echo # Restricted Director, used by tray-monitor to get the
174echo # status of the file daemon
175echo #
176echo Director {
177echo Name = $filedaemon_monitor_name$
178echo Password = "$filedaemon_monitor_password$"
179echo Monitor = yes
180echo }
181;echo
182echo # Send all messages except skipped files back to Director
183echo Messages {
184echo Name = Standard
185echo director = $director_name$ = all, !skipped, !restored
186echo }
187) > $InstallDir$/bacula-fd.conf
188
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]
197
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]
206
207
208[Files_install_32]
209; Example of recursively copying some files into the installation directory:
210;
211; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
212
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]
261comment "License management is enabled and will be used"
262
263comment "Trying to get a license key"
264Set $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
273DefVar $ServiceErrorClass$
274set $ServiceErrorClass$ = getLastServiceErrorClass
275comment "Error class: " + $ServiceErrorClass$
276
277if $ServiceErrorClass$ = "None"
278 comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
279else
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
290endif
291
292[Sub_check_exitcode]
293comment "Test for installation success via exit code"
294set $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
298if ($ExitCode$ = "0")
299 comment "Looks good: setup program gives exitcode zero"
300else
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
319endif
320
Note: See TracBrowser for help on using the repository browser.