Author: markt Date: Tue Jul 4 14:08:37 2017 New Revision: 1800791 URL: http://svn.apache.org/viewvc?rev=1800791&view=rev Log: Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=52791 Add the ability to set the defaults used by the Windows installer from a configuration file. Patch provided by Sandra Madden.
Modified: tomcat/trunk/res/tomcat.nsi tomcat/trunk/webapps/docs/changelog.xml tomcat/trunk/webapps/docs/setup.xml Modified: tomcat/trunk/res/tomcat.nsi URL: http://svn.apache.org/viewvc/tomcat/trunk/res/tomcat.nsi?rev=1800791&r1=1800790&r2=1800791&view=diff ============================================================================== --- tomcat/trunk/res/tomcat.nsi (original) +++ tomcat/trunk/res/tomcat.nsi Tue Jul 4 14:08:37 2017 @@ -43,6 +43,7 @@ !include "StrFunc.nsh" !include "LogicLib.nsh" !include "FileFunc.nsh" +!include "TextFunc.nsh" ${StrRep} Var JavaHome @@ -359,6 +360,26 @@ Section -post SectionEnd +!define ReadFromConfigIni "!insertmacro ReadFromConfigIni" +!macro ReadFromConfigIni Return_Variable Key_Name Config_File + Push "${Config_File}" + Push "${Return_Variable}" + Push "${Key_Name}" + Call ReadFromConfigIni + IfErrors +2 + StrCpy ${Return_Variable} $1 +!macroend + +Function ReadFromConfigIni + ClearErrors + ; Stack: <Key_Name> <Return_Variable> <Config_File> + Pop $0 ; <Key_Name> Stack: <Return_Variable> <Config_File> + Pop $1 ; <Return_Variable> Stack: <Config_File> + Pop $2 ; <Config_File> Stack: -empty- + + ${ConfigRead} $2 '$0=' $1 ; <Config_File> <Key_Name> <Return_Variable> +FunctionEnd + Function .onInit !ifdef UNINSTALLONLY ; If UNINSTALLONLY is defined, then we aren't supposed to do anything except write out @@ -375,6 +396,7 @@ Function .onInit ${IfNot} ${Errors} MessageBox MB_OK|MB_ICONINFORMATION 'Available options:$\r$\n\ /S - Silent install.$\r$\n\ + /C=config.ini - specify full path of config file to override default values.$\r$\n\ /D=INSTDIR - Specify installation directory.' Abort ${EndIf} @@ -397,6 +419,27 @@ Function .onInit StrCpy $TomcatAdminUsername "" StrCpy $TomcatAdminPassword "" StrCpy $TomcatAdminRoles "" + + ;override default values in case config file was passed in + ${GetOptions} "$R0" "/C=" $R2 + ${IfNot} ${Errors} + ${ReadFromConfigIni} $JavaHome "JavaHome" $R2 + ${ReadFromConfigIni} $TomcatPortShutdown "TomcatPortShutdown" $R2 + ${ReadFromConfigIni} $TomcatPortHttp "TomcatPortHttp" $R2 + ${ReadFromConfigIni} $TomcatPortAjp "TomcatPortAjp" $R2 + ${ReadFromConfigIni} $TomcatMenuEntriesEnable "TomcatMenuEntriesEnable" $R2 + ${ReadFromConfigIni} $TomcatShortcutAllUsers "TomcatShortcutAllUsers" $R2 + ${ReadFromConfigIni} $TomcatServiceDefaultName "TomcatServiceDefaultName" $R2 + ${ReadFromConfigIni} $TomcatServiceName "TomcatServiceName" $R2 + ${ReadFromConfigIni} $TomcatServiceFileName "TomcatServiceFileName" $R2 + ${ReadFromConfigIni} $TomcatServiceManagerFileName "TomcatServiceManagerFileName" $R2 + ${ReadFromConfigIni} $TomcatAdminEnable "TomcatAdminEnable" $R2 + ${ReadFromConfigIni} $TomcatAdminUsername "TomcatAdminUsername" $R2 + ${ReadFromConfigIni} $TomcatAdminPassword "TomcatAdminPassword" $R2 + ${ReadFromConfigIni} $TomcatAdminRoles "TomcatAdminRoles" $R2 + ${EndIf} + ClearErrors + FunctionEnd Function pageChooseJVM @@ -880,7 +923,7 @@ Function findJVMPath IfFileExists "$2" FoundJvmDll ClearErrors - ;Step tree: Read defaults from registry + ;Step three: Read defaults from registry ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion" ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "RuntimeLib" Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1800791&r1=1800790&r2=1800791&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Tue Jul 4 14:08:37 2017 @@ -45,6 +45,15 @@ issues do not "pop up" wrt. others). --> <section name="Tomcat 9.0.0.M24 (markt)" rtext="in development"> + <subsection name="Other"> + <changelog> + <add> + <bug>52791</bug>: Add the ability to set the defaults used by the + Windows installer from a configuration file. Patch provided by Sandra + Madden. (markt) + </add> + </changelog> + </subsection> </section> <section name="Tomcat 9.0.0.M23 (markt)" rtext="release in progress"> <subsection name="Catalina"> Modified: tomcat/trunk/webapps/docs/setup.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/setup.xml?rev=1800791&r1=1800790&r2=1800791&view=diff ============================================================================== --- tomcat/trunk/webapps/docs/setup.xml (original) +++ tomcat/trunk/webapps/docs/setup.xml Tue Jul 4 14:08:37 2017 @@ -71,6 +71,31 @@ will not be any tray icon present when Tomcat is running. Note that when choosing to run Tomcat at the end of installation, the tray icon will be used even if Tomcat was installed as a service.</li> + <li><strong>Defaults</strong>: The defaults used by the installer may be + overridden by use of the <code>/C=<config file></code> command + line argument. The configuration file uses the format + <code>name=value</code> with each pair on a separate line. The names + of the available configuration options are: + <ul> + <li>JavaHome</li> + <li>TomcatPortShutdown</li> + <li>TomcatPortHttp</li> + <li>TomcatPortAjp</li> + <li>TomcatMenuEntriesEnable</li> + <li>TomcatShortcutAllUsers</li> + <li>TomcatServiceDefaultName</li> + <li>TomcatServiceName</li> + <li>TomcatServiceFileName</li> + <li>TomcatServiceManagerFileName</li> + <li>TomcatAdminEnable</li> + <li>TomcatAdminUsername</li> + <li>TomcatAdminPassword</li> + <li>TomcatAdminRoles</li> + </ul> + By using <code>/C=...</code> along with <code>/S</code> and + <code>/D=</code> it is possible to perform fully configured + unattended installs of Apache Tomact. + </li> <li>Refer to the <a href="windows-service-howto.html">Windows Service HOW-TO</a> for information on how to manage Tomcat as a Windows service. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org