source: trunk/is7_bbc/BBC Collection/Setup.rul@ 3200

Last change on this file since 3200 was 3200, checked in by sjboddie, 22 years ago

Initial revision

  • Property svn:keywords set to Author Date Id Revision
File size: 9.5 KB
Line 
1
2////////////////////////////////////////////////////////////////////////////////
3//
4// File Name: Setup.rul
5//
6// Description: InstallShield script
7//
8// Comments: This script was generated based on the selections you made in
9// the Project Wizard. Refer to the help topic entitled "Modify
10// the script that the Project Wizard generates" for information
11// on possible next steps.
12//
13////////////////////////////////////////////////////////////////////////////////
14
15
16// Include header files
17
18#include "ifx.h"
19
20////////////////////// string defines ////////////////////////////
21
22// these macros should match the MSI properties with the same names
23#define GSDL "gsdl"
24#define GSDL_COLLECTION "bbc"
25#define GSDL_SUBCOLLECTION "bfi1"
26
27
28
29//////////////////// installation declarations ///////////////////
30
31// ----- DLL function prototypes -----
32
33
34 // your DLL function prototypes
35
36
37// ---- script function prototypes -----
38
39
40 // your script function prototypes
41 prototype check_registry();
42 prototype edit_gsdlsite();
43
44 // your global variables
45 BOOL bIsMulti;
46 STRING szInstallDir;
47
48//////////////////////////////////////////////////////////////////////////////
49//
50// FUNCTION: OnFirstUIBefore
51//
52// EVENT: FirstUIBefore event is sent when installation is run for the first
53// time on given machine. In the handler installation usually displays
54// UI allowing end user to specify installation parameters. After this
55// function returns, FeatureTransferData is called to perform file
56// transfer.
57//
58///////////////////////////////////////////////////////////////////////////////
59function OnFirstUIBefore()
60 number nResult;
61 string szTitle, szMsg;
62 string szTargetPath;
63 string szDir, svSetupType;
64 number nvSize;
65begin
66 // TO DO: if you want to enable background, window title, and caption bar title
67 // SetTitle( @PRODUCT_NAME, 24, WHITE );
68 // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );
69 // Enable( FULLWINDOWMODE );
70 // Enable( BACKGROUND );
71 // SetColor(BACKGROUND,RGB (0, 128, 128));
72
73 SHELL_OBJECT_FOLDER = @PRODUCT_NAME;
74
75 svSetupType = "Full";
76 szDir = INSTALLDIR;
77
78 // check if this collection is a second or subsequent volume
79 // in a multi-volume set (check_registry sets the bIsMulti and
80 // szInstallDir variables)
81 bIsMulti = FALSE;
82 szInstallDir = "";
83 check_registry();
84
85
86Dlg_Start:
87 // beginning of dialogs label
88
89Dlg_SdWelcome:
90 szTitle = "";
91 szMsg = "";
92 nResult = SdWelcome( szTitle, szMsg );
93 if (nResult = BACK) goto Dlg_Start;
94
95// If we're installing a subsequent volume of a multi-volume set
96// we won't give the user the option of where to install it. We'll
97// just force them to install it in the same place as the previous
98// volume.
99Dlg_SdAskDestPath:
100 if (!bIsMulti) then
101 szTitle = "";
102 szMsg = "";
103 nResult = SdAskDestPath( szTitle, szMsg, szDir, 0 );
104 INSTALLDIR = szDir;
105 if (nResult = BACK) goto Dlg_SdWelcome;
106 else
107 szDir = szInstallDir;
108 INSTALLDIR = szDir;
109 endif;
110
111Dlg_SetupType:
112 szTitle = "";
113 szMsg = "";
114 nResult = SdSetupTypeEx ( szTitle , szMsg , "" , svSetupType , 0 );
115 if (nResult = BACK) then
116 if (bIsMulti) then
117 goto Dlg_SdWelcome;
118 else
119 goto Dlg_SdAskDestPath;
120 endif;
121 else
122 szTargetPath = INSTALLDIR;
123 nvSize = 0;
124 FeatureCompareSizeRequired(MEDIA,szTargetPath,nvSize);
125 if (nvSize != 0) then
126 MessageBox( szSdStr_NotEnoughSpace, WARNING );
127 goto Dlg_SetupType;
128 endif;
129 endif;
130
131 Enable(STATUSEX);
132
133 return 0;
134end;
135
136///////////////////////////////////////////////////////////////////////////////
137//
138// FUNCTION: OnMaintUIBefore
139//
140// EVENT: MaintUIBefore event is sent when end user runs installation that
141// has already been installed on the machine. Usually this happens
142// through Add/Remove Programs applet. In the handler, installation
143// usually displays UI allowing end user to modify existing installation
144// or uninstall application. After this function returns,
145// FeatureTransferData is called to perform file transfer.
146//
147///////////////////////////////////////////////////////////////////////////////
148function OnMaintUIBefore()
149 NUMBER nResult, nType;
150 STRING szTitle, szMsg, svDir, svResult, szCaption;
151begin
152 // TO DO: if you want to enable background, window title, and caption bar title
153 // SetTitle( @PRODUCT_NAME, 24, WHITE );
154 // SetTitle( @PRODUCT_NAME, 0, BACKGROUNDCAPTION );
155 // SetColor(BACKGROUND,RGB (0, 128, 128));
156 // Enable( FULLWINDOWMODE );
157 // Enable( BACKGROUND );
158
159Dlg_Start:
160 Disable(BACKBUTTON);
161 nType = SdWelcomeMaint(szTitle, szMsg, MODIFY);
162 Enable(BACKBUTTON);
163
164 if (nType = REMOVEALL) then
165 svResult = SdLoadString(IFX_MAINTUI_MSG);
166 szCaption = SdLoadString(IFX_ONMAINTUI_CAPTION);
167 nResult = SprintfBox(MB_OKCANCEL,szCaption,"%s",svResult);
168 if (nResult = IDCANCEL) goto Dlg_Start;
169 endif;
170
171 nResult = NEXT;
172
173Dlg_SdFeatureTree:
174 if (nType = MODIFY) then
175 szTitle = "";
176 szMsg = "";
177 nResult = SdFeatureTree(szTitle, szMsg, TARGETDIR, "", 2);
178 if (nResult = BACK) goto Dlg_Start;
179 endif;
180
181 switch(nType)
182 case REMOVEALL: ComponentRemoveAll();
183 case REPAIR: ComponentReinstall();
184 endswitch;
185
186 Enable(STATUSEX);
187end;
188///////////////////////////////////////////////////////////////////////////////
189//
190// FUNCTION: OnFirstUIAfter
191//
192// EVENT: FirstUIAfter event is sent after file transfer, when installation
193// is run for the first time on given machine. In this event handler
194// installation usually displays UI that will inform end user that
195// installation has been completed successfully.
196//
197///////////////////////////////////////////////////////////////////////////////
198function OnFirstUIAfter()
199 STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
200 NUMBER bOpt1, bOpt2;
201 STRING szGSDLHOME, szGDBMHOME;
202begin
203 Disable(STATUSEX);
204
205 // edit the gsdlsite.cfg file
206 edit_gsdlsite();
207
208 bOpt1 = FALSE;
209 bOpt2 = FALSE;
210 szMsg1 = SdLoadString(IFX_SDFINISH_MSG1);
211 SdFinishEx(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);
212end;
213
214
215// check the registry to find out if this collection is the second
216// or subsequent volume of a multi-volume set
217function check_registry ()
218 STRING szKey, szName, svValue;
219 NUMBER nvType, nvSize;
220begin
221
222 bIsMulti = FALSE;
223 szInstallDir = "";
224
225 szKey = "SOFTWARE\\" + GSDL + "\\" + @PRODUCT_VERSION + "\\" + GSDL_COLLECTION;
226 szName = "gsdlhome";
227
228 RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
229 if (RegDBGetKeyValueEx(szKey, szName, nvType, svValue, nvSize) == 0) then
230 bIsMulti = TRUE;
231 szInstallDir = svValue;
232 endif;
233
234end;
235
236// edit the gsdlsite.cfg file - this should be done after
237// the files have been copied across
238// note the the gsdlsite.cfg component should have its "never
239// overwrite" attribute set so that subsequent volumes of a
240// multi-volume set don't overwrite the existing file
241function edit_gsdlsite ()
242 STRING szFileName, svResult;
243 BOOL bIsFullInstall;
244begin
245
246 szFileName = INSTALLDIR ^ "gsdlsite.cfg";
247
248 bIsFullInstall = FeatureIsItemSelected(MEDIA, "full_install");
249
250 if (!bIsMulti) then
251 // set top level gsdlhome and gdbmhome fields
252 // only if this isn't the second or subsequent
253 // volume
254 if (bIsFullInstall) then
255 WriteProfString(szFileName, "gsdl", "gsdlhome", INSTALLDIR);
256 else
257 WriteProfString(szFileName, "gsdl", "gsdlhome", SRCDIR ^ "gsdl");
258 endif;
259 WriteProfString(szFileName, "gsdl", "gdbmhome", INSTALLDIR);
260
261 // set the "collections" line
262 WriteProfString(szFileName, "gsdl", "collections",
263 GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION);
264
265 else
266
267 // append this volume to the existing "collections" line
268 GetProfString(szFileName, "gsdl", "collections", svResult);
269 if (StrLengthChars(svResult) > 0) then
270 svResult = svResult + ",";
271 endif;
272 svResult = svResult + GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION;
273 WriteProfString(szFileName, "gsdl", "collections", svResult);
274
275 endif;
276
277 // add the "collection#volume" section
278 if (bIsFullInstall) then
279 WriteProfString(szFileName, GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION,
280 "gsdlhome", INSTALLDIR);
281 else
282 WriteProfString(szFileName, GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION,
283 "gsdlhome", SRCDIR ^ "gsdl");
284 endif;
285 WriteProfString(szFileName, GSDL_COLLECTION + "#" + GSDL_SUBCOLLECTION,
286 "gdbmhome", INSTALLDIR);
287
288
289end;
Note: See TracBrowser for help on using the repository browser.