remm        01/11/21 13:04:52

  Modified:    .        tomcat.nsi
  Log:
  - Update the install script after figuring out out to handle parameters in
    functions in NSIS (use the stack, assembly style ...). Using functions avoids
    code duplication, and will maybe allow enhancing further the env detection.
  - Add findJavaPath function: "returns" the JDK path.
  - Add findJVMPath function: "returns" the full path to the JVM DLL.
  - NSIS 1.67 recommended.
  
  Revision  Changes    Path
  1.21      +80 -47    jakarta-tomcat-4.0/tomcat.nsi
  
  Index: tomcat.nsi
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/tomcat.nsi,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- tomcat.nsi        2001/11/17 22:32:30     1.20
  +++ tomcat.nsi        2001/11/21 21:04:52     1.21
  @@ -1,6 +1,6 @@
   
   ; Tomcat 4 script for Nullsoft Installer
  -; $Id: tomcat.nsi,v 1.20 2001/11/17 22:32:30 remm Exp $
  +; $Id: tomcat.nsi,v 1.21 2001/11/21 21:04:52 remm Exp $
   
   Name "apache-tomcat-4.1"
   Caption "Apache Tomcat 4.1"
  @@ -11,6 +11,7 @@
   
   BGGradient 000000 800000 FFFFFF
   InstallColors FF8080 000000
  +InstProgressFlags smooth colored
   
   Icon main.ico
   UninstallIcon uninst.ico 
  @@ -32,7 +33,7 @@
   InstallDir "$PROGRAMFILES\Apache Tomcat 4.1"
   InstallDirRegKey HKLM "SOFTWARE\Apache\Apache Tomcat 4.1" ""
   
  -Section "Tomcat 4.1 (required)"
  +Section "Tomcat (required)"
   
     SectionIn 1 2 3
   
  @@ -49,17 +50,9 @@
     File webapps\*.xml
     File /r webapps\ROOT
   
  -  ReadEnvStr $2 JAVA_HOME
  +  Call findJavaPath
  +  Pop $2
   
  -  IfErrors 0 FoundJDK
  -
  -  ClearErrors
  -
  -  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Development Kit" "CurrentVersion"
  -  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Development Kit\$1" "JavaHome"
  -
  -  FoundJDK:
  -
     CopyFiles "$2\lib\tools.jar" "$INSTDIR\common\lib" 4500
   
   SectionEnd
  @@ -67,24 +60,10 @@
   Section "NT Service (NT/2k/XP only)"
   
     SectionIn 3
  -
  -  ReadEnvStr $1 JAVA_HOME
  -  IfFileExists $1\jre\bin\hotspot\jvm.dll 0 TryJDK14
  -    StrCpy $2 $1\jre\bin\hotspot\jvm.dll
  -    Goto EndIfFileExists
  -  TryJDK14:
  -    StrCpy $2 $1\jre\bin\server\jvm.dll
  -  EndIfFileExists:
  -
  -  IfErrors 0 FoundJDK
   
  -  ClearErrors
  +  Call findJVMPath
  +  Pop $2
   
  -  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
  -  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "RuntimeLib"
  -  
  -  FoundJDK:
  -  
     SetOutPath $INSTDIR\bin
     File /oname=tomcat.exe bin\tomcat.exe
     
  @@ -113,21 +92,13 @@
   
   SectionEnd
   
  -Section "Tomcat 4.1 Start Menu Group"
  +Section "Tomcat Start Menu Group"
   
     SectionIn 1 2 3
   
  -  ReadEnvStr $2 JAVA_HOME
  -
  -  IfErrors 0 FoundJDK
  -
  -  ClearErrors
  +  Call findJavaPath
  +  Pop $2
   
  -  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
  -  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
  -
  -  FoundJDK:
  -
     SetOutPath "$SMPROGRAMS\Apache Tomcat 4.1"
   
     CreateShortCut "$SMPROGRAMS\Apache Tomcat 4.1\Tomcat Home Page.lnk" \
  @@ -162,9 +133,9 @@
   
   SectionEnd
   
  -SectionDivider
  +SectionDivider " documentation and examples "
   
  -Section "Tomcat 4.1 Documentation"
  +Section "Tomcat Documentation"
   
     SectionIn 1 3
     SetOutPath $INSTDIR\webapps
  @@ -195,9 +166,9 @@
   
   SectionEnd
   
  -SectionDivider
  +SectionDivider " developer resources "
   
  -Section "Tomcat 4.1 Source Code"
  +Section "Tomcat Source Code"
   
     SectionIn 3
     SetOutPath $INSTDIR
  @@ -235,8 +206,32 @@
   
     ClearErrors
   
  -  Call doUpdate
  +  Call findJavaPath
  +  Pop $1
  +  MessageBox MB_OK "Using Java Development Kit found in $1"
   
  +FunctionEnd
  +
  +
  +Function .onInstSuccess
  +
  +  ExecShell open '$SMPROGRAMS\Apache Tomcat 4.1'
  +
  +FunctionEnd
  +
  +
  +; =====================
  +; FindJavaPath Function
  +; =====================
  +;
  +; Find the JAVA_HOME used on the system, and put the result on the top of the
  +; stack
  +; Will exit if the path cannot be determined
  +;
  +Function findJavaPath
  +
  +  ClearErrors
  +
     ReadEnvStr $1 JAVA_HOME
   
     IfErrors 0 FoundJDK
  @@ -256,18 +251,56 @@
       Abort
   
     NoAbort:
  -    MessageBox MB_OK "Using Java Development Kit found in $1"
   
  +  ; Put the result in the stack
  +  Push $1
  +
   FunctionEnd
   
   
  -Function .onInstSuccess
  +; ====================
  +; FindJVMPath Function
  +; ====================
  +;
  +; Find the full JVM path, and put the result on top of the stack
  +; Will exit if the path cannot be determined
  +;
  +Function findJVMPath
   
  -  ExecShell open '$SMPROGRAMS\Apache Tomcat 4.1'
  +  ReadEnvStr $1 JAVA_HOME
  +  IfFileExists $1\jre\bin\hotspot\jvm.dll 0 TryJDK14
  +    StrCpy $2 $1\jre\bin\hotspot\jvm.dll
  +    Goto EndIfFileExists
  +  TryJDK14:
  +    StrCpy $2 $1\jre\bin\server\jvm.dll
  +  EndIfFileExists:
  +
  +  IfErrors 0 FoundJVMPath
  +
  +  ClearErrors
  +
  +  ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
  +  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "RuntimeLib"
  +  
  +  FoundJVMPath:
  +  
  +  IfErrors 0 NoAbort
  +    MessageBox MB_OK "Couldn't find a Java Development Kit installed on this \
  +computer. Please download one from http://java.sun.com.";
  +    Abort
  +
  +  NoAbort:
  +
  +  ; Put the result in the stack
  +  Push $2
   
   FunctionEnd
   
   
  +; =================
  +; DoUpdate Function
  +; =================
  +;
   Function doUpdate
   
     ; This function will be called if a previous Tomcat 4.1 installation has been
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to