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

Last change on this file since 1089 was 1038, checked in by joergs, on Aug 1, 2012 at 4:48:09 PM

bugfix

File size: 10.1 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 $ExitCode$
21DefVar $LicenseRequired$
22DefVar $LicenseKey$
23DefVar $LicensePool$
24DefVar $INST_SystemType$
25DefVar $INST_architecture$
26
27DefVar $filedaemon_full_name$
28DefVar $filedaemon_full_password$
29DefVar $filedaemon_monitor_name$
30DefVar $filedaemon_monitor_password$
31DefVar $director_name$
32DefVar $director_address$
33DefVar $director_password$
34
35
36Set $INST_SystemType$ = GetSystemType
37set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
38
39set $filedaemon_full_name$ = GetProductProperty( "filedaemon_full_name", "" )
40set $filedaemon_full_password$ = GetProductProperty( "filedaemon_full_password", "filedaemon_full_password" )
41set $filedaemon_monitor_name$ = GetProductProperty( "filedaemon_monitor_name", "" )
42set $filedaemon_monitor_password$ = GetProductProperty( "filedaemon_monitor_password", "filedaemon_monitor_password" )
43set $director_name$ = GetProductProperty( "director_name", "director_name" )
44set $director_address$ = GetProductProperty( "director_address", "director_address.example.com" )
45set $director_password$ = GetProductProperty( "director_password", "director_password" )
46
47Set $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
55Set $ProductId$ = "bacula"
56Set $ProductVer$ = "5.2.10"
57Set $MinimumSpace$ = "30 MB"
58; the path were we find the product after the installation
59Set $InstallDir$ = "%ProgramFilesDir%\Bacula"
60Set $InstallDir32$ = "%ProgramFiles32Dir%\Bacula"
61Set $InstallDir64$ = "%ProgramFiles64Dir%\Bacula"
62Set $LicenseRequired$ = "false"
63Set $LicensePool$ = "p_" + $ProductId$
64; ----------------------------------------------------------------
65
66if 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
70endif
71
72comment "Show product picture"
73ShowBitmap "%ScriptPath%\logo.png" $ProductId$
74
75if FileExists("%ScriptPath%\delsub3264.ins")
76 comment "Start uninstall sub section"
77 Sub "%ScriptPath%\delsub3264.ins"
78endif
79
80;if $LicenseRequired$ = "true"
81; comment "Licensing required, reserve license and get license key"
82; Sub_get_licensekey
83;endif
84
85comment "installing"
86
87if $filedaemon_full_name$ = ""
88 set $filedaemon_full_name$ = "%HostID%-fd"
89 opsiservicecall_set_product_property_filedaemon_full_name
90endif
91
92if $filedaemon_monitor_name$ = ""
93 set $filedaemon_monitor_name$ = "%HostID%-mon"
94 opsiservicecall_set_product_property_filedaemon_monitor_name
95endif
96
97
98if (($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
109endif
110
111if ($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
122endif
123
124;Patches_bacula_conf $InstallDir$+"\bacula-fd.conf"
125DosBatch_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(
147echo #
148echo # managed by opsi
149echo #
150echo # "Global" File daemon configuration specifications
151echo #
152echo FileDaemon { # this is me
153echo Name = $filedaemon_full_name$
154echo FDport = 9102 # where we listen for the director
155echo WorkingDirectory = "$InstallDir32$\\working"
156echo Pid Directory = "$InstallDir32$\\working"
157echo Plugin Directory = "$InstallDir32$\\plugins"
158echo Maximum Concurrent Jobs = 10
159echo }
160;echo
161echo #
162echo # List Directors who are permitted to contact this File daemon
163echo #
164echo Director {
165echo Name = $director_name$
166echo Password = "$filedaemon_full_password$"
167echo }
168;echo
169echo #
170echo # Restricted Director, used by tray-monitor to get the
171echo # status of the file daemon
172echo #
173echo Director {
174echo Name = $filedaemon_monitor_name$
175echo Password = "$filedaemon_monitor_password$"
176echo Monitor = yes
177echo }
178;echo
179echo # Send all messages except skipped files back to Director
180echo Messages {
181echo Name = Standard
182echo director = $director_name$ = all, !skipped, !restored
183echo }
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]
258comment "License management is enabled and will be used"
259
260comment "Trying to get a license key"
261Set $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
270DefVar $ServiceErrorClass$
271set $ServiceErrorClass$ = getLastServiceErrorClass
272comment "Error class: " + $ServiceErrorClass$
273
274if $ServiceErrorClass$ = "None"
275 comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
276else
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
287endif
288
289[Sub_check_exitcode]
290comment "Test for installation success via exit code"
291set $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
295if ($ExitCode$ = "0")
296 comment "Looks good: setup program gives exitcode zero"
297else
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
316endif
317
Note: See TracBrowser for help on using the repository browser.