Tuesday, July 24, 2007

Installer Progress Report

Hello all. I took the weekend off for the most part due to a friend visiting from out of town, but tonight I really dove into the dependency checking code some more.

The code is written in C++ in order to break our dependency on the JRE at install time. This makes things very challenging from a programming perspective because C++ has no built-in way of getting feedback from system() commands. That was the nice thing about Java; all of that stuff was built-in. The only way (that I can see) to do it in C++ is to append " > somefile.txt" to the end of any system() command you want to run, and then read that output file. It's a pain, yes, but it does work, and actually pretty well for what I need it to do.

Anyways, currently the code can detect the JRE version and multiple standard-install MySQL versions. "standard-install" is defined as "Installations located in the standard MySQL install folder: C:\Program Files\MySQL" The way it does this is it obtains a list of all files in the standard install directory, and knowing the directory structure, tries to find a MySQL binary in the bin directory. It then logs each valid install to a file that BitRock will read during installation. If no valid installs are found, it logs a single failure. The same goes for the JRE, except it only checks for the standard JRE which is installed to the PATH by default.

My main goal for tomorrow is to support MySQL that is installed in the PATH. I started to do this tonight, but it became really complicated to search for MySQL in the PATH AND multiple default installs. The main reason is that we need to keep track of the path to each valid install so that BitRock has that information to provide to the user so they can choose which installation of MySQL they'd like to use (if they have more than one). I think I've got a better idea of how I can implement this now that the code is more or less complete, so we'll see how that goes. My other goal is to interface this code with BitRock. This will consist of using BitRocks readFile mechanism and parsing the log file that my dependency code generates. Depending on how easily I get that accomplished, I could start taking action on that information and then displaying the proper screens to the user. Although, I think that will come on Wednesday at the earliest.

I'll keep everyone posted, take care.

5 comments:

Paul Biondich said...

Thanks for the update, Zach.

Just curious: why did you choose to roll your own JRE dependency checker when Bitrock already has one in place?

Do you need the information at an earlier point in the process or something?

private said...

The main reason is just for simplicity. BitRock can detect if the JRE is there or not, but if not, you have to do additional work within BitRock's environment to continue with the installation. This way, it writes the log file just like the other dependencies, and then BitRock will read that file and load the needed depends. Java is always in the PATH, so the detection for JRE is really trivial.

Paul Biondich said...

Sounds good. What are your initial thoughts on creating a "basket" of checks for each software application?

ie, for mysql: directory checks, windows service checks, registry keys, path checks... and iterate through all of them in a prioritized way until you've exhausted them all?

private said...

I think that would be great, but difficult. Currently, we're checking directories and paths. I think for most this is sufficient because if they have a bare system, it's handled, and if they are advanced enough to install things into non-standard locations, they would be able to find it using a file selection dialog. Vista also becomes an issue when you start talking about the registry, and more so if they didn't use the MySQL installer (i.e they just unzipped it), there will be no registry entry at all. In my eyes, checking in the PATH and in the standard install locations is sufficient and anything past that we can assume the user knows where they put something if they decided to change the default information.

Ben Wolfe said...

Zach, bitrock doesn't force you to quit if the jre isn't there, that is just the default setup. Check out this FAQ for their methodolgy:
http://bitrock.com/support_installbuilder_faq.html#A3_3