From 6fd9ea3368d22c9049dd710f4ce5b9470025763d Mon Sep 17 00:00:00 2001 From: kkolinko Date: Sun, 14 Nov 2010 20:38:40 +0000 Subject: [PATCH] - Move SecMenu section back to its place, but extract its code into a separate method. (The "components" page of the installer lists sections in the order they apprear in the script file). - Fix processing of tomcat-user.xml, server.xml broken by r1034926. Using 'ReserveFile' was not enough. A 'File' statement must be used as well. - Fix control type for the "password" field. - Simplify several logical expressions. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1035062 13f79535-47bb-0310-9956-ffa450edef68 --- res/tomcat.nsi | 160 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 88 insertions(+), 72 deletions(-) diff --git a/res/tomcat.nsi b/res/tomcat.nsi index 87e885a79..e900914a2 100644 --- a/res/tomcat.nsi +++ b/res/tomcat.nsi @@ -139,6 +139,10 @@ Var CtlTomcatAdminRoles ReserveFile "${NSISDIR}\Plugins\System.dll" ReserveFile "${NSISDIR}\Plugins\nsDialogs.dll" + ReserveFile confinstall\server_1.xml + ReserveFile confinstall\server_2.xml + ReserveFile confinstall\tomcat-users_1.xml + ReserveFile confinstall\tomcat-users_2.xml ;-------------------------------- ;Installer Sections @@ -180,12 +184,13 @@ Section "Core" SecTomcatCore File bin\tomcat@VERSION_MAJOR@w.exe ; Get the current platform x86 / AMD64 / IA64 - StrCmp $Arch "x86" 0 +2 - File /oname=tomcat@VERSION_MAJOR@.exe bin\tomcat@VERSION_MAJOR@.exe - StrCmp $Arch "x64" 0 +2 - File /oname=tomcat@VERSION_MAJOR@.exe bin\x64\tomcat@VERSION_MAJOR@.exe - StrCmp $Arch "i64" 0 +2 - File /oname=tomcat@VERSION_MAJOR@.exe bin\i64\tomcat@VERSION_MAJOR@.exe + ${If} $Arch == "x86" + File /oname=tomcat@VERSION_MAJOR@.exe bin\tomcat@VERSION_MAJOR@.exe + ${ElseIf} $Arch == "x64" + File /oname=tomcat@VERSION_MAJOR@.exe bin\x64\tomcat@VERSION_MAJOR@.exe + ${ElseIf} $Arch == "i64" + File /oname=tomcat@VERSION_MAJOR@.exe bin\i64\tomcat@VERSION_MAJOR@.exe + ${EndIf} InstallRetry: FileOpen $R7 "$INSTDIR\logs\service-install.log" w @@ -229,12 +234,13 @@ Section "Native" SecTomcatNative SetOutPath $INSTDIR\bin - StrCmp $Arch "x86" 0 +2 - File bin\tcnative-1.dll - StrCmp $Arch "x64" 0 +2 - File /oname=tcnative-1.dll bin\x64\tcnative-1.dll - StrCmp $Arch "i64" 0 +2 - File /oname=tcnative-1.dll bin\i64\tcnative-1.dll + ${If} $Arch == "x86" + File bin\tcnative-1.dll + ${ElseIf} $Arch == "x64" + File /oname=tcnative-1.dll bin\x64\tcnative-1.dll + ${ElseIf} $Arch == "i64" + File /oname=tcnative-1.dll bin\i64\tcnative-1.dll + ${EndIf} ClearErrors @@ -242,6 +248,13 @@ SectionEnd SubSectionEnd +Section "Start Menu Items" SecMenu + + SectionIn 1 2 3 + + Call createShortcuts +SectionEnd + Section "Documentation" SecDocs SectionIn 1 3 @@ -280,57 +293,6 @@ Section "Examples" SecExamples SectionEnd -Section "Start Menu Items" SecMenu - - SectionIn 1 2 3 - - SetOutPath "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@" - - CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat Home Page.lnk" \ - "http://tomcat.apache.org/" - - CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Welcome.lnk" \ - "http://127.0.0.1:$TomcatPort/" - - SectionGetFlags ${SecManager} $0 - IntOp $0 $0 & ${SF_SELECTED} - ${If} $0 <> 0 - CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat Manager.lnk" \ - "http://127.0.0.1:$TomcatPort/manager/html" - ${EndIf} - - SectionGetFlags ${SecHostManager} $0 - IntOp $0 $0 & ${SF_SELECTED} - ${If} $0 <> 0 - CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat Host Manager.lnk" \ - "http://127.0.0.1:$TomcatPort/host-manager/html" - ${EndIf} - - SectionGetFlags ${SecDocs} $0 - IntOp $0 $0 & ${SF_SELECTED} - ${If} $0 <> 0 - CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat Documentation.lnk" \ - "$INSTDIR\webapps\tomcat-docs\index.html" - ${EndIf} - - CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Uninstall Tomcat @VERSION_MAJOR_MINOR@.lnk" \ - "$INSTDIR\Uninstall.exe" - - CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat @VERSION_MAJOR_MINOR@ Program Directory.lnk" \ - "$INSTDIR" - - CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Monitor Tomcat.lnk" \ - "$INSTDIR\bin\tomcat@VERSION_MAJOR@w.exe" \ - '//MS//Tomcat@VERSION_MAJOR@' \ - "$INSTDIR\tomcat.ico" 0 SW_SHOWNORMAL - - CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Configure Tomcat.lnk" \ - "$INSTDIR\bin\tomcat@VERSION_MAJOR@w.exe" \ - '//ES//Tomcat@VERSION_MAJOR@' \ - "$INSTDIR\tomcat.ico" 0 SW_SHOWNORMAL - -SectionEnd - Section -post FileWrite $R7 '"$INSTDIR\bin\tomcat@VERSION_MAJOR@.exe" //US//Tomcat@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" @@ -473,7 +435,7 @@ Function pageConfiguration Pop $CtlTomcatAdminUsername ${NSD_CreateLabel} 10u 70u 140u 15u "$(TEXT_CONF_LABEL_ADMINPASSWORD)" Pop $R0 - ${NSD_CreateText} 150u 70u 110u 13u "$TomcatAdminPassword" + ${NSD_CreatePassword} 150u 70u 110u 13u "$TomcatAdminPassword" Pop $CtlTomcatAdminPassword ${NSD_CreateLabel} 10u 90u 140u 15u "$(TEXT_CONF_LABEL_ADMINROLES)" Pop $R0 @@ -665,8 +627,9 @@ Function findJavaHome ; Use the 64-bit registry on 64-bit machines ExpandEnvStrings $0 "%PROGRAMW6432%" - StrCmp $0 "%PROGRAMW6432%" +2 0 - SetRegView 64 + ${If} $0 != "%PROGRAMW6432%" + SetRegView 64 + ${EndIf} ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion" ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$2" "JavaHome" @@ -773,10 +736,10 @@ Function configure ; that is automatically deleted when the installer exits. InitPluginsDir SetOutPath $PLUGINSDIR - ReserveFile confinstall\server_1.xml - ReserveFile confinstall\server_2.xml - ReserveFile confinstall\tomcat-users_1.xml - ReserveFile confinstall\tomcat-users_2.xml + File confinstall\server_1.xml + File confinstall\server_2.xml + File confinstall\tomcat-users_1.xml + File confinstall\tomcat-users_2.xml ; Build final server.xml Delete "$INSTDIR\conf\server.xml" @@ -798,11 +761,12 @@ Function configure FileOpen $R9 "$INSTDIR\conf\tomcat-users.xml" w ; File will be written using current windows codepage System::Call 'Kernel32::GetACP() i .r18' - StrCmp $R8 "932" 0 +3 + ${If} $R8 == "932" ; Special case where Java uses non-standard name for character set FileWrite $R9 "$\r$\n" - Goto +2 + ${Else} FileWrite $R9 "$\r$\n" + ${EndIf} Push "$PLUGINSDIR\tomcat-users_1.xml" Call copyFile FileWrite $R9 $R5 @@ -860,6 +824,58 @@ Function copyFile FunctionEnd +; ================= +; createShortcuts Function +; ================= +; +; This is called by the SecMenu section. +; +; The code is moved here, because ${SecManager} etc. are not visible +; in SecMenu, because they are defined lower than it. +; +Function createShortcuts + + SetOutPath "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@" + + CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat Home Page.lnk" \ + "http://tomcat.apache.org/" + + CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Welcome.lnk" \ + "http://127.0.0.1:$TomcatPort/" + + ${If} ${SectionIsSelected} ${SecManager} + CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat Manager.lnk" \ + "http://127.0.0.1:$TomcatPort/manager/html" + ${EndIf} + + ${If} ${SectionIsSelected} ${SecHostManager} + CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat Host Manager.lnk" \ + "http://127.0.0.1:$TomcatPort/host-manager/html" + ${EndIf} + + ${If} ${SectionIsSelected} ${SecDocs} + CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat Documentation.lnk" \ + "$INSTDIR\webapps\tomcat-docs\index.html" + ${EndIf} + + CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Uninstall Tomcat @VERSION_MAJOR_MINOR@.lnk" \ + "$INSTDIR\Uninstall.exe" + + CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Tomcat @VERSION_MAJOR_MINOR@ Program Directory.lnk" \ + "$INSTDIR" + + CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Monitor Tomcat.lnk" \ + "$INSTDIR\bin\tomcat@VERSION_MAJOR@w.exe" \ + '//MS//Tomcat@VERSION_MAJOR@' \ + "$INSTDIR\tomcat.ico" 0 SW_SHOWNORMAL + + CreateShortCut "$SMPROGRAMS\Apache Tomcat @VERSION_MAJOR_MINOR@\Configure Tomcat.lnk" \ + "$INSTDIR\bin\tomcat@VERSION_MAJOR@w.exe" \ + '//ES//Tomcat@VERSION_MAJOR@' \ + "$INSTDIR\tomcat.ico" 0 SW_SHOWNORMAL + +FunctionEnd + ;-------------------------------- ;Uninstaller Section -- 2.11.0