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]
|
---|
7 | requiredWinstVersion >= "4.10.8.6"
|
---|
8 |
|
---|
9 | DefVar $MsiId32$
|
---|
10 | DefVar $UninstallProgram32$
|
---|
11 | DefVar $MsiId64$
|
---|
12 | DefVar $UninstallProgram64$
|
---|
13 | DefVar $LogDir$
|
---|
14 | DefVar $ProductId$
|
---|
15 | DefVar $ProductVer$
|
---|
16 | DefVar $MinimumSpace$
|
---|
17 | DefVar $InstallDir$
|
---|
18 | DefVar $InstallDir32$
|
---|
19 | DefVar $InstallDir64$
|
---|
20 | DefVar $ExitCode$
|
---|
21 | DefVar $LicenseRequired$
|
---|
22 | DefVar $LicenseKey$
|
---|
23 | DefVar $LicensePool$
|
---|
24 | DefVar $INST_SystemType$
|
---|
25 | DefVar $INST_architecture$
|
---|
26 |
|
---|
27 | DefVar $filedaemon_full_name$
|
---|
28 | DefVar $filedaemon_full_password$
|
---|
29 | DefVar $filedaemon_monitor_name$
|
---|
30 | DefVar $filedaemon_monitor_password$
|
---|
31 | DefVar $director_name$
|
---|
32 | DefVar $director_address$
|
---|
33 | DefVar $director_password$
|
---|
34 |
|
---|
35 |
|
---|
36 | Set $INST_SystemType$ = GetSystemType
|
---|
37 | set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
|
---|
38 |
|
---|
39 | set $filedaemon_full_name$ = GetProductProperty( "filedaemon_full_name", "" )
|
---|
40 | set $filedaemon_full_password$ = GetProductProperty( "filedaemon_full_password", "filedaemon_full_password" )
|
---|
41 | set $filedaemon_monitor_name$ = GetProductProperty( "filedaemon_monitor_name", "" )
|
---|
42 | set $filedaemon_monitor_password$ = GetProductProperty( "filedaemon_monitor_password", "filedaemon_monitor_password" )
|
---|
43 | set $director_name$ = GetProductProperty( "director_name", "director_name" )
|
---|
44 | set $director_address$ = GetProductProperty( "director_address", "director_address.example.com" )
|
---|
45 | set $director_password$ = GetProductProperty( "director_password", "director_password" )
|
---|
46 |
|
---|
47 | Set $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
|
---|
55 | Set $ProductId$ = "bacula"
|
---|
56 | Set $ProductVer$ = "5.2.10"
|
---|
57 | Set $MinimumSpace$ = "30 MB"
|
---|
58 | ; the path were we find the product after the installation
|
---|
59 | Set $InstallDir$ = "%ProgramFilesDir%\Bacula"
|
---|
60 | Set $InstallDir32$ = "%ProgramFiles32Dir%\Bacula"
|
---|
61 | Set $InstallDir64$ = "%ProgramFiles64Dir%\Bacula"
|
---|
62 | Set $LicenseRequired$ = "false"
|
---|
63 | Set $LicensePool$ = "p_" + $ProductId$
|
---|
64 | ; ----------------------------------------------------------------
|
---|
65 |
|
---|
66 | if 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
|
---|
70 | endif
|
---|
71 |
|
---|
72 | comment "Show product picture"
|
---|
73 | ShowBitmap "%ScriptPath%\logo.png" $ProductId$
|
---|
74 |
|
---|
75 | if FileExists("%ScriptPath%\delsub3264.ins")
|
---|
76 | comment "Start uninstall sub section"
|
---|
77 | Sub "%ScriptPath%\delsub3264.ins"
|
---|
78 | endif
|
---|
79 |
|
---|
80 | ;if $LicenseRequired$ = "true"
|
---|
81 | ; comment "Licensing required, reserve license and get license key"
|
---|
82 | ; Sub_get_licensekey
|
---|
83 | ;endif
|
---|
84 |
|
---|
85 | comment "installing"
|
---|
86 |
|
---|
87 | if $filedaemon_full_name$ = ""
|
---|
88 | set $filedaemon_full_name$ = "%HostID%-fd"
|
---|
89 | opsiservicecall_set_product_property_filedaemon_full_name
|
---|
90 | endif
|
---|
91 |
|
---|
92 | if $filedaemon_monitor_name$ = ""
|
---|
93 | set $filedaemon_monitor_name$ = "%HostID%-mon"
|
---|
94 | opsiservicecall_set_product_property_filedaemon_monitor_name
|
---|
95 | endif
|
---|
96 |
|
---|
97 |
|
---|
98 | if (($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
|
---|
109 | endif
|
---|
110 |
|
---|
111 | if ($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
|
---|
122 | endif
|
---|
123 |
|
---|
124 | ;Patches_bacula_conf $InstallDir$+"\bacula-fd.conf"
|
---|
125 | DosBatch_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 | (
|
---|
147 | echo # managed by opsi
|
---|
148 | echo #
|
---|
149 | echo # "Global" File daemon configuration specifications
|
---|
150 | echo #
|
---|
151 | echo FileDaemon { # this is me
|
---|
152 | echo Name = $filedaemon_full_name$
|
---|
153 | echo FDport = 9102 # where we listen for the director
|
---|
154 | echo WorkingDirectory = "$InstallDir32$\\working"
|
---|
155 | echo Pid Directory = "$InstallDir32$\\working"
|
---|
156 | echo Plugin Directory = "$InstallDir32$\\plugins"
|
---|
157 | echo Maximum Concurrent Jobs = 10
|
---|
158 | echo }
|
---|
159 | ;echo
|
---|
160 | echo #
|
---|
161 | echo # List Directors who are permitted to contact this File daemon
|
---|
162 | echo #
|
---|
163 | echo Director {
|
---|
164 | echo Name = $director_name$
|
---|
165 | echo Password = "$filedaemon_full_password$"
|
---|
166 | echo }
|
---|
167 | ;echo
|
---|
168 | echo #
|
---|
169 | echo # Restricted Director, used by tray-monitor to get the
|
---|
170 | echo # status of the file daemon
|
---|
171 | echo #
|
---|
172 | echo Director {
|
---|
173 | echo Name = $filedaemon_monitor_name$
|
---|
174 | echo Password = "$filedaemon_monitor_password$"
|
---|
175 | echo Monitor = yes
|
---|
176 | echo }
|
---|
177 | ;echo
|
---|
178 | echo # Send all messages except skipped files back to Director
|
---|
179 | echo Messages {
|
---|
180 | echo Name = Standard
|
---|
181 | echo director = $director_name$ = all, !skipped, !restored
|
---|
182 | echo }
|
---|
183 | ) >> $InstallDir$/bacula-fd.conf
|
---|
184 |
|
---|
185 | [opsiservicecall_set_product_property_filedaemon_full_name]
|
---|
186 | "method": "setProductProperty",
|
---|
187 | "params": [
|
---|
188 | 'bacula',
|
---|
189 | 'filedaemon_full_name',
|
---|
190 | '$filedaemon_full_name$',
|
---|
191 | '%HostID%'
|
---|
192 | ]
|
---|
193 |
|
---|
194 | [opsiservicecall_set_product_property_filedaemon_monitor_name]
|
---|
195 | "method": "setProductProperty",
|
---|
196 | "params": [
|
---|
197 | 'bacula',
|
---|
198 | 'filedaemon_monitor_name',
|
---|
199 | '$filedaemon_monitor_name$',
|
---|
200 | '%HostID%'
|
---|
201 | ]
|
---|
202 |
|
---|
203 |
|
---|
204 | [Files_install_32]
|
---|
205 | ; Example of recursively copying some files into the installation directory:
|
---|
206 | ;
|
---|
207 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
|
---|
208 |
|
---|
209 | [Files_install_64]
|
---|
210 | ; Example of recursively copying some files into the installation directory:
|
---|
211 | ;
|
---|
212 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
|
---|
213 |
|
---|
214 | [Registry_install]
|
---|
215 | ; Example of setting some values of an registry key:
|
---|
216 | ;
|
---|
217 | ; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
---|
218 | ; set "name1" = "some string value"
|
---|
219 | ; set "name2" = REG_DWORD:0001
|
---|
220 | ; set "name3" = REG_BINARY:00 af 99 cd
|
---|
221 |
|
---|
222 | [LinkFolder_install]
|
---|
223 | ; Example of deleting a folder from AllUsers startmenu:
|
---|
224 | ;
|
---|
225 | ; set_basefolder common_programs
|
---|
226 | ; delete_subfolder $ProductId$
|
---|
227 | ;
|
---|
228 | ; Example of creating an shortcut to the installed exe in AllUsers startmenu:
|
---|
229 | ;
|
---|
230 | ; set_basefolder common_programs
|
---|
231 | ; set_subfolder $ProductId$
|
---|
232 | ;
|
---|
233 | ; set_link
|
---|
234 | ; name: $ProductId$
|
---|
235 | ; target: <path to the program>
|
---|
236 | ; parameters:
|
---|
237 | ; working_dir: $InstallDir$
|
---|
238 | ; icon_file:
|
---|
239 | ; icon_index:
|
---|
240 | ; end_link
|
---|
241 | ;
|
---|
242 | ; Example of creating an shortcut to the installed exe on AllUsers desktop:
|
---|
243 | ;
|
---|
244 | ; set_basefolder common_desktopdirectory
|
---|
245 | ; set_subfolder ""
|
---|
246 | ;
|
---|
247 | ; set_link
|
---|
248 | ; name: $ProductId$
|
---|
249 | ; target: <path to the program>
|
---|
250 | ; parameters: <some_param>
|
---|
251 | ; working_dir: $InstallDir$
|
---|
252 | ; icon_file: <path to icon file>
|
---|
253 | ; icon_index: 2
|
---|
254 | ; end_link
|
---|
255 |
|
---|
256 | [Sub_get_licensekey]
|
---|
257 | comment "License management is enabled and will be used"
|
---|
258 |
|
---|
259 | comment "Trying to get a license key"
|
---|
260 | Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
|
---|
261 | ; If there is an assignment of exactly one licensepool to the product the following call is possible:
|
---|
262 | ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
|
---|
263 | ;
|
---|
264 | ; If there is an assignment of a license pool to a windows software id, it is possible to use:
|
---|
265 | ; DefVar $WindowsSoftwareId$
|
---|
266 | ; $WindowsSoftwareId$ = "..."
|
---|
267 | ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
|
---|
268 |
|
---|
269 | DefVar $ServiceErrorClass$
|
---|
270 | set $ServiceErrorClass$ = getLastServiceErrorClass
|
---|
271 | comment "Error class: " + $ServiceErrorClass$
|
---|
272 |
|
---|
273 | if $ServiceErrorClass$ = "None"
|
---|
274 | comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
|
---|
275 | else
|
---|
276 | if $ServiceErrorClass$ = "LicenseConfigurationError"
|
---|
277 | LogError "Fatal: license configuration must be corrected"
|
---|
278 | LogError getLastServiceErrorMessage
|
---|
279 | isFatalError
|
---|
280 | else
|
---|
281 | if $ServiceErrorClass$ = "LicenseMissingError"
|
---|
282 | LogError "Fatal: required license is not supplied"
|
---|
283 | isFatalError
|
---|
284 | endif
|
---|
285 | endif
|
---|
286 | endif
|
---|
287 |
|
---|
288 | [Sub_check_exitcode]
|
---|
289 | comment "Test for installation success via exit code"
|
---|
290 | set $ExitCode$ = getLastExitCode
|
---|
291 | ; informations to exit codes see
|
---|
292 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
293 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
294 | if ($ExitCode$ = "0")
|
---|
295 | comment "Looks good: setup program gives exitcode zero"
|
---|
296 | else
|
---|
297 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
298 | if ($ExitCode$ = "1605")
|
---|
299 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
300 | comment "Uninstall of a not installed product failed - no problem"
|
---|
301 | else
|
---|
302 | if ($ExitCode$ = "1641")
|
---|
303 | comment "looks good: setup program gives exitcode 1641"
|
---|
304 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
305 | else
|
---|
306 | if ($ExitCode$ = "3010")
|
---|
307 | comment "looks good: setup program gives exitcode 3010"
|
---|
308 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
309 | else
|
---|
310 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
311 | isFatalError
|
---|
312 | endif
|
---|
313 | endif
|
---|
314 | endif
|
---|
315 | endif
|
---|
316 |
|
---|