source: trunk/is_gsdl_cdrom/Script Files/setup.rul@ 2827

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

* empty log message *

  • Property svn:keywords set to Author Date Id Revision
File size: 18.6 KB
Line 
1
2////////////////////////////////////////////////////////////////////////////////
3//
4// IIIIIII SSSSSS
5// II SS InstallShield (R)
6// II SSSSSS (c) 1996-1997, InstallShield Software Corporation
7// II SS (c) 1990-1996, InstallShield Corporation
8// IIIIIII SSSSSS All Rights Reserved.
9//
10//
11// This code is generated as a starting setup template. You should
12// modify it to provide all necessary steps for your setup.
13//
14//
15// File Name: Setup.rul
16//
17// Description: InstallShield script
18//
19// Comments: This template script performs a basic setup. With minor
20// modifications, this template can be adapted to create
21// new, customized setups.
22//
23////////////////////////////////////////////////////////////////////////////////
24
25
26// Include header files
27
28 #include "sdlang.h"
29 #include "sddialog.h"
30
31////////////////////// string defines ////////////////////////////
32
33 #define UNINST_LOGFILE_NAME "Uninst.isu"
34
35//////////////////// installation declarations ///////////////////
36
37// ----- DLL function prototypes -----
38
39
40 // your DLL function prototypes
41
42
43// ---- script function prototypes -----
44
45 // generated by the Project Wizard
46 prototype ShowDialogs();
47 prototype MoveFileData();
48 prototype HandleMoveDataError( NUMBER );
49 prototype ProcessBeforeDataMove();
50 prototype ProcessAfterDataMove();
51 prototype SetupRegistry();
52 prototype SetupFolders();
53 prototype CleanUpInstall();
54 prototype SetupInstall();
55 prototype SetupScreen();
56 prototype CheckRequirements();
57 prototype DialogShowSdLicense();
58 prototype DialogShowSdFinishReboot();
59
60 // your script function prototypes
61 prototype DialogGreenstoneInstallationType();
62 prototype DialogSetupType();
63 prototype DialogSelectCollections();
64 prototype DialogGetAdminPassword();
65 prototype SetComponents();
66 prototype SetAdminPassword();
67 prototype CheckWin32s();
68 prototype CreateServerTxt();
69 prototype EditGsdlsiteCfg();
70 prototype EditSetupBat();
71
72
73 // ----- global variables ------
74
75 // generated by the Project Wizard
76 BOOL bWinNT, bIsShellExplorer, bInstallAborted, bIs32BitSetup;
77 STRING svDir;
78 STRING svName, svCompany, svSerial;
79 STRING svDefGroup;
80 STRING szAppPath;
81 STRING svSetupType;
82
83
84 // your global variables
85 BOOL bCompact;
86 STRING svAdminPassword, svLogFile;
87
88///////////////////////////////////////////////////////////////////////////////
89//
90// MAIN PROGRAM
91//
92// The setup begins here by hiding the visible setup
93// window. This is done to allow all the titles, images, etc. to
94// be established before showing the main window. The setup is
95// then performed in a series of calls to script defined functions,
96// with error checking at each step.
97//
98///////////////////////////////////////////////////////////////////////////////
99program
100 Disable( BACKGROUND );
101
102 CheckRequirements();
103
104 SetupInstall();
105
106 SetupScreen();
107
108 CheckWin32s();
109
110 if (ShowDialogs()<0) goto end_install;
111
112 if (ProcessBeforeDataMove()<0) goto end_install;
113
114 if (MoveFileData()<0) goto end_install;
115
116 if (ProcessAfterDataMove()<0) goto end_install;
117
118 if (SetupRegistry()<0) goto end_install;
119
120 if (SetupFolders()<0) goto end_install;
121
122
123 end_install:
124
125 CleanUpInstall();
126
127 // If an unrecoverable error occurred, clean up
128 // the partial installation. Otherwise, exit normally.
129
130 if (bInstallAborted) then
131 abort;
132 endif;
133
134endprogram
135
136///////////////////////////////////////////////////////////////////////////////
137//
138// Function: ShowDialogs
139//
140// Purpose: This function manages the display and navigation of
141// the standard dialogs that exist in a setup.
142//
143///////////////////////////////////////////////////////////////////////////////
144function ShowDialogs()
145 NUMBER nResult;
146
147begin
148
149 Dlg_Start:
150 // beginning of dialogs label
151
152 Dlg_SdLicense:
153 nResult = DialogShowSdLicense();
154 if (nResult = BACK) goto Dlg_Start;
155
156 if (bIs32BitSetup) then
157
158 Dlg_GreenstoneInstallationType:
159 nResult = DialogGreenstoneInstallationType();
160 if (nResult = BACK) goto Dlg_SdLicense;
161
162 Dlg_SetupType:
163 nResult = DialogSetupType();
164 if (nResult = BACK) goto Dlg_GreenstoneInstallationType;
165
166 endif;
167
168 SetComponents();
169
170 Dlg_SelectCollections:
171 nResult = DialogSelectCollections();
172 if (nResult = BACK) then
173 if (bIs32BitSetup = FALSE) goto Dlg_SdLicense;
174 goto Dlg_SetupType;
175 endif;
176
177 Dlg_GetAdminPassWord:
178 nResult = DialogGetAdminPassword();
179 if (nResult = BACK) goto Dlg_SelectCollections;
180
181 return 0;
182
183end;
184
185///////////////////////////////////////////////////////////////////////////////
186//
187// Function: ProcessBeforeDataMove
188//
189// Purpose: This function performs any necessary operations prior to the
190// actual file transfer.
191//
192///////////////////////////////////////////////////////////////////////////////
193function ProcessBeforeDataMove()
194 NUMBER nResult;
195
196begin
197
198 // Create app information, uninstallation, and App Paths registry keys.
199
200 InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, @PRODUCT_VERSION, @PRODUCT_KEY );
201
202 svLogFile = UNINST_LOGFILE_NAME;
203
204 nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 );
205 if (nResult < 0) then
206 MessageBox( @ERROR_UNINSTSETUP, WARNING );
207 endif;
208
209 szAppPath = TARGETDIR;
210
211 if ((bIs32BitSetup) && (bIsShellExplorer)) then
212 RegDBSetItem( REGDB_APPPATH, szAppPath );
213 RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY );
214 RegDBSetItem( REGDB_UNINSTALL_NAME, @UNINST_DISPLAY_NAME );
215 endif;
216
217 // TO DO : any other tasks you want to perform before file transfer
218
219 return 0;
220end;
221
222///////////////////////////////////////////////////////////////////////////////
223//
224// Function: MoveFileData
225//
226// Purpose: This function handles the file transfer for
227// the setup.
228//
229///////////////////////////////////////////////////////////////////////////////
230function MoveFileData()
231 NUMBER nResult, nDisk;
232
233begin
234
235 nDisk = 1;
236 SetStatusWindow( 0, "" );
237 Disable( DIALOGCACHE );
238 Enable( STATUS );
239 StatusUpdate( ON, 100 );
240 nResult = ComponentMoveData( MEDIA, nDisk, 0 );
241
242 HandleMoveDataError( nResult );
243
244 Disable( STATUS );
245
246 return nResult;
247
248end;
249
250
251///////////////////////////////////////////////////////////////////////////////
252//
253// Function: HandleMoveDataError
254//
255// Purpose: This function handles the error (if any) during the file transfer
256// operation.
257//
258///////////////////////////////////////////////////////////////////////////////
259function HandleMoveDataError( nResult )
260 STRING szErrMsg, svComponent , svFileGroup , svFile;
261
262begin
263
264 svComponent = "";
265 svFileGroup = "";
266 svFile = "";
267
268 switch (nResult)
269 case 0:
270 return 0;
271 default:
272 ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
273 szErrMsg = @ERROR_MOVEDATA + "\n\n" +
274 @ERROR_COMPONENT + " " + svComponent + "\n" +
275 @ERROR_FILEGROUP + " " + svFileGroup + "\n" +
276 @ERROR_FILE + " " + svFile;
277 SprintfBox( SEVERE, @TITLE_CAPTIONBAR, szErrMsg, nResult );
278 bInstallAborted = TRUE;
279 return nResult;
280 endswitch;
281
282end;
283
284///////////////////////////////////////////////////////////////////////////////
285//
286// Function: ProcessAfterDataMove
287//
288// Purpose: This function performs any necessary operations needed after
289// all files have been transferred.
290//
291///////////////////////////////////////////////////////////////////////////////
292function ProcessAfterDataMove()
293 STRING szReferenceFile;
294
295begin
296
297 CreateServerTxt();
298 EditGsdlsiteCfg();
299 EditSetupBat();
300 SetAdminPassword();
301
302 szReferenceFile = svDir ^ @PRODUCT_KEY;
303 DeinstallSetReference( szReferenceFile );
304
305 return 0;
306end;
307
308///////////////////////////////////////////////////////////////////////////////
309//
310// Function: SetupRegistry
311//
312// Purpose: This function makes the registry entries for this setup.
313//
314///////////////////////////////////////////////////////////////////////////////
315function SetupRegistry()
316 NUMBER nResult;
317
318begin
319
320 // TO DO : Add all your registry entry keys here.
321 // Call registry functions and/or create keys from
322 // the InstallShield IDE's Resources pane.
323
324 nResult = CreateRegistrySet( "" );
325
326 return nResult;
327 end;
328
329///////////////////////////////////////////////////////////////////////////////
330//
331// Function: SetupFolders
332//
333// Purpose: This function creates all the folders and shortcuts for the
334// setup. This includes program groups and items for Windows 3.1.
335//
336///////////////////////////////////////////////////////////////////////////////
337function SetupFolders()
338 NUMBER nResult;
339 STRING szIsData;
340 NUMBER nType;
341
342begin
343
344 if (Is(USER_ADMINISTRATOR,szIsData)==TRUE) then
345 nType = COMMON;
346 else
347 nType = PERSONAL;
348
349 endif;
350
351 ProgDefGroupType(nType);
352
353 if (CreateProgramFolder(@FOLDER_NAME) < 0) then
354 MessageBox("CreateProgramFolder failed.", SEVERE);
355 endif;
356
357 // The following adds the shortcuts.
358 if (AddFolderIcon(@FOLDER_NAME, @README, "\"" + TARGETDIR ^ "README.TXT\"", "",
359 "", 0, "", REPLACE) < 0) then
360 MessageBox("AddFolderIcon failed.", SEVERE);
361 endif;
362
363 if (AddFolderIcon(@FOLDER_NAME, @TEXT_UNINSTALL, UNINST + " -f\"" + svLogFile + "\"",
364 "", "", 0, "", REPLACE) < 0) then
365 MessageBox("AddFolderIcon failed.", SEVERE);
366 endif;
367
368 if (ComponentIsItemSelected(MEDIA, "Local library")) then
369 if (AddFolderIcon(@FOLDER_NAME, @FOLDER_NAME, "\"" + TARGETDIR ^ "server.exe\"", "",
370 "", 0, "", REPLACE) < 0) then
371 MessageBox("AddFolderIcon failed.", SEVERE);
372 endif;
373 endif;
374
375 nResult = CreateShellObjects( "" );
376
377 return nResult;
378 end;
379
380///////////////////////////////////////////////////////////////////////////////
381//
382// Function: CleanUpInstall
383//
384// Purpose: This cleans up the setup. Anything that should
385// be released or deleted at the end of the setup should
386// be done here.
387//
388///////////////////////////////////////////////////////////////////////////////
389function CleanUpInstall()
390
391begin
392
393
394 if (bInstallAborted) then
395 return 0;
396 endif;
397
398 DialogShowSdFinishReboot();
399
400 if (BATCH_INSTALL) then // ensure locked files are properly transferred
401 CommitSharedFiles(0);
402 endif;
403
404 return 0;
405end;
406
407///////////////////////////////////////////////////////////////////////////////
408//
409// Function: SetupInstall
410//
411// Purpose: This will initialize the setup. Any general initialization
412// needed for the installation should be performed here.
413//
414///////////////////////////////////////////////////////////////////////////////
415function SetupInstall()
416
417begin
418
419 Enable( CORECOMPONENTHANDLING );
420
421 bInstallAborted = FALSE;
422
423 svDir = PROGRAMFILES ^ "gsdl";
424 TARGETDIR = svDir;
425
426 SdProductName( @PRODUCT_NAME );
427
428 Enable( DIALOGCACHE );
429
430 return 0;
431end;
432
433///////////////////////////////////////////////////////////////////////////////
434//
435// Function: SetupScreen
436//
437// Purpose: This function establishes the screen look. This includes
438// colors, fonts, and text to be displayed.
439//
440///////////////////////////////////////////////////////////////////////////////
441function SetupScreen()
442
443begin
444
445 Enable( FULLWINDOWMODE );
446 Enable( INDVFILESTATUS );
447 SetTitle( @TITLE_MAIN, 24, WHITE );
448
449 SetTitle( @TITLE_CAPTIONBAR, 0, BACKGROUNDCAPTION ); // Caption bar text.
450
451 Enable( BACKGROUND );
452
453 Delay( 1 );
454end;
455
456///////////////////////////////////////////////////////////////////////////////
457//
458// Function: CheckRequirements
459//
460// Purpose: This function checks all minimum requirements for the
461// application being installed. If any fail, then the user
462// is informed and the setup is terminated.
463//
464///////////////////////////////////////////////////////////////////////////////
465function CheckRequirements()
466 NUMBER nvDx, nvDy, nvResult;
467 STRING svResult;
468
469begin
470
471 bWinNT = FALSE;
472 bIsShellExplorer = FALSE;
473
474 // Check screen resolution.
475 GetExtents( nvDx, nvDy );
476
477 if (nvDy < 480) then
478 MessageBox( @ERROR_VGARESOLUTION, WARNING );
479 abort;
480 endif;
481
482 // set 'setup' operation mode
483 bIs32BitSetup = TRUE;
484 GetSystemInfo( ISTYPE, nvResult, svResult );
485 if (nvResult = 16) then
486 bIs32BitSetup = FALSE; // running 16-bit setup
487 return 0; // no additional information required
488 endif;
489
490 // --- 32-bit testing after this point ---
491
492 // Determine the target system's operating system.
493 GetSystemInfo( OS, nvResult, svResult );
494
495 if (nvResult = IS_WINDOWSNT) then
496 // Running Windows NT.
497 bWinNT = TRUE;
498
499 // Check to see if the shell being used is EXPLORER shell.
500 if (GetSystemInfo( OSMAJOR, nvResult, svResult ) = 0) then
501 if (nvResult >= 4) then
502 bIsShellExplorer = TRUE;
503 endif;
504 endif;
505
506 elseif (nvResult = IS_WINDOWS95) then
507 bIsShellExplorer = TRUE;
508
509 endif;
510
511end;
512
513
514///////////////////////////////////////////////////////////////////////////////
515//
516// Function: DialogShowSdLicense
517//
518// Purpose: This function displays the license agreement dialog.
519//
520//
521///////////////////////////////////////////////////////////////////////////////
522function DialogShowSdLicense()
523 NUMBER nResult;
524 STRING szTitle, szMsg, szQuestion, szLicenseFile;
525
526begin
527
528 szLicenseFile = SUPPORTDIR ^ "license.txt";
529 szTitle = "";
530 szMsg = "";
531 szQuestion = "";
532 nResult = SdLicense( szTitle, szMsg, szQuestion, szLicenseFile );
533
534 return nResult;
535end;
536
537
538///////////////////////////////////////////////////////////////////////////////
539//
540// Function: DialogShowSdFinishReboot
541//
542// Purpose: This function will show the last dialog of the product.
543// It will allow the user to reboot and/or show some readme text.
544//
545///////////////////////////////////////////////////////////////////////////////
546function DialogShowSdFinishReboot()
547 NUMBER nResult, nDefOptions;
548 STRING szTitle, szMsg1, szMsg2, szOption1, szOption2;
549 NUMBER bOpt1, bOpt2;
550
551begin
552
553 szTitle = "";
554 szMsg1 = @TEXT_FINISH1;
555 szMsg2 = "";
556 bOpt1 = TRUE;
557 bOpt2 = FALSE;
558 szOption1 = @TEXT_README;
559 szOption2 = "";
560 nResult = SdFinish(szTitle, szMsg1, szMsg2, szOption1, szOption2, bOpt1, bOpt2);
561
562 if (bOpt1) then
563 LaunchAppAndWait(TARGETDIR ^ "README.TXT", "", WAIT);
564 endif;
565
566 return 0;
567
568end;
569
570///////////////////////////////////////////////////////////////////////////////
571//
572//
573//
574///////////////////////////////////////////////////////////////////////////////
575
576
577function DialogGreenstoneInstallationType()
578 NUMBER nResult;
579 STRING szTitle, szMsg;
580
581begin
582
583 szTitle = @TEXT_INSTALL_TYPE;
584 szMsg = @TEXT_INSTALL_TYPE_DESC;
585
586 nResult = SdSetupTypeEx(szTitle, szMsg, "", svSetupType, 0);
587
588 return nResult;
589end;
590
591
592function DialogSetupType()
593 NUMBER nResult, nvCheck1, nvCheck2;
594 STRING szMsg, szText1, szText2;
595
596begin
597
598 nvCheck1 = TRUE;
599 nvCheck2 = FALSE;
600 szMsg = @TEXT_SETUP_TYPE_DESC;
601 szText1 = @TEXT_COMPACT;
602 szText2 = @TEXT_FULL;
603
604 nResult = AskOptions(EXCLUSIVE, szMsg, szText1, nvCheck1, szText2, nvCheck2);
605
606 bCompact = nvCheck1;
607
608 return nResult;
609end;
610
611
612function DialogSelectCollections()
613 NUMBER nResult;
614 STRING szTitle, szMsg;
615
616begin
617
618 szTitle = @TEXT_SELECT_COLLECTIONS;
619 szMsg = @TEXT_SELECT_COLLECTIONS_DESC;
620
621 nResult = SdComponentDialog(szTitle, szMsg, svDir, "collections");
622 TARGETDIR = svDir;
623
624 return nResult;
625end;
626
627
628function DialogGetAdminPassword()
629 STRING szTitle, szMsg, szField1;
630 NUMBER nResult;
631
632begin
633
634 svAdminPassword = "admin"; // the default
635
636 szTitle = @TEXT_ADMIN_PW;
637 szMsg = @TEXT_ADMIN_PW_DESC;
638 szField1 = @TEXT_PW;
639
640 nResult = SdShowDlgEdit1(szTitle, szMsg, szField1, svAdminPassword);
641
642 return nResult;
643end;
644
645
646function SetComponents()
647
648begin
649
650 if (bCompact) then
651 // compact installation
652 ComponentSelectItem(MEDIA, "Documentation", FALSE);
653 ComponentSelectItem(MEDIA, "Export Collection", FALSE);
654
655 else
656 // full installation
657 ComponentSelectItem(MEDIA, "Documentation", TRUE);
658 ComponentSelectItem(MEDIA, "Export Collection", TRUE);
659
660 endif;
661
662 if (bIs32BitSetup) then
663 // Windows 3.1
664 ComponentSelectItem(MEDIA, "Build-time files", FALSE);
665 ComponentSelectItem(MEDIA, "Build-time executables", FALSE);
666
667 endif;
668
669end;
670
671
672function SetAdminPassword()
673
674begin
675
676end;
677
678
679// Create the SERVER.TXT file if installing the web library
680function CreateServerTxt()
681 STRING szTitle, szMsg;
682 LIST listInfo;
683
684begin
685
686 if (ComponentIsItemSelected(MEDIA, "Web library") = FALSE) then
687 return;
688 endif;
689
690 szTitle = "";
691 szMsg = " ";
692
693 listInfo = ListCreate(STRINGLIST);
694
695 ListAddString(listInfo, "hello", AFTER);
696
697 SdShowInfoList(szTitle, szMsg, listInfo);
698
699end;
700
701
702function EditGsdlsiteCfg()
703
704begin
705
706end;
707
708
709function EditSetupBat()
710
711begin
712
713end;
714
715
716function CheckWin32s()
717 STRING szTitle, szMsg, svResult, szInfo, svPath, svVersionNumber;
718 NUMBER nvResult,nResult, nvWin32, nvOSTYPE, nvOLDWIN32S, nvWIN32SINSTALLED;
719
720begin
721
722 if (GetSystemInfo (OS, nvOSTYPE, svResult) < 0) then
723 MessageBox("Couldn't get Operating System info.", SEVERE);
724 endif;
725
726 // get information about win32s
727 nvOLDWIN32S=0;
728 GetSystemInfo (WIN32SINSTALLED, nvWIN32SINSTALLED, svResult);
729 if (nvWIN32SINSTALLED == TRUE) then
730 GetSystemInfo (WIN32SMAJOR, nvWin32, svResult);
731 if (nvWin32 == 0) then
732 nvOLDWIN32S = 1;
733 else
734 GetSystemInfo (WIN32SMINOR, nvWin32, svResult);
735 if (nvWin32 < 30) then
736 nvOLDWIN32S = 1;
737 endif;
738 endif;
739 endif;
740
741 // run Win32s installation if required.
742 if ((nvOSTYPE == IS_WINDOWS) || (nvOSTYPE == IS_WIN32S)) then
743 if ((nvWIN32SINSTALLED == 0)) then
744 if (CreateProgramFolder(@FOLDER_NAME) < 0) then
745 MessageBox("CreateProgramFolder failed.", SEVERE);
746 endif;
747
748 if (AddFolderIcon(@FOLDER_NAME, @INSTALL_GSDL, "\"" + SRCDIR ^ "setup.exe\"", "",
749 "", 0, "", REPLACE) < 0) then
750 MessageBox("AddFolderIcon failed.", SEVERE);
751 endif;
752
753 MessageBox(@TEXT_ERROR_NO_WIN32S, INFORMATION);
754 LaunchApp(SRCDIR ^ "bin" ^ "windows" ^ "win32s" ^ "setup.exe","");
755 exit;
756 else
757 if (nvOLDWIN32S == 1) then
758 MessageBox(@TEXT_ERROR_OLD_WIN32S, INFORMATION);
759 endif;
760 endif;
761 endif;
762end;
763
764///////////////////////////////////////////////////////////////////////////////
765//
766//
767//
768///////////////////////////////////////////////////////////////////////////////
769
770// --- include script file section ---
771
772#include "sddialog.rul"
773
774
775
776
777
Note: See TracBrowser for help on using the repository browser.