Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy WAR to right WebApps folder

Tags:

tomcat

nsis

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.

like image 969
jakc Avatar asked Nov 05 '22 08:11

jakc


1 Answers

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...

like image 127
Anders Avatar answered Nov 09 '22 07:11

Anders