Code

source: microsoft.office2007/CLIENT_DATA/setup32.ins @ 899e1f

Revision 899e1f, 7.3 KB checked in by geos_one, 7 years ago (diff)

no check for exit code for remove

  • Property mode set to 100644
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/en/credits/
5
6[Actions]
7requiredWinstVersion >= "4.11.2.6"
8
9DefVar $MsiIdOld$
10DefVar $IniFile$
11DefVar $IniCfgFile$
12DefVar $LogDir$
13DefVar $ProductId$ 
14DefVar $MinimumSpace$
15DefVar $InstallDir$
16DefVar $ExitCode$
17DefVar $LicenseRequired$
18DefVar $LicenseKey$
19DefVar $LicensePool$
20DefVar $OLD_VERSION$
21DefVar $OLD_CREATOR_TAG$
22DefVar $OLD_RELEASE$
23
24Set $LogDir$ = "%SystemDrive%\tmp"
25
26; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh
27; and adds the following variables:
28;   from builder-product.cfg :  all variables definded by attribute WINST[index]
29;   from builder-product.cfg :  VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE   
30;   from opsi-builder.cfg    :  CREATOR_TAG CREATOR_NAME CREATOR_EMAIL           
31;   auto generated winst-variables
32;         $IconFile$: path to product picture
33;
34@@BUILDER_VARIABLES@@
35
36; ----------------------------------------------------------------
37; - Please edit the following values                             -
38; ----------------------------------------------------------------
39;$ProductId$ should be the name of the product in opsi
40; therefore please: only lower letters, no umlauts,
41; no white space use '-' as a seperator
42Set $MinimumSpace$    = "1500 MB"
43; the path were we find the product after the installation
44Set $InstallDir$      = "%ProgramFiles32Dir%\Microsoft Office\Office12"
45Set $LicenseRequired$ = "true"
46Set $LicensePool$     = "p_" + $ProductId$
47; ----------------------------------------------------------------
48
49Set $IniCfgFile$ = "%ScriptPath%\opsi-" + $ProductId$ + ".ini"
50
51if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
52        LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
53        isFatalError "No Space"
54        ; Stop process and set installation status to failed
55else
56        comment "Show product picture"
57        ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $NAME$
58       
59        if FileExists("%ScriptPath%\delsub32.ins")
60                comment "Start uninstall sub section"
61                Sub "%ScriptPath%\delsub32.ins"
62        endif
63       
64        Message "Installing " + $ProductId$ + " "+ $VERSION$ + "-" + $CREATOR_TAG$ + $RELEASE$ + " ..."
65       
66        if $LicenseRequired$ = "true"
67                comment "Licensing required, reserve license and get license key"
68                Sub_get_licensekey
69        endif
70       
71        comment "Remove Install Files"
72        Winbatch_remove
73
74        comment "Extract Office"
75        Winbatch_extract
76        Sub_check_exitcode
77
78        comment "Extract Office Updates"
79        Winbatch_update
80        Sub_check_exitcode
81
82        comment "Create License File"
83        Dosbatch_license
84        Sub_check_exitcode
85
86        comment "Start setup program"
87        Winbatch_install
88        Sub_check_exitcode
89
90        comment "Remove Install Files"
91        Winbatch_remove
92
93        comment "Start setup program"
94        ChangeDirectory "%SCRIPTPATH%"
95        Winbatch_install
96        Sub_check_exitcode
97       
98        Winbatch_install_odf
99        Sub_check_exitcode
100       
101        comment "Copy files"
102        Files_install /32Bit
103       
104        comment "Patch Registry"
105        Registry_install /32Bit
106       
107        comment "Create shortcuts"
108        LinkFolder_install
109       
110endif
111
112[Winbatch_extract]
113$InstallExe$ /quiet /extract:$LogDir$\msoffice2007
114
115[Winbatch_update]
116$InstallSp3Exe$ /quiet /extract:$LogDir$\msoffice2007\Updates
117
118[Dosbatch_license]
119xml ed -O -u "/Configuration/PIDKEY/@Value" -v $LicenseKey$ -u "/Configuration/USERNAME/@Value" -v %HostID% -u "/Configuration/COMPANYNAME/@Value" -v %HostID% -u "/Configuration/INSTALLLOCATION/@Value" -v "$InstallDir$" %ScriptPath%\config.xml > $LogDir$\msoffice2007.xml
120
121[Winbatch_install]
122"$LogDir$\msoffice2007\SETUP.EXE" /config "$LogDir$\msoffice2007.xml"
123
124[Winbatch_install_odf]
125msiexec /i "$OdfAddInExe$" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=1 REBOOT=ReallySuppress
126
127[Winbatch_remove]
128delete -sf "$LogDir$\msoffice2007\"
129
130[Files_install]
131; copy the ini file to the InstallDir
132copy "$IniCfgFile$" "$InstallDir$"
133
134; Example of recursively copying some files into the installation directory:
135;
136; copy -s "%ScriptPath%\files\*.*" "$InstallDir$"
137
138[Registry_install]
139; Example of setting some values of an registry key:
140;
141; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$]
142; set "name1" = "some string value"
143; set "name2" = REG_DWORD:0001
144; set "name3" = REG_BINARY:00 af 99 cd
145
146[LinkFolder_install]
147; Example of deleting a folder from AllUsers startmenu:
148;
149; set_basefolder common_programs
150; delete_subfolder $ProductId$
151;
152; Example of creating an shortcut to the installed exe in AllUsers startmenu:
153;
154; set_basefolder common_programs
155; set_subfolder $ProductId$
156;
157; set_link
158;       name: $ProductId$
159;       target: <path to the program>
160;       parameters:
161;       working_dir: $InstallDir$
162;       icon_file:
163;       icon_index:
164; end_link
165;
166; Example of creating an shortcut to the installed exe on AllUsers desktop:
167;
168; set_basefolder common_desktopdirectory
169; set_subfolder ""
170;
171; set_link
172;       name: $ProductId$
173;       target: <path to the program>
174;       parameters: <some_param>
175;       working_dir: $InstallDir$
176;       icon_file: <path to icon file>
177;       icon_index: 2
178; end_link
179
180[Sub_get_licensekey]
181if opsiLicenseManagementEnabled
182        comment "License management is enabled and will be used"
183
184        comment "Trying to get a license key"
185        Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
186        ; If there is an assignment of exactly one licensepool to the product the following call is possible:
187        ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
188        ;
189        ; If there is an assignment of a license pool to a windows software id, it is possible to use:
190        ; DefVar $WindowsSoftwareId$
191        ; $WindowsSoftwareId$ = "..."
192        ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
193       
194        DefVar $ServiceErrorClass$
195        set $ServiceErrorClass$ = getLastServiceErrorClass
196        comment "Error class: " + $ServiceErrorClass$
197       
198        if $ServiceErrorClass$ = "None"
199                comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
200        else
201                if $ServiceErrorClass$ = "LicenseConfigurationError"
202                        LogError "Fatal: license configuration must be corrected"
203                        LogError getLastServiceErrorMessage
204                        isFatalError
205                else
206                        if $ServiceErrorClass$ = "LicenseMissingError"
207                                LogError "Fatal: required license is not supplied"
208                                isFatalError
209                        endif
210                endif
211        endif
212else
213        LogError "Fatal: license required, but license management not enabled"
214        isFatalError
215endif
216
217
218[Sub_check_exitcode]
219comment "Test for installation success via exit code"
220set $ExitCode$ = getLastExitCode
221; informations to exit codes see
222; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
223; http://msdn.microsoft.com/en-us/library/aa368542.aspx
224if ($ExitCode$ = "0")
225        comment "Looks good: setup program gives exitcode zero"
226else
227        comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
228        if ($ExitCode$ = "1605")
229                comment "ERROR_UNKNOWN_PRODUCT  1605    This action is only valid for products that are currently installed."
230                comment "Uninstall of a not installed product failed - no problem"
231        else
232                if ($ExitCode$ = "1641")
233                        comment "looks good: setup program gives exitcode 1641"
234                        comment "ERROR_SUCCESS_REBOOT_INITIATED 1641    The installer has initiated a restart. This message is indicative of a success."
235                else
236                        if ($ExitCode$ = "3010")
237                                comment "looks good: setup program gives exitcode 3010"
238                                comment "ERROR_SUCCESS_REBOOT_REQUIRED  3010    A restart is required to complete the install. This message is indicative of a success."
239                        else
240                                logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
241                                isFatalError
242                        endif
243                endif
244        endif
245endif
246
Note: See TracBrowser for help on using the repository browser.