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

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

* empty log message *

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