remm 02/01/31 16:14:54 Modified: . build.xml tomcat.nsi Log: - Make use of the new InstallOptions helper DLL to display a page asking some questions to the user: - user/pass used for the admin webapp - port number on which to install Tomcat Then the user can log in to the admin webapp and change all the other parameters. - Create some shorcuts to the admin webapp and the TC start page. - The way the values are filled in in the config files is a big hack, since NSIS doesn't support filtering (yet). Once filtering is in, we can add some more options, and clean up the script. Revision Changes Path 1.58 +2 -0 jakarta-tomcat-4.0/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/build.xml,v retrieving revision 1.57 retrieving revision 1.58 diff -u -r1.57 -r1.58 --- build.xml 30 Jan 2002 18:29:34 -0000 1.57 +++ build.xml 1 Feb 2002 00:14:54 -0000 1.58 @@ -235,6 +235,8 @@ <copy todir="${tomcat.dist}"> <fileset dir="resources" /> </copy> + <copy file="${nsis.home}/InstallOptions.dll" + todir="${tomcat.dist}" /> <copy file="${javaservice.home}/bin/JavaService.exe" tofile="${tomcat.dist}/bin/tomcat.exe" /> <copy file="tomcat.nsi" tofile="${tomcat.dist}/tomcat.nsi" /> 1.26 +109 -1 jakarta-tomcat-4.0/tomcat.nsi Index: tomcat.nsi =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/tomcat.nsi,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- tomcat.nsi 23 Jan 2002 17:57:24 -0000 1.25 +++ tomcat.nsi 1 Feb 2002 00:14:54 -0000 1.26 @@ -1,6 +1,6 @@ ; Tomcat 4 script for Nullsoft Installer -; $Id: tomcat.nsi,v 1.25 2002/01/23 17:57:24 remm Exp $ +; $Id: tomcat.nsi,v 1.26 2002/02/01 00:14:54 remm Exp $ Name "apache-tomcat-4.1" Caption "Apache Tomcat 4.1" @@ -190,6 +190,8 @@ SetOverwrite on + Call configure + WriteRegStr HKLM "SOFTWARE\Apache\Apache Tomcat 4.1" "" $INSTDIR WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Apache Tomcat 4.1" \ "DisplayName" "Apache Tomcat 4.1 (remove only)" @@ -295,6 +297,112 @@ Push $2 FunctionEnd + + +; ================== +; Configure Function +; ================== +; +; Display the configuration dialog boxes, read the values entered by the user, +; and build the configuration files +; +Function configure + + ; Output files needed for the configuration dialog + SetOverwrite on + GetTempFileName $8 + GetTempFileName $7 + File /oname=$8 "InstallOptions.dll" + File /oname=$7 "config.ini" + + Push $7 + CallInstDLL $8 dialog + Pop $1 + StrCmp $1 "0" NoConfig + + ReadINIStr $R0 $7 "Field 2" State + ReadINIStr $R1 $7 "Field 5" State + ReadINIStr $R2 $7 "Field 7" State + + StrCpy $R4 'port="$R0"' + StrCpy $R5 '<user name="$R1" password="$R2" roles="admin,manager" />' + + SetOutPath $TEMP + File /r confinstall + + ; Build final server.xml + FileOpen $R9 "$INSTDIR\conf\server.xml" w + + Push "$TEMP\confinstall\server_1.xml" + Call copyFile + FileWrite $R9 $R4 + Push "$TEMP\confinstall\server_2.xml" + Call copyFile + + FileClose $R9 + + CopyFiles "$R9" "$INSTDIR\conf" 18 + + ; Build final tomcat-users.xml + FileOpen $R9 "$INSTDIR\conf\tomcat-users.xml" w + + Push "$TEMP\confinstall\tomcat-users_1.xml" + Call copyFile + FileWrite $R9 $R5 + Push "$TEMP\confinstall\tomcat-users_2.xml" + Call copyFile + + FileClose $R9 + + CopyFiles "$R9" "$INSTDIR\conf" 5 + + ; Creating a few shortcuts + IfFileExists "$SMPROGRAMS\Apache Tomcat 4.1" 0 NoLinks + + SetOutPath "$SMPROGRAMS\Apache Tomcat 4.1" + + CreateShortCut "$SMPROGRAMS\Apache Tomcat 4.1\My Tomcat.lnk" \ + "http://127.0.0.1:$R0" + CreateShortCut "$SMPROGRAMS\Apache Tomcat 4.1\Configuration\Tomcat Administration.lnk" \ + "http://127.0.0.1:$R0/admin" + + NoLinks: + + NoConfig: + + Delete $7 + Delete $8 + RMDir /r "$TEMP\confinstall" + +FunctionEnd + + +; ================= +; CopyFile Function +; ================= +; +; Copy specified file contents to $R9 +; +Function copyFile + + ClearErrors + + Pop $0 + + FileOpen $1 $0 r + + NoError: + FileRead $1 $2 + FileWrite $R9 $2 + + IfErrors 0 NoError + + FileClose $1 + + ClearErrors + +FunctionEnd + UninstallText "This will uninstall Apache Tomcat 4.1 from your system:"
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>