source: opsi/products/wsusoffline/CLIENT_DATA/setup.ins@ 1067

Last change on this file since 1067 was 995, checked in by joergs, on May 11, 2012 at 1:27:38 PM

initial wsusoffline

File size: 7.0 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
26
27;
28; get product properties for options
29;
30; multi-value values are return as string, seperated by ",", eg. "value1,value2,value3",
31; therefore we replace "," by " " (split, compose)
32;
33DefVar $Options$
34Set $Options$ = composeString( splitString ( GetProductProperty("options",""), "," ), " " )
35
36comment "options: " + $Options$
37
38Set $LogDir$ = "%SystemDrive%\tmp"
39
40; ----------------------------------------------------------------
41; - Please edit the following values -
42; ----------------------------------------------------------------
43;$ProductId$ should be the name of the product in opsi
44; therefore please: only lower letters, no umlauts,
45; no white space use '-' as a seperator
46Set $ProductId$ = "wsusoffline"
47Set $MinimumSpace$ = "300 MB"
48; the path were we find the product after the installation
49Set $InstallDir32$ = "%ProgramFiles32Dir%\<path to the product>"
50Set $InstallDir64$ = "%ProgramFiles64Dir%\<path to the product>"
51Set $LicenseRequired$ = "false"
52Set $LicensePool$ = "p_" + $ProductId$
53; ----------------------------------------------------------------
54
55if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
56 LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
57 isFatalError
58 ; Stop process and set installation status to failed
59else
60 comment "Show product picture"
61 ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
62
63 ;if FileExists("%ScriptPath%\delsub3264.ins")
64 ; comment "Start uninstall sub section"
65 ; Sub "%ScriptPath%\delsub3264.ins"
66 ;endif
67
68 ;if $LicenseRequired$ = "true"
69 ; comment "Licensing required, reserve license and get license key"
70 ; Sub_get_licensekey
71 ;endif
72
73 comment "installing"
74
75 Message "Installing " + $ProductId$ + " ..."
76 comment "Start setup program"
77 Winbatch_install
78 Sub_check_exitcode
79 ;comment "Copy files"
80 ;Files_install_32 /32Bit
81 ;comment "Patch Registry"
82 ;Registry_install /32Bit
83 ;comment "Create shortcuts"
84 ;LinkFolder_install
85
86endif
87
88[Winbatch_install]
89"%ScriptPath%\exit-wrapper.cmd" "%ScriptPath%\client\cmd\DoUpdate.cmd" $Options$
90
91
92[Files_install_32]
93; Example of recursively copying some files into the installation directory:
94;
95; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"
96
97[Registry_install]
98; Example of setting some values of an registry key:
99;
100; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
101; set "name1" = "some string value"
102; set "name2" = REG_DWORD:0001
103; set "name3" = REG_BINARY:00 af 99 cd
104
105[LinkFolder_install]
106; Example of deleting a folder from AllUsers startmenu:
107;
108; set_basefolder common_programs
109; delete_subfolder $ProductId$
110;
111; Example of creating an shortcut to the installed exe in AllUsers startmenu:
112;
113; set_basefolder common_programs
114; set_subfolder $ProductId$
115;
116; set_link
117; name: $ProductId$
118; target: <path to the program>
119; parameters:
120; working_dir: $InstallDir$
121; icon_file:
122; icon_index:
123; end_link
124;
125; Example of creating an shortcut to the installed exe on AllUsers desktop:
126;
127; set_basefolder common_desktopdirectory
128; set_subfolder ""
129;
130; set_link
131; name: $ProductId$
132; target: <path to the program>
133; parameters: <some_param>
134; working_dir: $InstallDir$
135; icon_file: <path to icon file>
136; icon_index: 2
137; end_link
138
139[Sub_get_licensekey]
140comment "License management is enabled and will be used"
141
142comment "Trying to get a license key"
143Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
144; If there is an assignment of exactly one licensepool to the product the following call is possible:
145; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
146;
147; If there is an assignment of a license pool to a windows software id, it is possible to use:
148; DefVar $WindowsSoftwareId$
149; $WindowsSoftwareId$ = "..."
150; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
151
152DefVar $ServiceErrorClass$
153set $ServiceErrorClass$ = getLastServiceErrorClass
154comment "Error class: " + $ServiceErrorClass$
155
156if $ServiceErrorClass$ = "None"
157 comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
158else
159 if $ServiceErrorClass$ = "LicenseConfigurationError"
160 LogError "Fatal: license configuration must be corrected"
161 LogError getLastServiceErrorMessage
162 isFatalError
163 else
164 if $ServiceErrorClass$ = "LicenseMissingError"
165 LogError "Fatal: required license is not supplied"
166 isFatalError
167 endif
168 endif
169endif
170
171
172
173[Sub_check_exitcode]
174comment "Test for installation success via exit code"
175set $ExitCode$ = getLastExitCode
176; informations to exit codes see
177; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
178; http://msdn.microsoft.com/en-us/library/aa368542.aspx
179if ($ExitCode$ = "0")
180 comment "Looks good: setup program gives exitcode zero"
181else
182 comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
183 if ($ExitCode$ = "1605")
184 comment "ERROR_UNKNOWN_PRODUCT 1605 This action is only valid for products that are currently installed."
185 comment "Uninstall of a not installed product failed - no problem"
186 else
187 if ($ExitCode$ = "1641")
188 comment "looks good: setup program gives exitcode 1641"
189 comment "ERROR_SUCCESS_REBOOT_INITIATED 1641 The installer has initiated a restart. This message is indicative of a success."
190 ExitWindows /Reboot
191 else
192 if ($ExitCode$ = "3010")
193 comment "looks good: setup program gives exitcode 3010"
194 comment "ERROR_SUCCESS_REBOOT_REQUIRED 3010 A restart is required to complete the install. This message is indicative of a success."
195 ExitWindows /Reboot
196 else
197 if ($ExitCode$ = "3011")
198 comment "looks good: setup program gives exitcode 3011"
199 comment "ERROR_SUCCESS: wsusoffline requires reboot and rerun."
200 ExitWindows /ImmediateReboot
201 else
202 logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
203 isFatalError
204 endif
205 endif
206 endif
207 endif
208endif
209
Note: See TracBrowser for help on using the repository browser.