5

I am compiling my 1st NSIS script, and enjoying the learning curve.

The app has already:

  • Checks if machine is 64bit, aborts if 32bit.
  • Looks for a JRE and installs one if not found.
  • Installs Apache Tomcat 7 using a bundled installer.

    ExecWait '"$PLUGINSDIR\apache-tomcat-7.0.19_x64.exe"'

From this separate installer, the user can choose a different location to the default for installing Tomcat.

It is also possible that another Tomcat could already exist on the same machine, and they install a 2nd instance using different port numbers.

I have looked at a few other samples, but they install Tomcat by unzipping the zip version to a specific folder.
I think it is a better approach to run the TC7 exe installer. Will also make life easier when we need to swap it out for a newer version.

So, my Q is: What is the best approach to retaining the path of where they just installed Tomcat, so that I can grab it from the Tomcat installer and use it back in my NSIS script to deploy the WAR files?

I was hoping to find a system variable, but could not see any.

jakc
  • 1,161
  • 3
  • 15
  • 42

1 Answers1

2

The Tomcat installer writes to HKLM "SOFTWARE\Apache Software Foundation\Tomcat\@VERSION_MAJOR_MINOR@\$TomcatServiceName" "InstallPath" but since you don't know the value of $TomcatServiceName I think you might have to call EnumRegKey before and after the Tomcat installer has executed and compare the two lists of subkeys...

Anders
  • 97,548
  • 12
  • 110
  • 164
  • So after the embedded installer has done its thing, this reg key will exist, and I will need to hop into the registry to see if there are >1 entries, and if so, present them to user via drop-down? Would you be able to provide some code snippets, or pseudo code to help me understand how to go about this? – jakc Jan 23 '12 at 08:05
  • If you compare the two lists you should be able to figure out what was added, if they reused the name you would have to display a list – Anders Jan 23 '12 at 08:22