1 | // To create a CDROM distribution, set the bIsCDROM variable to TRUE
|
---|
2 | // and set all components "Include in Build" options to "Yes" in the
|
---|
3 | // IDE. For a web distribution set bIsCDROM to FALSE and set "Include
|
---|
4 | // in Build" to "No" for those components mentioned in the SetComponents()
|
---|
5 | // function of this script.
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 | ////////////////////////////////////////////////////////////////////////////////
|
---|
10 | //
|
---|
11 | // IIIIIII SSSSSS
|
---|
12 | // II SS InstallShield (R)
|
---|
13 | // II SSSSSS (c) 1996-1997, InstallShield Software Corporation
|
---|
14 | // II SS (c) 1990-1996, InstallShield Corporation
|
---|
15 | // IIIIIII SSSSSS All Rights Reserved.
|
---|
16 | //
|
---|
17 | //
|
---|
18 | // This code is generated as a starting setup template. You should
|
---|
19 | // modify it to provide all necessary steps for your setup.
|
---|
20 | //
|
---|
21 | //
|
---|
22 | // File Name: Setup.rul
|
---|
23 | //
|
---|
24 | // Description: InstallShield script
|
---|
25 | //
|
---|
26 | // Comments: This template script performs a basic setup. With minor
|
---|
27 | // modifications, this template can be adapted to create
|
---|
28 | // new, customized setups.
|
---|
29 | //
|
---|
30 | ////////////////////////////////////////////////////////////////////////////////
|
---|
31 |
|
---|
32 |
|
---|
33 | // Include header files
|
---|
34 |
|
---|
35 | #include "sdlang.h"
|
---|
36 | #include "sddialog.h"
|
---|
37 |
|
---|
38 | ////////////////////// string defines ////////////////////////////
|
---|
39 |
|
---|
40 | #define UNINST_LOGFILE_NAME "Uninst.isu"
|
---|
41 |
|
---|
42 | //////////////////// installation declarations ///////////////////
|
---|
43 |
|
---|
44 | // ----- DLL function prototypes -----
|
---|
45 |
|
---|
46 |
|
---|
47 | // your DLL function prototypes
|
---|
48 |
|
---|
49 |
|
---|
50 | // ---- script function prototypes -----
|
---|
51 |
|
---|
52 | // generated by the Project Wizard
|
---|
53 | prototype ShowDialogs();
|
---|
54 | prototype MoveFileData();
|
---|
55 | prototype HandleMoveDataError( NUMBER );
|
---|
56 | prototype ProcessBeforeDataMove();
|
---|
57 | prototype ProcessAfterDataMove();
|
---|
58 | prototype SetupRegistry();
|
---|
59 | prototype SetupFolders();
|
---|
60 | prototype CleanUpInstall();
|
---|
61 | prototype SetupInstall();
|
---|
62 | prototype SetupScreen();
|
---|
63 | prototype CheckRequirements();
|
---|
64 | prototype DialogShowSdLicense();
|
---|
65 | prototype DialogShowSdFinishReboot();
|
---|
66 |
|
---|
67 | // your script function prototypes
|
---|
68 | prototype DialogGreenstoneInstallationType();
|
---|
69 | prototype DialogSetupType();
|
---|
70 | prototype DialogSelectCollections();
|
---|
71 | prototype DialogAskDestPath();
|
---|
72 | prototype DialogGetAdminPassword();
|
---|
73 | prototype SetComponents();
|
---|
74 | prototype SetAdminPassword();
|
---|
75 | prototype CheckWin32s();
|
---|
76 | prototype CreateServerTxt();
|
---|
77 | prototype EditGsdlsiteCfg();
|
---|
78 | prototype EditSetupBat();
|
---|
79 | prototype rs(BYREF STRING);
|
---|
80 | prototype InstallCollOrganizer();
|
---|
81 | prototype SetPermissions();
|
---|
82 |
|
---|
83 | // ----- global variables ------
|
---|
84 |
|
---|
85 | // generated by the Project Wizard
|
---|
86 | BOOL bWinNT, bIsShellExplorer, bInstallAborted, bIs32BitSetup;
|
---|
87 | STRING svDir;
|
---|
88 | STRING svName, svCompany, svSerial;
|
---|
89 | STRING svDefGroup;
|
---|
90 | STRING szAppPath;
|
---|
91 | STRING svSetupType;
|
---|
92 |
|
---|
93 |
|
---|
94 | // your global variables
|
---|
95 | BOOL bCompact, bIsCDROM;
|
---|
96 | STRING svAdminPassword, svLogFile;
|
---|
97 |
|
---|
98 |
|
---|
99 | // for _LaunchAppEx function
|
---|
100 | #ifndef STILL_ACTIVE
|
---|
101 | #define STILL_ACTIVE 0x00000103
|
---|
102 | #endif
|
---|
103 | #if _ISCRIPT_VER < 0x600
|
---|
104 | #ifndef BYVAL
|
---|
105 | #define BYVAL
|
---|
106 | #endif
|
---|
107 | #endif
|
---|
108 | prototype _LaunchAppEx(STRING, STRING, NUMBER, NUMBER, NUMBER, BYREF NUMBER);
|
---|
109 | prototype BOOL kernel32.CreateProcessA(POINTER, BYVAL STRING, POINTER,
|
---|
110 | POINTER, BOOL, NUMBER, POINTER, POINTER, POINTER,
|
---|
111 | POINTER);
|
---|
112 | prototype BOOL kernel32.GetExitCodeProcess(NUMBER, POINTER);
|
---|
113 | prototype NUMBER kernel32.WaitForSingleObject(NUMBER, NUMBER);
|
---|
114 | prototype BOOL kernel32.CloseHandle(HWND);
|
---|
115 | typedef STARTUPINFO
|
---|
116 | begin
|
---|
117 | NUMBER cb;
|
---|
118 | POINTER lpReserved;
|
---|
119 | POINTER lpDesktop;
|
---|
120 | POINTER lpTitle;
|
---|
121 | NUMBER dwX;
|
---|
122 | NUMBER dwY;
|
---|
123 | NUMBER dwXSize;
|
---|
124 | NUMBER dwYSize;
|
---|
125 | NUMBER dwXCountChars;
|
---|
126 | NUMBER dwYCountChars;
|
---|
127 | NUMBER dwFillAttribute;
|
---|
128 | NUMBER dwFlags;
|
---|
129 | NUMBER wShowWindow;
|
---|
130 | POINTER lpReserved2;
|
---|
131 | HWND hStdInput;
|
---|
132 | HWND hStdOutput;
|
---|
133 | HWND hStdError;
|
---|
134 | end;
|
---|
135 | typedef PROCESS_INFORMATION
|
---|
136 | begin
|
---|
137 | NUMBER hProcess;
|
---|
138 | HWND hThread;
|
---|
139 | NUMBER dwProcessId;
|
---|
140 | NUMBER dwThreadId;
|
---|
141 | end;
|
---|
142 |
|
---|
143 |
|
---|
144 | ///////////////////////////////////////////////////////////////////////////////
|
---|
145 | //
|
---|
146 | // MAIN PROGRAM
|
---|
147 | //
|
---|
148 | // The setup begins here by hiding the visible setup
|
---|
149 | // window. This is done to allow all the titles, images, etc. to
|
---|
150 | // be established before showing the main window. The setup is
|
---|
151 | // then performed in a series of calls to script defined functions,
|
---|
152 | // with error checking at each step.
|
---|
153 | //
|
---|
154 | ///////////////////////////////////////////////////////////////////////////////
|
---|
155 | program
|
---|
156 | Disable( BACKGROUND );
|
---|
157 |
|
---|
158 | CheckRequirements();
|
---|
159 |
|
---|
160 | SetupInstall();
|
---|
161 |
|
---|
162 | SetupScreen();
|
---|
163 |
|
---|
164 | // set this variable to TRUE if we're creating a CDROM installation
|
---|
165 | bIsCDROM = TRUE;
|
---|
166 |
|
---|
167 | if (bIsCDROM) then
|
---|
168 | CheckWin32s();
|
---|
169 | endif;
|
---|
170 |
|
---|
171 | if (ShowDialogs()<0) goto end_install;
|
---|
172 |
|
---|
173 | if (ProcessBeforeDataMove()<0) goto end_install;
|
---|
174 |
|
---|
175 | if (MoveFileData()<0) goto end_install;
|
---|
176 |
|
---|
177 | if (ProcessAfterDataMove()<0) goto end_install;
|
---|
178 |
|
---|
179 | if (SetupRegistry()<0) goto end_install;
|
---|
180 |
|
---|
181 | if (SetupFolders()<0) goto end_install;
|
---|
182 |
|
---|
183 |
|
---|
184 | end_install:
|
---|
185 |
|
---|
186 | CleanUpInstall();
|
---|
187 |
|
---|
188 | if (bIsCDROM) then
|
---|
189 | InstallCollOrganizer();
|
---|
190 | endif;
|
---|
191 |
|
---|
192 | // If an unrecoverable error occurred, clean up
|
---|
193 | // the partial installation. Otherwise, exit normally.
|
---|
194 |
|
---|
195 | if (bInstallAborted) then
|
---|
196 | abort;
|
---|
197 | endif;
|
---|
198 |
|
---|
199 | endprogram
|
---|
200 |
|
---|
201 | ///////////////////////////////////////////////////////////////////////////////
|
---|
202 | //
|
---|
203 | // Function: ShowDialogs
|
---|
204 | //
|
---|
205 | // Purpose: This function manages the display and navigation of
|
---|
206 | // the standard dialogs that exist in a setup.
|
---|
207 | //
|
---|
208 | ///////////////////////////////////////////////////////////////////////////////
|
---|
209 | function ShowDialogs()
|
---|
210 | NUMBER nResult;
|
---|
211 |
|
---|
212 | begin
|
---|
213 |
|
---|
214 | Dlg_Start:
|
---|
215 | // beginning of dialogs label
|
---|
216 |
|
---|
217 | Dlg_SdLicense:
|
---|
218 | nResult = DialogShowSdLicense();
|
---|
219 | if (nResult = BACK) goto Dlg_Start;
|
---|
220 |
|
---|
221 | if (bIs32BitSetup) then
|
---|
222 |
|
---|
223 | Dlg_GreenstoneInstallationType:
|
---|
224 | nResult = DialogGreenstoneInstallationType();
|
---|
225 | if (nResult = BACK) goto Dlg_SdLicense;
|
---|
226 |
|
---|
227 | if (bIsCDROM) then
|
---|
228 | Dlg_SetupType:
|
---|
229 | nResult = DialogSetupType();
|
---|
230 | if (nResult = BACK) goto Dlg_GreenstoneInstallationType;
|
---|
231 | else
|
---|
232 | bCompact = TRUE;
|
---|
233 | endif;
|
---|
234 |
|
---|
235 | else
|
---|
236 |
|
---|
237 | ComponentSetupTypeSet(MEDIA, "Local Library");
|
---|
238 | svSetupType = "Local Library";
|
---|
239 | bCompact = TRUE;
|
---|
240 |
|
---|
241 | endif;
|
---|
242 |
|
---|
243 | SetComponents();
|
---|
244 |
|
---|
245 | if (bIsCDROM) then
|
---|
246 |
|
---|
247 | Dlg_SelectCollections:
|
---|
248 | nResult = DialogSelectCollections();
|
---|
249 |
|
---|
250 | else
|
---|
251 |
|
---|
252 | Dlg_AskDestPath:
|
---|
253 | nResult = DialogAskDestPath();
|
---|
254 |
|
---|
255 | endif;
|
---|
256 |
|
---|
257 | if (nResult = BACK) then
|
---|
258 | if (bIs32BitSetup = FALSE) goto Dlg_SdLicense;
|
---|
259 | if (bIsCDROM = FALSE) goto Dlg_GreenstoneInstallationType;
|
---|
260 | goto Dlg_SetupType;
|
---|
261 | endif;
|
---|
262 |
|
---|
263 | Dlg_GetAdminPassWord:
|
---|
264 | nResult = DialogGetAdminPassword();
|
---|
265 | if (nResult = BACK) then
|
---|
266 | if (bIsCDROM) goto Dlg_SelectCollections;
|
---|
267 | goto Dlg_AskDestPath;
|
---|
268 | endif;
|
---|
269 |
|
---|
270 | return 0;
|
---|
271 |
|
---|
272 | end;
|
---|
273 |
|
---|
274 | ///////////////////////////////////////////////////////////////////////////////
|
---|
275 | //
|
---|
276 | // Function: ProcessBeforeDataMove
|
---|
277 | //
|
---|
278 | // Purpose: This function performs any necessary operations prior to the
|
---|
279 | // actual file transfer.
|
---|
280 | //
|
---|
281 | ///////////////////////////////////////////////////////////////////////////////
|
---|
282 | function ProcessBeforeDataMove()
|
---|
283 | NUMBER nResult;
|
---|
284 |
|
---|
285 | begin
|
---|
286 |
|
---|
287 | // Create app information, uninstallation, and App Paths registry keys.
|
---|
288 |
|
---|
289 | InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY );
|
---|
290 |
|
---|
291 | svLogFile = UNINST_LOGFILE_NAME;
|
---|
292 |
|
---|
293 | nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 );
|
---|
294 | if (nResult < 0) then
|
---|
295 | MessageBox( @ERROR_UNINSTSETUP, WARNING );
|
---|
296 | endif;
|
---|
297 |
|
---|
298 | szAppPath = TARGETDIR;
|
---|
299 |
|
---|
300 | if ((bIs32BitSetup) && (bIsShellExplorer)) then
|
---|
301 | RegDBSetItem( REGDB_APPPATH, szAppPath );
|
---|
302 | RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY );
|
---|
303 | RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME );
|
---|
304 | endif;
|
---|
305 |
|
---|
306 | // TO DO : any other tasks you want to perform before file transfer
|
---|
307 |
|
---|
308 | return 0;
|
---|
309 | end;
|
---|
310 |
|
---|
311 | ///////////////////////////////////////////////////////////////////////////////
|
---|
312 | //
|
---|
313 | // Function: MoveFileData
|
---|
314 | //
|
---|
315 | // Purpose: This function handles the file transfer for
|
---|
316 | // the setup.
|
---|
317 | //
|
---|
318 | ///////////////////////////////////////////////////////////////////////////////
|
---|
319 | function MoveFileData()
|
---|
320 | NUMBER nResult, nDisk;
|
---|
321 |
|
---|
322 | begin
|
---|
323 |
|
---|
324 | nDisk = 1;
|
---|
325 | SetStatusWindow( 0, "" );
|
---|
326 | Disable( DIALOGCACHE );
|
---|
327 | Enable( STATUS );
|
---|
328 | StatusUpdate( ON, 100 );
|
---|
329 | nResult = ComponentMoveData( MEDIA, nDisk, 0 );
|
---|
330 |
|
---|
331 | HandleMoveDataError( nResult );
|
---|
332 |
|
---|
333 | Disable( STATUS );
|
---|
334 |
|
---|
335 | return nResult;
|
---|
336 |
|
---|
337 | end;
|
---|
338 |
|
---|
339 |
|
---|
340 | ///////////////////////////////////////////////////////////////////////////////
|
---|
341 | //
|
---|
342 | // Function: HandleMoveDataError
|
---|
343 | //
|
---|
344 | // Purpose: This function handles the error (if any) during the file transfer
|
---|
345 | // operation.
|
---|
346 | //
|
---|
347 | ///////////////////////////////////////////////////////////////////////////////
|
---|
348 | function HandleMoveDataError( nResult )
|
---|
349 | STRING szErrMsg, svComponent , svFileGroup , svFile;
|
---|
350 |
|
---|
351 | begin
|
---|
352 |
|
---|
353 | svComponent = "";
|
---|
354 | svFileGroup = "";
|
---|
355 | svFile = "";
|
---|
356 |
|
---|
357 | switch (nResult)
|
---|
358 | case 0:
|
---|
359 | return 0;
|
---|
360 | default:
|
---|
361 | ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
|
---|
362 | szErrMsg = @ERROR_MOVEDATA + "\n\n" +
|
---|
363 | @ERROR_COMPONENT + " " + svComponent + "\n" +
|
---|
364 | @ERROR_FILEGROUP + " " + svFileGroup + "\n" +
|
---|
365 | @ERROR_FILE + " " + svFile;
|
---|
366 | SprintfBox( SEVERE, @TITLE_CAPTIONBAR, szErrMsg, nResult );
|
---|
367 | bInstallAborted = TRUE;
|
---|
368 | return nResult;
|
---|
369 | endswitch;
|
---|
370 |
|
---|
371 | end;
|
---|
372 |
|
---|
373 | ///////////////////////////////////////////////////////////////////////////////
|
---|
374 | //
|
---|
375 | // Function: ProcessAfterDataMove
|
---|
376 | //
|
---|
377 | // Purpose: This function performs any necessary operations needed after
|
---|
378 | // all files have been transferred.
|
---|
379 | //
|
---|
380 | ///////////////////////////////////////////////////////////////////////////////
|
---|
381 | function ProcessAfterDataMove()
|
---|
382 | STRING szReferenceFile;
|
---|
383 |
|
---|
384 | begin
|
---|
385 |
|
---|
386 | CreateServerTxt();
|
---|
387 | EditGsdlsiteCfg();
|
---|
388 | EditSetupBat();
|
---|
389 | SetAdminPassword();
|
---|
390 | SetPermissions();
|
---|
391 |
|
---|
392 | szReferenceFile = svDir ^ @PRODUCT_KEY;
|
---|
393 | DeinstallSetReference( szReferenceFile );
|
---|
394 |
|
---|
395 | return 0;
|
---|
396 | end;
|
---|
397 |
|
---|
398 | ///////////////////////////////////////////////////////////////////////////////
|
---|
399 | //
|
---|
400 | // Function: SetupRegistry
|
---|
401 | //
|
---|
402 | // Purpose: This function makes the registry entries for this setup.
|
---|
403 | //
|
---|
404 | ///////////////////////////////////////////////////////////////////////////////
|
---|
405 | function SetupRegistry()
|
---|
406 | NUMBER nResult;
|
---|
407 |
|
---|
408 | begin
|
---|
409 |
|
---|
410 | // TO DO : Add all your registry entry keys here.
|
---|
411 | // Call registry functions and/or create keys from
|
---|
412 | // the InstallShield IDE's Resources pane.
|
---|
413 |
|
---|
414 | nResult = CreateRegistrySet( "" );
|
---|
415 |
|
---|
416 | return nResult;
|
---|
417 | end;
|
---|
418 |
|
---|
419 | ///////////////////////////////////////////////////////////////////////////////
|
---|
420 | //
|
---|
421 | // Function: SetupFolders
|
---|
422 | //
|
---|
423 | // Purpose: This function creates all the folders and shortcuts for the
|
---|
424 | // setup. This includes program groups and items for Windows 3.1.
|
---|
425 | //
|
---|
426 | ///////////////////////////////////////////////////////////////////////////////
|
---|
427 | function SetupFolders()
|
---|
428 | NUMBER nResult;
|
---|
429 | STRING szIsData;
|
---|
430 | NUMBER nType;
|
---|
431 |
|
---|
432 | begin
|
---|
433 |
|
---|
434 | if (Is(USER_ADMINISTRATOR,szIsData)==TRUE) then
|
---|
435 | nType = COMMON;
|
---|
436 | else
|
---|
437 | nType = PERSONAL;
|
---|
438 |
|
---|
439 | endif;
|
---|
440 |
|
---|
441 | ProgDefGroupType(nType);
|
---|
442 |
|
---|
443 | if (CreateProgramFolder(@FOLDER_NAME) < 0) then
|
---|
444 | MessageBox("CreateProgramFolder failed.", SEVERE);
|
---|
445 | endif;
|
---|
446 |
|
---|
447 | // The following adds the shortcuts.
|
---|
448 | if (AddFolderIcon(@FOLDER_NAME, @README, "\"" + TARGETDIR ^ "README.TXT\"", "",
|
---|
449 | "", 0, "", REPLACE) < 0) then
|
---|
450 | MessageBox("AddFolderIcon failed.", SEVERE);
|
---|
451 | endif;
|
---|
452 |
|
---|
453 | if (AddFolderIcon(@FOLDER_NAME, @TEXT_UNINSTALL, UNINST + " -f\"" + svLogFile + "\"",
|
---|
454 | "", "", 0, "", REPLACE) < 0) then
|
---|
455 | MessageBox("AddFolderIcon failed.", SEVERE);
|
---|
456 | endif;
|
---|
457 |
|
---|
458 | if (svSetupType = "Local library") then
|
---|
459 | if (AddFolderIcon(@FOLDER_NAME, @FOLDER_NAME, "\"" + TARGETDIR ^ "server.exe\"", "",
|
---|
460 | "", 0, "", REPLACE) < 0) then
|
---|
461 | MessageBox("AddFolderIcon failed.", SEVERE);
|
---|
462 | endif;
|
---|
463 | endif;
|
---|
464 |
|
---|
465 | nResult = CreateShellObjects( "" );
|
---|
466 |
|
---|
467 | return nResult;
|
---|
468 | end;
|
---|
469 |
|
---|
470 | ///////////////////////////////////////////////////////////////////////////////
|
---|
471 | //
|
---|
472 | // Function: CleanUpInstall
|
---|
473 | //
|
---|
474 | // Purpose: This cleans up the setup. Anything that should
|
---|
475 | // be released or deleted at the end of the setup should
|
---|
476 | // be done here.
|
---|
477 | //
|
---|
478 | ///////////////////////////////////////////////////////////////////////////////
|
---|
479 | function CleanUpInstall()
|
---|
480 |
|
---|
481 | begin
|
---|
482 |
|
---|
483 |
|
---|
484 | if (bInstallAborted) then
|
---|
485 | return 0;
|
---|
486 | endif;
|
---|
487 |
|
---|
488 | DialogShowSdFinishReboot();
|
---|
489 |
|
---|
490 | if (BATCH_INSTALL) then // ensure locked files are properly transferred
|
---|
491 | CommitSharedFiles(0);
|
---|
492 | endif;
|
---|
493 |
|
---|
494 | return 0;
|
---|
495 | end;
|
---|
496 |
|
---|
497 | ///////////////////////////////////////////////////////////////////////////////
|
---|
498 | //
|
---|
499 | // Function: SetupInstall
|
---|
500 | //
|
---|
501 | // Purpose: This will initialize the setup. Any general initialization
|
---|
502 | // needed for the installation should be performed here.
|
---|
503 | //
|
---|
504 | ///////////////////////////////////////////////////////////////////////////////
|
---|
505 | function SetupInstall()
|
---|
506 |
|
---|
507 | begin
|
---|
508 |
|
---|
509 | Enable( CORECOMPONENTHANDLING );
|
---|
510 |
|
---|
511 | bInstallAborted = FALSE;
|
---|
512 |
|
---|
513 | svDir = PROGRAMFILES ^ "gsdl";
|
---|
514 | TARGETDIR = svDir;
|
---|
515 |
|
---|
516 | SdProductName( @PRODUCT_NAME );
|
---|
517 |
|
---|
518 | Enable( DIALOGCACHE );
|
---|
519 |
|
---|
520 | return 0;
|
---|
521 | end;
|
---|
522 |
|
---|
523 | ///////////////////////////////////////////////////////////////////////////////
|
---|
524 | //
|
---|
525 | // Function: SetupScreen
|
---|
526 | //
|
---|
527 | // Purpose: This function establishes the screen look. This includes
|
---|
528 | // colors, fonts, and text to be displayed.
|
---|
529 | //
|
---|
530 | ///////////////////////////////////////////////////////////////////////////////
|
---|
531 | function SetupScreen()
|
---|
532 |
|
---|
533 | begin
|
---|
534 |
|
---|
535 | Enable( FULLWINDOWMODE );
|
---|
536 | Enable( INDVFILESTATUS );
|
---|
537 | SetTitle( @TITLE_MAIN, 24, WHITE );
|
---|
538 |
|
---|
539 | SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text.
|
---|
540 |
|
---|
541 | Enable( BACKGROUND );
|
---|
542 |
|
---|
543 | Delay( 1 );
|
---|
544 | end;
|
---|
545 |
|
---|
546 | ///////////////////////////////////////////////////////////////////////////////
|
---|
547 | //
|
---|
548 | // Function: CheckRequirements
|
---|
549 | //
|
---|
550 | // Purpose: This function checks all minimum requirements for the
|
---|
551 | // application being installed. If any fail, then the user
|
---|
552 | // is informed and the setup is terminated.
|
---|
553 | //
|
---|
554 | ///////////////////////////////////////////////////////////////////////////////
|
---|
555 | function CheckRequirements()
|
---|
556 | NUMBER nvDx, nvDy, nvResult;
|
---|
557 | STRING svResult, szIsData;
|
---|
558 |
|
---|
559 | begin
|
---|
560 |
|
---|
561 | bWinNT = FALSE;
|
---|
562 | bIsShellExplorer = FALSE;
|
---|
563 |
|
---|
564 | // Check screen resolution.
|
---|
565 | GetExtents( nvDx, nvDy );
|
---|
566 |
|
---|
567 | if (nvDy < 480) then
|
---|
568 | MessageBox( @ERROR_VGARESOLUTION, WARNING );
|
---|
569 | abort;
|
---|
570 | endif;
|
---|
571 |
|
---|
572 | // set 'setup' operation mode
|
---|
573 | bIs32BitSetup = TRUE;
|
---|
574 | GetSystemInfo( ISTYPE, nvResult, svResult );
|
---|
575 | if (nvResult = 16) then
|
---|
576 | bIs32BitSetup = FALSE; // running 16-bit setup
|
---|
577 | return 0; // no additional information required
|
---|
578 | endif;
|
---|
579 |
|
---|
580 | // --- 32-bit testing after this point ---
|
---|
581 |
|
---|
582 | // Determine the target system's operating system.
|
---|
583 | GetSystemInfo( OS, nvResult, svResult );
|
---|
584 |
|
---|
585 | if (nvResult = IS_WINDOWSNT) then
|
---|
586 | // Running Windows NT.
|
---|
587 | bWinNT = TRUE;
|
---|
588 |
|
---|
589 | // Check to see if the shell being used is EXPLORER shell.
|
---|
590 | if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
|
---|
591 | if (nvResult >= 4) then
|
---|
592 | bIsShellExplorer = TRUE;
|
---|
593 | endif;
|
---|
594 | endif;
|
---|
595 |
|
---|
596 | elseif (nvResult = IS_WINDOWS95) then
|
---|
597 | bIsShellExplorer = TRUE;
|
---|
598 |
|
---|
599 | endif;
|
---|
600 |
|
---|
601 | // setup must be run as administrator on NT/2000
|
---|
602 | if (bWinNT && (Is(USER_ADMINISTRATOR,szIsData)!=TRUE)) then
|
---|
603 | MessageBox(@TEXT_NOT_ADMIN, SEVERE);
|
---|
604 | abort;
|
---|
605 | endif;
|
---|
606 |
|
---|
607 | end;
|
---|
608 |
|
---|
609 |
|
---|
610 | ///////////////////////////////////////////////////////////////////////////////
|
---|
611 | //
|
---|
612 | // Function: DialogShowSdLicense
|
---|
613 | //
|
---|
614 | // Purpose: This function displays the license agreement dialog.
|
---|
615 | //
|
---|
616 | //
|
---|
617 | ///////////////////////////////////////////////////////////////////////////////
|
---|
618 | function DialogShowSdLicense()
|
---|
619 | NUMBER nResult;
|
---|
620 | STRING szTitle, szMsg, szQuestion, szLicenseFile;
|
---|
621 |
|
---|
622 | begin
|
---|
623 |
|
---|
624 | szLicenseFile = SUPPORTDIR ^ "license.txt";
|
---|
625 | szTitle = "";
|
---|
626 | szMsg = "";
|
---|
627 | szQuestion = "";
|
---|
628 | nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
|
---|
629 |
|
---|
630 | return nResult;
|
---|
631 | end;
|
---|
632 |
|
---|
633 |
|
---|
634 | ///////////////////////////////////////////////////////////////////////////////
|
---|
635 | //
|
---|
636 | // Function: DialogShowSdFinishReboot
|
---|
637 | //
|
---|
638 | // Purpose: This function will show the last dialog of the product.
|
---|
639 | // It will allow the user to reboot and/or show some readme text.
|
---|
640 | //
|
---|
641 | ///////////////////////////////////////////////////////////////////////////////
|
---|
642 | function DialogShowSdFinishReboot()
|
---|
643 | NUMBER nResult, nDefOptions;
|
---|
644 | STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
|
---|
645 | NUMBER bOpt1, bOpt2;
|
---|
646 |
|
---|
647 | begin
|
---|
648 |
|
---|
649 | szTitle = "";
|
---|
650 |
|
---|
651 | if (svSetupType = "Web Library") then
|
---|
652 | szMsg1 = @TEXT_FINISH2;
|
---|
653 | elseif (svSetupType = "Source Code") then
|
---|
654 | szMsg1 = @TEXT_FINISH3;
|
---|
655 | else
|
---|
656 | szMsg1 = @TEXT_FINISH1;
|
---|
657 | endif;
|
---|
658 |
|
---|
659 | szMsg2 = "";
|
---|
660 | bOpt1 = TRUE;
|
---|
661 | bOpt2 = FALSE;
|
---|
662 | szOption1 = @TEXT_README;
|
---|
663 | szOption2 = "";
|
---|
664 | nResult = SdFinish(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);
|
---|
665 |
|
---|
666 | if (bOpt1 = TRUE) then
|
---|
667 | LaunchAppAndWait("notepad", TARGETDIR ^ "README.TXT", WAIT);
|
---|
668 | endif;
|
---|
669 |
|
---|
670 | return 0;
|
---|
671 |
|
---|
672 | end;
|
---|
673 |
|
---|
674 | ///////////////////////////////////////////////////////////////////////////////
|
---|
675 | //
|
---|
676 | //
|
---|
677 | //
|
---|
678 | ///////////////////////////////////////////////////////////////////////////////
|
---|
679 |
|
---|
680 |
|
---|
681 | function DialogGreenstoneInstallationType()
|
---|
682 | NUMBER nResult;
|
---|
683 | STRING szTitle, szMsg;
|
---|
684 |
|
---|
685 | begin
|
---|
686 |
|
---|
687 | szTitle = @TEXT_INSTALL_TYPE;
|
---|
688 | szMsg = @TEXT_INSTALL_TYPE_DESC;
|
---|
689 |
|
---|
690 | nResult = SdSetupTypeEx(szTitle, szMsg, "", svSetupType, 0);
|
---|
691 |
|
---|
692 | return nResult;
|
---|
693 | end;
|
---|
694 |
|
---|
695 |
|
---|
696 | function DialogSetupType()
|
---|
697 | NUMBER nResult, nvCheck1, nvCheck2;
|
---|
698 | STRING szMsg, szText1, szText2;
|
---|
699 |
|
---|
700 | begin
|
---|
701 |
|
---|
702 | nvCheck1 = TRUE;
|
---|
703 | nvCheck2 = FALSE;
|
---|
704 | szMsg = @TEXT_SETUP_TYPE_DESC;
|
---|
705 | szText1 = @TEXT_COMPACT;
|
---|
706 | szText2 = @TEXT_FULL;
|
---|
707 |
|
---|
708 | nResult = AskOptions(EXCLUSIVE, szMsg, szText1, nvCheck1, szText2, nvCheck2);
|
---|
709 |
|
---|
710 | bCompact = nvCheck1;
|
---|
711 |
|
---|
712 | return nResult;
|
---|
713 | end;
|
---|
714 |
|
---|
715 |
|
---|
716 | function DialogSelectCollections()
|
---|
717 | NUMBER nResult;
|
---|
718 | STRING szTitle, szMsg;
|
---|
719 |
|
---|
720 | begin
|
---|
721 |
|
---|
722 | szTitle = @TEXT_SELECT_COLLECTIONS;
|
---|
723 | szMsg = @TEXT_SELECT_COLLECTIONS_DESC;
|
---|
724 |
|
---|
725 | nResult = SdComponentDialog(szTitle, szMsg, svDir, "collections");
|
---|
726 | TARGETDIR = svDir;
|
---|
727 |
|
---|
728 | return nResult;
|
---|
729 | end;
|
---|
730 |
|
---|
731 |
|
---|
732 | function DialogAskDestPath()
|
---|
733 | NUMBER nResult;
|
---|
734 |
|
---|
735 | begin
|
---|
736 |
|
---|
737 | nResult = SdAskDestPath("", "", svDir, 0);
|
---|
738 | TARGETDIR = svDir;
|
---|
739 |
|
---|
740 | return nResult;
|
---|
741 | end;
|
---|
742 |
|
---|
743 |
|
---|
744 | function DialogGetAdminPassword()
|
---|
745 | STRING szTitle, szMsg, szField1;
|
---|
746 | NUMBER nResult;
|
---|
747 |
|
---|
748 | begin
|
---|
749 |
|
---|
750 | svAdminPassword = "admin"; // the default
|
---|
751 |
|
---|
752 | szTitle = @TEXT_ADMIN_PW;
|
---|
753 | szMsg = @TEXT_ADMIN_PW_DESC;
|
---|
754 | szField1 = @TEXT_PW;
|
---|
755 |
|
---|
756 | nResult = SdShowDlgEdit1(szTitle, szMsg, szField1, svAdminPassword);
|
---|
757 |
|
---|
758 | return nResult;
|
---|
759 | end;
|
---|
760 |
|
---|
761 |
|
---|
762 | function SetComponents()
|
---|
763 |
|
---|
764 | begin
|
---|
765 |
|
---|
766 | if (bCompact) then
|
---|
767 | // compact installation
|
---|
768 | ComponentSelectItem(MEDIA, "Documentation", FALSE);
|
---|
769 | ComponentSelectItem(MEDIA, "Export Collection", FALSE);
|
---|
770 |
|
---|
771 | else
|
---|
772 | // full installation
|
---|
773 | ComponentSelectItem(MEDIA, "Documentation", TRUE);
|
---|
774 | ComponentSelectItem(MEDIA, "Export Collection", TRUE);
|
---|
775 |
|
---|
776 | endif;
|
---|
777 |
|
---|
778 | if (bIs32BitSetup = FALSE) then
|
---|
779 | // Windows 3.1 - make certain no components that may contain
|
---|
780 | // long filenames are selected
|
---|
781 | ComponentSelectItem(MEDIA, "Build-time files", FALSE);
|
---|
782 | ComponentSelectItem(MEDIA, "Build-time executables", FALSE);
|
---|
783 | ComponentSelectItem(MEDIA, "Export Collection", FALSE);
|
---|
784 | ComponentSelectItem(MEDIA, "Not installed files", FALSE);
|
---|
785 | ComponentSelectItem(MEDIA, "Source files", FALSE);
|
---|
786 | ComponentSelectItem(MEDIA, "Web library", FALSE);
|
---|
787 | ComponentSelectItem(MEDIA, "cgi-bin", FALSE);
|
---|
788 | ComponentSelectItem(MEDIA, "Source files - Windows", FALSE);
|
---|
789 | ComponentSelectItem(MEDIA, "Not installed files - windows", FALSE);
|
---|
790 | endif;
|
---|
791 |
|
---|
792 | if (bIsCDROM = FALSE) then
|
---|
793 | // not a CDROM installation - make sure CDROM only components
|
---|
794 | // aren't selected (should also make sure these components have
|
---|
795 | // their "Include in Build" option set to "No" in the IDE)
|
---|
796 | ComponentSelectItem(MEDIA, "Not installed files", FALSE);
|
---|
797 | ComponentSelectItem(MEDIA, "Documentation", FALSE);
|
---|
798 | ComponentSelectItem(MEDIA, "collections", FALSE);
|
---|
799 | ComponentSelectItem(MEDIA, "Export Collection", FALSE);
|
---|
800 | endif;
|
---|
801 |
|
---|
802 | end;
|
---|
803 |
|
---|
804 |
|
---|
805 | // use setpw to set the admin password in the users.db database
|
---|
806 | function SetAdminPassword()
|
---|
807 | STRING cmd, cmdline, dbfile;
|
---|
808 |
|
---|
809 | begin
|
---|
810 |
|
---|
811 | dbfile = TARGETDIR ^ "etc" ^ "users.db";
|
---|
812 | cmd = "\"" + TARGETDIR ^ "bin" ^ "windows" ^ "setpw.exe\"";
|
---|
813 | cmdline = " -u admin -p " + svAdminPassword + " -o \"" + dbfile + "\"";
|
---|
814 |
|
---|
815 | if (LaunchApp(cmd, cmdline) != 0) then
|
---|
816 | MessageBox(@TEXT_SETPW_FAIL, WARNING);
|
---|
817 | endif;
|
---|
818 |
|
---|
819 | end;
|
---|
820 |
|
---|
821 |
|
---|
822 | // Create and display the SERVER.TXT file if
|
---|
823 | // installing the web library or source code
|
---|
824 | function CreateServerTxt()
|
---|
825 | STRING szTitle, szMsg, svTmp;
|
---|
826 | STRING szServerTxt, svCgiBin, svGSDLHOME;
|
---|
827 | LIST listInfo;
|
---|
828 |
|
---|
829 | begin
|
---|
830 |
|
---|
831 | if (svSetupType = "Local Library") then
|
---|
832 | return;
|
---|
833 | endif;
|
---|
834 |
|
---|
835 | szServerTxt = TARGETDIR ^ "SERVER.TXT";
|
---|
836 | svCgiBin = TARGETDIR ^ "cgi-bin";
|
---|
837 | svGSDLHOME= TARGETDIR;
|
---|
838 | szTitle = "";
|
---|
839 | szMsg = " ";
|
---|
840 |
|
---|
841 | listInfo = ListCreate(STRINGLIST);
|
---|
842 |
|
---|
843 | ListAddString(listInfo, @TEXT_SERVERTXT_01, AFTER);
|
---|
844 | ListAddString(listInfo, @TEXT_SERVERTXT_02, AFTER);
|
---|
845 | ListAddString(listInfo, @TEXT_SERVERTXT_03, AFTER);
|
---|
846 | ListAddString(listInfo, " ", AFTER);
|
---|
847 |
|
---|
848 | ListAddString(listInfo, @TEXT_SERVERTXT_04, AFTER);
|
---|
849 | ListAddString(listInfo, @TEXT_SERVERTXT_05, AFTER);
|
---|
850 | ListAddString(listInfo, @TEXT_SERVERTXT_06, AFTER);
|
---|
851 | ListAddString(listInfo, @TEXT_SERVERTXT_07, AFTER);
|
---|
852 | ListAddString(listInfo, @TEXT_SERVERTXT_08, AFTER);
|
---|
853 | ListAddString(listInfo, @TEXT_SERVERTXT_09, AFTER);
|
---|
854 | ListAddString(listInfo, " ", AFTER);
|
---|
855 |
|
---|
856 | ListAddString(listInfo, @TEXT_SERVERTXT_10, AFTER);
|
---|
857 | Sprintf(svTmp, @TEXT_SERVERTXT_11, szServerTxt);
|
---|
858 | ListAddString(listInfo, svTmp, AFTER);
|
---|
859 | ListAddString(listInfo, " ", AFTER);
|
---|
860 |
|
---|
861 | Sprintf(svTmp, @TEXT_SERVERTXT_12, TARGETDIR);
|
---|
862 | ListAddString(listInfo, svTmp, AFTER);
|
---|
863 | ListAddString(listInfo, @TEXT_SERVERTXT_13, AFTER);
|
---|
864 | ListAddString(listInfo, @TEXT_SERVERTXT_14, AFTER);
|
---|
865 | ListAddString(listInfo, @TEXT_SERVERTXT_15, AFTER);
|
---|
866 | Sprintf(svTmp, @TEXT_SERVERTXT_16, svCgiBin);
|
---|
867 | ListAddString(listInfo, svTmp, AFTER);
|
---|
868 | ListAddString(listInfo, @TEXT_SERVERTXT_17, AFTER);
|
---|
869 | ListAddString(listInfo, @TEXT_SERVERTXT_18, AFTER);
|
---|
870 | ListAddString(listInfo, " ", AFTER);
|
---|
871 |
|
---|
872 | ListAddString(listInfo, @TEXT_SERVERTXT_19, AFTER);
|
---|
873 | ListAddString(listInfo, @TEXT_SERVERTXT_20, AFTER);
|
---|
874 | ListAddString(listInfo, " ", AFTER);
|
---|
875 |
|
---|
876 | rs(svCgiBin);
|
---|
877 | rs(svGSDLHOME);
|
---|
878 |
|
---|
879 | ListAddString(listInfo, " ScriptAlias /gsdl/cgi-bin \"" + svCgiBin + "/\"", AFTER);
|
---|
880 | ListAddString(listInfo, " <Directory \"" + svCgiBin + "\">", AFTER);
|
---|
881 | ListAddString(listInfo, " Options None", AFTER);
|
---|
882 | ListAddString(listInfo, " AllowOverride None", AFTER);
|
---|
883 | ListAddString(listInfo, " </Directory>", AFTER);
|
---|
884 | ListAddString(listInfo, " ", AFTER);
|
---|
885 |
|
---|
886 | ListAddString(listInfo, " Alias /gsdl \"" + svGSDLHOME + "/\"", AFTER);
|
---|
887 | ListAddString(listInfo, " <Directory \"" + svGSDLHOME + "\">", AFTER);
|
---|
888 | ListAddString(listInfo, " Options Indexes MultiViews FollowSymLinks", AFTER);
|
---|
889 | ListAddString(listInfo, " AllowOverride None", AFTER);
|
---|
890 | ListAddString(listInfo, " Order allow,deny", AFTER);
|
---|
891 | ListAddString(listInfo, " Allow from all", AFTER);
|
---|
892 | ListAddString(listInfo, " </Directory>", AFTER);
|
---|
893 | ListAddString(listInfo, " ", AFTER);
|
---|
894 |
|
---|
895 | ListAddString(listInfo, @TEXT_SERVERTXT_21, AFTER);
|
---|
896 | ListAddString(listInfo, @TEXT_SERVERTXT_22, AFTER);
|
---|
897 | ListAddString(listInfo, @TEXT_SERVERTXT_23, AFTER);
|
---|
898 | ListAddString(listInfo, @TEXT_SERVERTXT_24, AFTER);
|
---|
899 | ListAddString(listInfo, " ", AFTER);
|
---|
900 |
|
---|
901 | ListAddString(listInfo, @TEXT_SERVERTXT_25, AFTER);
|
---|
902 | ListAddString(listInfo, @TEXT_SERVERTXT_26, AFTER);
|
---|
903 | ListAddString(listInfo, " ", AFTER);
|
---|
904 |
|
---|
905 | SdShowInfoList(szTitle, szMsg, listInfo);
|
---|
906 | ListWriteToFile(listInfo, szServerTxt);
|
---|
907 |
|
---|
908 | ListDestroy(listInfo);
|
---|
909 |
|
---|
910 | end;
|
---|
911 |
|
---|
912 |
|
---|
913 | // if we're installing the web library or the source code
|
---|
914 | // we need to edit the gsdlsite.cfg file appropriately.
|
---|
915 | // this function relies on the format of the gsdlsite.cfg
|
---|
916 | // file remaining exactly as it currently is
|
---|
917 | function EditGsdlsiteCfg()
|
---|
918 | STRING svReturnLine, szInsertLine;
|
---|
919 | NUMBER nResult, nvLineNumber;
|
---|
920 |
|
---|
921 | begin
|
---|
922 |
|
---|
923 | if (svSetupType = "Local Library") then
|
---|
924 | return;
|
---|
925 | endif;
|
---|
926 |
|
---|
927 | VarSave(SRCTARGETDIR);
|
---|
928 |
|
---|
929 | SRCDIR = TARGETDIR ^ "cgi-bin";
|
---|
930 |
|
---|
931 | nResult = FileGrep("gsdlsite.cfg", "**GSDLHOME**", svReturnLine,
|
---|
932 | nvLineNumber, RESTART);
|
---|
933 |
|
---|
934 | if (nResult = 0) then
|
---|
935 | szInsertLine = "gsdlhome \"" + TARGETDIR + "\"";
|
---|
936 | FileInsertLine("gsdlsite.cfg", szInsertLine, nvLineNumber, REPLACE);
|
---|
937 | else
|
---|
938 | MessageBox(@TEXT_FILEGREP_FAILED, WARNING);
|
---|
939 | endif;
|
---|
940 |
|
---|
941 |
|
---|
942 | nResult = FileGrep("gsdlsite.cfg", "#httpprefix", svReturnLine,
|
---|
943 | nvLineNumber, RESTART);
|
---|
944 |
|
---|
945 | if (nResult = 0) then
|
---|
946 | szInsertLine = "httpprefix /gsdl";
|
---|
947 | FileInsertLine("gsdlsite.cfg", szInsertLine, nvLineNumber, REPLACE);
|
---|
948 | else
|
---|
949 | MessageBox(@TEXT_FILEGREP_FAILED, WARNING);
|
---|
950 | endif;
|
---|
951 |
|
---|
952 |
|
---|
953 | nResult = FileGrep("gsdlsite.cfg", "httpimg /images", svReturnLine,
|
---|
954 | nvLineNumber, RESTART);
|
---|
955 |
|
---|
956 | if (nResult = 0) then
|
---|
957 | szInsertLine = "httpimg /gsdl/images";
|
---|
958 | FileInsertLine("gsdlsite.cfg", szInsertLine, nvLineNumber, REPLACE);
|
---|
959 | else
|
---|
960 | MessageBox(@TEXT_FILEGREP_FAILED, WARNING);
|
---|
961 | endif;
|
---|
962 |
|
---|
963 | VarRestore(SRCTARGETDIR);
|
---|
964 |
|
---|
965 | end;
|
---|
966 |
|
---|
967 |
|
---|
968 | // edit setup.bat (if it was installed)
|
---|
969 | function EditSetupBat()
|
---|
970 | STRING svReturnLine, szInsertLine;
|
---|
971 | NUMBER nResult, nvLineNumber;
|
---|
972 |
|
---|
973 | begin
|
---|
974 |
|
---|
975 | if (ComponentIsItemSelected(MEDIA, "Build-time files")=TRUE) then
|
---|
976 |
|
---|
977 | VarSave(SRCTARGETDIR);
|
---|
978 |
|
---|
979 | SRCDIR = TARGETDIR;
|
---|
980 |
|
---|
981 | nResult = FileGrep("setup.bat", "**GSDLHOME**", svReturnLine,
|
---|
982 | nvLineNumber, RESTART);
|
---|
983 |
|
---|
984 | if (nResult = 0) then
|
---|
985 | szInsertLine = "set GSDLHOME=" + TARGETDIR;
|
---|
986 | FileInsertLine("setup.bat", szInsertLine, nvLineNumber, REPLACE);
|
---|
987 | else
|
---|
988 | MessageBox(@TEXT_FILEGREP_FAILED, WARNING);
|
---|
989 | endif;
|
---|
990 |
|
---|
991 | VarRestore(SRCTARGETDIR);
|
---|
992 |
|
---|
993 | endif;
|
---|
994 |
|
---|
995 | end;
|
---|
996 |
|
---|
997 |
|
---|
998 | function CheckWin32s()
|
---|
999 | STRING szTitle, szMsg, svResult, szInfo, svPath, svVersionNumber;
|
---|
1000 | NUMBER nvResult,nResult, nvWin32, nvOSTYPE, nvOLDWIN32S, nvWIN32SINSTALLED;
|
---|
1001 |
|
---|
1002 | begin
|
---|
1003 |
|
---|
1004 | if (GetSystemInfo (OS, nvOSTYPE, svResult) < 0) then
|
---|
1005 | MessageBox("Couldn't get Operating System info.", SEVERE);
|
---|
1006 | endif;
|
---|
1007 |
|
---|
1008 | // get information about win32s
|
---|
1009 | nvOLDWIN32S=0;
|
---|
1010 | GetSystemInfo (WIN32SINSTALLED, nvWIN32SINSTALLED, svResult);
|
---|
1011 | if (nvWIN32SINSTALLED == TRUE) then
|
---|
1012 | GetSystemInfo (WIN32SMAJOR, nvWin32, svResult);
|
---|
1013 | if (nvWin32 == 0) then
|
---|
1014 | nvOLDWIN32S = 1;
|
---|
1015 | else
|
---|
1016 | GetSystemInfo (WIN32SMINOR, nvWin32, svResult);
|
---|
1017 | if (nvWin32 < 30) then
|
---|
1018 | nvOLDWIN32S = 1;
|
---|
1019 | endif;
|
---|
1020 | endif;
|
---|
1021 | endif;
|
---|
1022 |
|
---|
1023 | // run Win32s installation if required.
|
---|
1024 | if ((nvOSTYPE == IS_WINDOWS) || (nvOSTYPE == IS_WIN32S)) then
|
---|
1025 | if ((nvWIN32SINSTALLED == 0)) then
|
---|
1026 | if (CreateProgramFolder(@FOLDER_NAME) < 0) then
|
---|
1027 | MessageBox("CreateProgramFolder failed.", SEVERE);
|
---|
1028 | endif;
|
---|
1029 |
|
---|
1030 | if (AddFolderIcon(@FOLDER_NAME, @INSTALL_GSDL, "\"" + SRCDIR ^ "setup.exe\"", "",
|
---|
1031 | "", 0, "", REPLACE) < 0) then
|
---|
1032 | MessageBox("AddFolderIcon failed.", SEVERE);
|
---|
1033 | endif;
|
---|
1034 |
|
---|
1035 | MessageBox(@TEXT_ERROR_NO_WIN32S, INFORMATION);
|
---|
1036 | LaunchApp(SRCDIR ^ "bin" ^ "windows" ^ "win32s" ^ "setup.exe","");
|
---|
1037 | exit;
|
---|
1038 | else
|
---|
1039 | if (nvOLDWIN32S == 1) then
|
---|
1040 | MessageBox(@TEXT_ERROR_OLD_WIN32S, INFORMATION);
|
---|
1041 | endif;
|
---|
1042 | endif;
|
---|
1043 | endif;
|
---|
1044 | end;
|
---|
1045 |
|
---|
1046 | // turn any backslashes in string into forward slashes
|
---|
1047 | function rs (svString)
|
---|
1048 | NUMBER i;
|
---|
1049 | begin
|
---|
1050 |
|
---|
1051 | for i = 0 to StrLength(svString)
|
---|
1052 | if (svString[i] = '\\') then
|
---|
1053 | svString[i] = '/';
|
---|
1054 | endif;
|
---|
1055 | endfor;
|
---|
1056 |
|
---|
1057 | end;
|
---|
1058 |
|
---|
1059 | // Display a messagebox asking if the Collection Organizer
|
---|
1060 | // should be installed and run it's installer if it should
|
---|
1061 | function InstallCollOrganizer()
|
---|
1062 |
|
---|
1063 | begin
|
---|
1064 |
|
---|
1065 | if (bIs32BitSetup = FALSE) then
|
---|
1066 | // can't install Organizer on Windows 3.1
|
---|
1067 | return;
|
---|
1068 | endif;
|
---|
1069 |
|
---|
1070 | if (AskYesNo(@TEXT_COLLORG, YES) == YES) then
|
---|
1071 | LaunchApp(SRCDIR ^ ".." ^ "windows_utilities" ^ "CollOrganizer.exe", "");
|
---|
1072 | endif;
|
---|
1073 |
|
---|
1074 | end;
|
---|
1075 |
|
---|
1076 |
|
---|
1077 | // if running NT/2000 we need to make the collect and tmp
|
---|
1078 | // directories and some contents of the etc directory writable
|
---|
1079 | // by all users (otherwise certain functions will only work
|
---|
1080 | // if Greenstone is run by someone with admin privileges)
|
---|
1081 | function SetPermissions()
|
---|
1082 | STRING szProgram, szCmdLine;
|
---|
1083 | NUMBER nvExitCode;
|
---|
1084 |
|
---|
1085 | begin
|
---|
1086 |
|
---|
1087 | if (bWinNT) then
|
---|
1088 |
|
---|
1089 | szProgram = WINSYSDIR ^ "cmd.exe";
|
---|
1090 |
|
---|
1091 | szCmdLine = "/c cacls \"" + TARGETDIR ^ "tmp\" /E /G Everyone:F";
|
---|
1092 | _LaunchAppEx(szProgram, szCmdLine, WAIT, SW_HIDE, 5000, nvExitCode);
|
---|
1093 |
|
---|
1094 | szCmdLine = "/c cacls \"" + TARGETDIR ^ "collect\" /E /G Everyone:F";
|
---|
1095 | _LaunchAppEx(szProgram, szCmdLine, WAIT, SW_HIDE, 5000, nvExitCode);
|
---|
1096 |
|
---|
1097 | szCmdLine = "/c cacls \"" + TARGETDIR ^ "etc" ^ "error.txt\" /E /G Everyone:F";
|
---|
1098 | _LaunchAppEx(szProgram, szCmdLine, WAIT, SW_HIDE, 5000, nvExitCode);
|
---|
1099 |
|
---|
1100 | szCmdLine = "/c cacls \"" + TARGETDIR ^ "etc" ^ "key.db\" /E /G Everyone:F";
|
---|
1101 | _LaunchAppEx(szProgram, szCmdLine, WAIT, SW_HIDE, 5000, nvExitCode);
|
---|
1102 |
|
---|
1103 | szCmdLine = "/c cacls \"" + TARGETDIR ^ "etc" ^ "users.db\" /E /G Everyone:F";
|
---|
1104 | _LaunchAppEx(szProgram, szCmdLine, WAIT, SW_HIDE, 5000, nvExitCode);
|
---|
1105 |
|
---|
1106 | szCmdLine = "/c cacls \"" + TARGETDIR ^ "etc" ^ "main.cfg\" /E /G Everyone:F";
|
---|
1107 | _LaunchAppEx(szProgram, szCmdLine, WAIT, SW_HIDE, 5000, nvExitCode);
|
---|
1108 |
|
---|
1109 | szCmdLine = "/c cacls \"" + TARGETDIR ^ "etc" ^ "history.db\" /E /G Everyone:F";
|
---|
1110 | _LaunchAppEx(szProgram, szCmdLine, WAIT, SW_HIDE, 5000, nvExitCode);
|
---|
1111 |
|
---|
1112 | szCmdLine = "/c cacls \"" + TARGETDIR ^ "etc" ^ "usage.txt\" /E /G Everyone:F";
|
---|
1113 | _LaunchAppEx(szProgram, szCmdLine, WAIT, SW_HIDE, 5000, nvExitCode);
|
---|
1114 |
|
---|
1115 | endif;
|
---|
1116 |
|
---|
1117 | end;
|
---|
1118 |
|
---|
1119 | function _LaunchAppEx(szProgram, szCmdLine, nWait, nShow, nTimeOut, nvExitCode)
|
---|
1120 | STARTUPINFO siData;
|
---|
1121 | PROCESS_INFORMATION piData;
|
---|
1122 |
|
---|
1123 | begin
|
---|
1124 |
|
---|
1125 | siData.cb = 68;
|
---|
1126 | siData.lpReserved = NULL;
|
---|
1127 | siData.lpDesktop = NULL;
|
---|
1128 | siData.lpTitle = NULL;
|
---|
1129 | siData.dwX = 0;
|
---|
1130 | siData.dwY = 0;
|
---|
1131 | siData.dwXSize = 0;
|
---|
1132 | siData.dwYSize = 0;
|
---|
1133 | siData.dwXCountChars = 0;
|
---|
1134 | siData.dwYCountChars = 0;
|
---|
1135 | siData.dwFillAttribute = 0;
|
---|
1136 | siData.dwFlags = 1;
|
---|
1137 | siData.wShowWindow = nShow;
|
---|
1138 | siData.lpReserved2 = NULL;
|
---|
1139 | siData.hStdInput = NULL;
|
---|
1140 | siData.hStdOutput = NULL;
|
---|
1141 | siData.hStdError = NULL;
|
---|
1142 |
|
---|
1143 | if (CreateProcessA(NULL, szProgram + " " + szCmdLine, NULL, NULL,
|
---|
1144 | TRUE, 0, NULL, NULL, &siData, &piData) = 0) then
|
---|
1145 | return (-1);
|
---|
1146 | endif;
|
---|
1147 |
|
---|
1148 | if ( nWait != WAIT ) then
|
---|
1149 | nvExitCode = 0;
|
---|
1150 | return 0;
|
---|
1151 | endif;
|
---|
1152 |
|
---|
1153 | WaitForSingleObject(piData.hProcess, nTimeOut);
|
---|
1154 |
|
---|
1155 | GetExitCodeProcess(piData.hProcess, &nvExitCode);
|
---|
1156 |
|
---|
1157 | CloseHandle(piData.hProcess);
|
---|
1158 | CloseHandle(piData.hThread);
|
---|
1159 |
|
---|
1160 | return 0;
|
---|
1161 | end;
|
---|
1162 |
|
---|
1163 |
|
---|
1164 | ///////////////////////////////////////////////////////////////////////////////
|
---|
1165 | //
|
---|
1166 | //
|
---|
1167 | //
|
---|
1168 | ///////////////////////////////////////////////////////////////////////////////
|
---|
1169 |
|
---|
1170 | // --- include script file section ---
|
---|
1171 |
|
---|
1172 | #include "sddialog.rul"
|
---|
1173 |
|
---|
1174 |
|
---|
1175 |
|
---|
1176 |
|
---|
1177 |
|
---|
1178 |
|
---|
1179 |
|
---|
1180 |
|
---|
1181 |
|
---|
1182 |
|
---|
1183 |
|
---|
1184 |
|
---|
1185 |
|
---|
1186 |
|
---|
1187 |
|
---|
1188 |
|
---|
1189 |
|
---|
1190 |
|
---|
1191 |
|
---|
1192 |
|
---|