source: opsi/products/xenserver-tools/CLIENT_DATA/setup.ins@ 1107

Last change on this file since 1107 was 950, checked in by joergs, on Jun 18, 2011 at 11:42:56 PM

adapted for Citrix XenServer Tools

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