Author: kkolinko
Date: Sun Nov 14 21:59:23 2010
New Revision: 1035083

URL: http://svn.apache.org/viewvc?rev=1035083&view=rev
Log:
Define a variable to hold a handle to the service-install.log file.
Using $R7 was not clean, because it can be reused in different methods along 
the way.
Append to the file, instead of overwriting it.

Modified:
    tomcat/trunk/res/tomcat.nsi

Modified: tomcat/trunk/res/tomcat.nsi
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/res/tomcat.nsi?rev=1035083&r1=1035082&r2=1035083&view=diff
==============================================================================
--- tomcat/trunk/res/tomcat.nsi (original)
+++ tomcat/trunk/res/tomcat.nsi Sun Nov 14 21:59:23 2010
@@ -58,6 +58,10 @@ Var CtlTomcatAdminUsername
 Var CtlTomcatAdminPassword
 Var CtlTomcatAdminRoles
 
+; Handle of the service-install.log file
+; It is opened in "Core" section and closed in "-post"
+Var ServiceInstallLog
+
 ;--------------------------------
 ;Configuration
 
@@ -192,17 +196,18 @@ Section "Core" SecTomcatCore
   ${EndIf}
 
   InstallRetry:
-  FileOpen $R7 "$INSTDIR\logs\service-install.log" w
-  FileWrite $R7 '"$instdir\bin\tom...@[email protected]" 
//IS//tom...@version_major@ --DisplayName "Apache Tomcat @VERSION_MAJOR@" 
--Description "Apache Tomcat @VERSION@ Server - http://tomcat.apache.org/"; 
--LogPath "$INSTDIR\logs" --Install "$instdir\bin\tom...@[email protected]" 
--Jvm "$JvmDll" --StartPath "$INSTDIR" --StopPath "$INSTDIR"'
-  FileWrite $R7 "$\r$\n"
-  
+  FileOpen $ServiceInstallLog "$INSTDIR\logs\service-install.log" a
+  FileSeek $ServiceInstallLog 0 END
+  FileWrite $ServiceInstallLog '"$instdir\bin\tom...@[email protected]" 
//IS//tom...@version_major@ --DisplayName "Apache Tomcat @VERSION_MAJOR@" 
--Description "Apache Tomcat @VERSION@ Server - http://tomcat.apache.org/"; 
--LogPath "$INSTDIR\logs" --Install "$instdir\bin\tom...@[email protected]" 
--Jvm "$JvmDll" --StartPath "$INSTDIR" --StopPath "$INSTDIR"'
+  FileWrite $ServiceInstallLog "$\r$\n"
+
   ClearErrors
   DetailPrint "Installing tom...@version_major@ service"
   nsExec::ExecToStack '"$instdir\bin\tom...@[email protected]" 
//IS//tom...@version_major@ --DisplayName "Apache Tomcat @VERSION_MAJOR@" 
--Description "Apache Tomcat @VERSION@ Server - http://tomcat.apache.org/"; 
--LogPath "$INSTDIR\logs" --Install "$instdir\bin\tom...@[email protected]" 
--Jvm "$JvmDll" --StartPath "$INSTDIR" --StopPath "$INSTDIR"'
   Pop $0
   Pop $1
   StrCmp $0 "0" InstallOk
-    FileWrite $R7 "Install failed: $0 $1$\r$\n"
+    FileWrite $ServiceInstallLog "Install failed: $0 $1$\r$\n"
     MessageBox MB_ABORTRETRYIGNORE|MB_ICONSTOP \
       "Failed to install tom...@version_major@ service.$\r$\nCheck your 
settings and permissions.$\r$\nIgnore and continue anyway (not recommended)?" \
        /SD IDIGNORE IDIGNORE InstallOk IDRETRY InstallRetry
@@ -210,14 +215,18 @@ Section "Core" SecTomcatCore
   InstallOk:
   ClearErrors
 
+  ; Will be closed in "-post" section
+  ; FileClose $ServiceInstallLog
 SectionEnd
 
 Section "Service Startup" SecTomcatService
 
   SectionIn 3
 
-  FileWrite $R7 '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --Startup auto'
-  FileWrite $R7 "$\r$\n"
+  ${If} $ServiceInstallLog != ""
+    FileWrite $ServiceInstallLog '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --Startup auto'
+    FileWrite $ServiceInstallLog "$\r$\n"
+  ${EndIf}
   DetailPrint "Configuring tom...@version_major@ service"
   nsExec::ExecToLog '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --Startup auto'
   ; Behave like Apache Httpd (put the icon in tray on login)
@@ -293,13 +302,15 @@ Section "Examples" SecExamples
 SectionEnd
 
 Section -post
-  FileWrite $R7 '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --Classpath 
"$INSTDIR\bin\bootstrap.jar;$INSTDIR\bin\tomcat-juli.jar" --StartClass 
org.apache.catalina.startup.Bootstrap --StopClass 
org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop  
--StartMode jvm --StopMode jvm'
-  FileWrite $R7 "$\r$\n"
-  FileWrite $R7 '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --JvmOptions 
"-Dcatalina.home=$INSTDIR#-Dcatalina.base=$INSTDIR#-Djava.endorsed.dirs=$INSTDIR\endorsed#-Djava.io.tmpdir=$INSTDIR\temp#-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager#-Djava.util.logging.config.file=$INSTDIR\conf\logging.properties"'
-  FileWrite $R7 "$\r$\n"
-  FileWrite $R7 '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --StdOutput auto --StdError auto --PidFile 
tom...@[email protected]'
-  FileWrite $R7 "$\r$\n"
-  FileClose $R7
+  ${If} $ServiceInstallLog != ""
+    FileWrite $ServiceInstallLog '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --Classpath 
"$INSTDIR\bin\bootstrap.jar;$INSTDIR\bin\tomcat-juli.jar" --StartClass 
org.apache.catalina.startup.Bootstrap --StopClass 
org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop  
--StartMode jvm --StopMode jvm'
+    FileWrite $ServiceInstallLog "$\r$\n"
+    FileWrite $ServiceInstallLog '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --JvmOptions 
"-Dcatalina.home=$INSTDIR#-Dcatalina.base=$INSTDIR#-Djava.endorsed.dirs=$INSTDIR\endorsed#-Djava.io.tmpdir=$INSTDIR\temp#-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager#-Djava.util.logging.config.file=$INSTDIR\conf\logging.properties"'
+    FileWrite $ServiceInstallLog "$\r$\n"
+    FileWrite $ServiceInstallLog '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --StdOutput auto --StdError auto --PidFile 
tom...@[email protected]'
+    FileWrite $ServiceInstallLog "$\r$\n"
+    FileClose $ServiceInstallLog
+  ${EndIf}
 
   DetailPrint "Configuring tom...@version_major@ service"
   nsExec::ExecToLog '"$instdir\bin\tom...@[email protected]" 
//US//tom...@version_major@ --Classpath 
"$INSTDIR\bin\bootstrap.jar;$INSTDIR\bin\tomcat-juli.jar" --StartClass 
org.apache.catalina.startup.Bootstrap --StopClass 
org.apache.catalina.startup.Bootstrap --StartParams start --StopParams stop  
--StartMode jvm --StopMode jvm'



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to