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 $InstallDir32$
|
---|
18 | DefVar $InstallDir64$
|
---|
19 | DefVar $ExitCode$
|
---|
20 | DefVar $LicenseRequired$
|
---|
21 | DefVar $LicenseKey$
|
---|
22 | DefVar $LicensePool$
|
---|
23 | DefVar $INST_SystemType$
|
---|
24 | DefVar $INST_architecture$
|
---|
25 |
|
---|
26 | Set $INST_SystemType$ = GetSystemType
|
---|
27 | set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
|
---|
28 |
|
---|
29 |
|
---|
30 | Set $LogDir$ = "%SystemDrive%\tmp"
|
---|
31 |
|
---|
32 | ; ----------------------------------------------------------------
|
---|
33 | ; - Please edit the following values -
|
---|
34 | ; ----------------------------------------------------------------
|
---|
35 | ;$ProductId$ should be the name of the product in opsi
|
---|
36 | ; therefore please: only lower letters, no umlauts,
|
---|
37 | ; no white space use '-' as a seperator
|
---|
38 | Set $ProductId$ = "bacula"
|
---|
39 | Set $ProductVer$ = "5.2.10"
|
---|
40 | Set $MinimumSpace$ = "20 MB"
|
---|
41 | ; the path were we find the product after the installation
|
---|
42 | Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
|
---|
43 | Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
|
---|
44 | Set $LicenseRequired$ = "false"
|
---|
45 | Set $LicensePool$ = "p_" + $ProductId$
|
---|
46 | ; ----------------------------------------------------------------
|
---|
47 |
|
---|
48 | if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
|
---|
49 | LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
|
---|
50 | isFatalError
|
---|
51 | ; Stop process and set installation status to failed
|
---|
52 | else
|
---|
53 | comment "Show product picture"
|
---|
54 | ShowBitmap "%ScriptPath%\logo.png" $ProductId$
|
---|
55 |
|
---|
56 | if FileExists("%ScriptPath%\delsub3264.ins")
|
---|
57 | comment "Start uninstall sub section"
|
---|
58 | Sub "%ScriptPath%\delsub3264.ins"
|
---|
59 | endif
|
---|
60 |
|
---|
61 | ;if $LicenseRequired$ = "true"
|
---|
62 | ; comment "Licensing required, reserve license and get license key"
|
---|
63 | ; Sub_get_licensekey
|
---|
64 | ;endif
|
---|
65 |
|
---|
66 | comment "installing"
|
---|
67 |
|
---|
68 | if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
|
---|
69 | Message "Installing " + $ProductId$ + " 32 Bit..."
|
---|
70 | comment "Start setup program"
|
---|
71 | Winbatch_install_32
|
---|
72 | Sub_check_exitcode
|
---|
73 | ;comment "Copy files"
|
---|
74 | ;Files_install_32 /32Bit
|
---|
75 | ;comment "Patch Registry"
|
---|
76 | ;Registry_install /32Bit
|
---|
77 | ;comment "Create shortcuts"
|
---|
78 | ;LinkFolder_install
|
---|
79 | endif
|
---|
80 |
|
---|
81 | if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
|
---|
82 | Message "Installing " + $ProductId$ + " 64 Bit..."
|
---|
83 | comment "Start setup program"
|
---|
84 | Winbatch_install_64
|
---|
85 | Sub_check_exitcode
|
---|
86 | ;comment "Copy files"
|
---|
87 | ;Files_install_64 /64Bit
|
---|
88 | ;comment "Patch Registry"
|
---|
89 | ;Registry_install /64Bit
|
---|
90 | ;comment "Create shortcuts"
|
---|
91 | ;LinkFolder_install
|
---|
92 | endif
|
---|
93 |
|
---|
94 | endif
|
---|
95 |
|
---|
96 | [Winbatch_install_32]
|
---|
97 | ; Choose one of the following examples as basis for your installation
|
---|
98 | ; You can use $LicenseKey$ var to pass a license key to the installer
|
---|
99 | ;
|
---|
100 | ; === Nullsoft Scriptable Install System ================================================================
|
---|
101 | ; "%ScriptPath%\Setup.exe" /S
|
---|
102 | ;
|
---|
103 | ; === MSI package =======================================================================================
|
---|
104 | ; You may use the parameter PIDKEY=$Licensekey$
|
---|
105 | ; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress
|
---|
106 | ;
|
---|
107 | ; === InstallShield + MSI=====================================================================================
|
---|
108 | ; Attention: The path to the log file should not contain any whitespaces
|
---|
109 | ; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=2 REBOOT=ReallySuppress"
|
---|
110 | ; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress"
|
---|
111 | ;
|
---|
112 | ; === InstallShield =====================================================================================
|
---|
113 | ; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss"
|
---|
114 | ; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt"
|
---|
115 | ;
|
---|
116 | ; === Inno Setup ========================================================================================
|
---|
117 | ; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html
|
---|
118 | ; You may create setup answer file by: setup.exe /SAVEINF="filename"
|
---|
119 | ; You may use an answer file by the parameter /LOADINF="filename"
|
---|
120 | ; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES
|
---|
121 |
|
---|
122 | "%ScriptPath%\data\bacula-win32-$ProductVer$.exe" /S
|
---|
123 |
|
---|
124 |
|
---|
125 |
|
---|
126 | [Files_install_32]
|
---|
127 | ; Example of recursively copying some files into the installation directory:
|
---|
128 | ;
|
---|
129 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
|
---|
130 |
|
---|
131 | [Winbatch_install_64]
|
---|
132 | ; Choose one of the following examples as basis for your installation
|
---|
133 | ; You can use $LicenseKey$ var to pass a license key to the installer
|
---|
134 | ;
|
---|
135 | ; === Nullsoft Scriptable Install System ================================================================
|
---|
136 | ; "%ScriptPath%\Setup.exe" /S
|
---|
137 | ;
|
---|
138 | ; === MSI package =======================================================================================
|
---|
139 | ; You may use the parameter PIDKEY=$Licensekey$
|
---|
140 | ; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress
|
---|
141 | ;
|
---|
142 | ; === InstallShield + MSI=====================================================================================
|
---|
143 | ; Attention: The path to the log file should not contain any whitespaces
|
---|
144 | ; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=2 REBOOT=ReallySuppress"
|
---|
145 | ; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress"
|
---|
146 | ;
|
---|
147 | ; === InstallShield =====================================================================================
|
---|
148 | ; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss"
|
---|
149 | ; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt"
|
---|
150 | ;
|
---|
151 | ; === Inno Setup ========================================================================================
|
---|
152 | ; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html
|
---|
153 | ; You may create setup answer file by: setup.exe /SAVEINF="filename"
|
---|
154 | ; You may use an answer file by the parameter /LOADINF="filename"
|
---|
155 | ; "%ScriptPath%\setup.exe" /sp- /silent /norestart /nocancel /SUPPRESSMSGBOXES
|
---|
156 |
|
---|
157 | "%ScriptPath%\data\bacula-win64-$ProductVer$.exe" /S
|
---|
158 |
|
---|
159 |
|
---|
160 |
|
---|
161 | [Files_install_64]
|
---|
162 | ; Example of recursively copying some files into the installation directory:
|
---|
163 | ;
|
---|
164 | ; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$"
|
---|
165 |
|
---|
166 | [Registry_install]
|
---|
167 | ; Example of setting some values of an registry key:
|
---|
168 | ;
|
---|
169 | ; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
|
---|
170 | ; set "name1" = "some string value"
|
---|
171 | ; set "name2" = REG_DWORD:0001
|
---|
172 | ; set "name3" = REG_BINARY:00 af 99 cd
|
---|
173 |
|
---|
174 | [LinkFolder_install]
|
---|
175 | ; Example of deleting a folder from AllUsers startmenu:
|
---|
176 | ;
|
---|
177 | ; set_basefolder common_programs
|
---|
178 | ; delete_subfolder $ProductId$
|
---|
179 | ;
|
---|
180 | ; Example of creating an shortcut to the installed exe in AllUsers startmenu:
|
---|
181 | ;
|
---|
182 | ; set_basefolder common_programs
|
---|
183 | ; set_subfolder $ProductId$
|
---|
184 | ;
|
---|
185 | ; set_link
|
---|
186 | ; name: $ProductId$
|
---|
187 | ; target: <path to the program>
|
---|
188 | ; parameters:
|
---|
189 | ; working_dir: $InstallDir$
|
---|
190 | ; icon_file:
|
---|
191 | ; icon_index:
|
---|
192 | ; end_link
|
---|
193 | ;
|
---|
194 | ; Example of creating an shortcut to the installed exe on AllUsers desktop:
|
---|
195 | ;
|
---|
196 | ; set_basefolder common_desktopdirectory
|
---|
197 | ; set_subfolder ""
|
---|
198 | ;
|
---|
199 | ; set_link
|
---|
200 | ; name: $ProductId$
|
---|
201 | ; target: <path to the program>
|
---|
202 | ; parameters: <some_param>
|
---|
203 | ; working_dir: $InstallDir$
|
---|
204 | ; icon_file: <path to icon file>
|
---|
205 | ; icon_index: 2
|
---|
206 | ; end_link
|
---|
207 |
|
---|
208 | [Sub_get_licensekey]
|
---|
209 | comment "License management is enabled and will be used"
|
---|
210 |
|
---|
211 | comment "Trying to get a license key"
|
---|
212 | Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
|
---|
213 | ; If there is an assignment of exactly one licensepool to the product the following call is possible:
|
---|
214 | ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
|
---|
215 | ;
|
---|
216 | ; If there is an assignment of a license pool to a windows software id, it is possible to use:
|
---|
217 | ; DefVar $WindowsSoftwareId$
|
---|
218 | ; $WindowsSoftwareId$ = "..."
|
---|
219 | ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
|
---|
220 |
|
---|
221 | DefVar $ServiceErrorClass$
|
---|
222 | set $ServiceErrorClass$ = getLastServiceErrorClass
|
---|
223 | comment "Error class: " + $ServiceErrorClass$
|
---|
224 |
|
---|
225 | if $ServiceErrorClass$ = "None"
|
---|
226 | comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
|
---|
227 | else
|
---|
228 | if $ServiceErrorClass$ = "LicenseConfigurationError"
|
---|
229 | LogError "Fatal: license configuration must be corrected"
|
---|
230 | LogError getLastServiceErrorMessage
|
---|
231 | isFatalError
|
---|
232 | else
|
---|
233 | if $ServiceErrorClass$ = "LicenseMissingError"
|
---|
234 | LogError "Fatal: required license is not supplied"
|
---|
235 | isFatalError
|
---|
236 | endif
|
---|
237 | endif
|
---|
238 | endif
|
---|
239 |
|
---|
240 | [Sub_check_exitcode]
|
---|
241 | comment "Test for installation success via exit code"
|
---|
242 | set $ExitCode$ = getLastExitCode
|
---|
243 | ; informations to exit codes see
|
---|
244 | ; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
|
---|
245 | ; http://msdn.microsoft.com/en-us/library/aa368542.aspx
|
---|
246 | if ($ExitCode$ = "0")
|
---|
247 | comment "Looks good: setup program gives exitcode zero"
|
---|
248 | else
|
---|
249 | comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
|
---|
250 | if ($ExitCode$ = "1605")
|
---|
251 | comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
|
---|
252 | comment "Uninstall of a not installed product failed - no problem"
|
---|
253 | else
|
---|
254 | if ($ExitCode$ = "1641")
|
---|
255 | comment "looks good: setup program gives exitcode 1641"
|
---|
256 | comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
|
---|
257 | else
|
---|
258 | if ($ExitCode$ = "3010")
|
---|
259 | comment "looks good: setup program gives exitcode 3010"
|
---|
260 | comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
|
---|
261 | else
|
---|
262 | logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
|
---|
263 | isFatalError
|
---|
264 | endif
|
---|
265 | endif
|
---|
266 | endif
|
---|
267 | endif
|
---|
268 |
|
---|