source: opsi/products/xenserver-tools/CLIENT_DATA/setup64.ins@ 949

Last change on this file since 949 was 949, checked in by joergs, on Jun 18, 2011 at 7:21:18 PM

opsi-template

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