Announcement

Collapse
No announcement yet.

How best to chain (handle the return codes of) inter-dependent silent installations

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How best to chain (handle the return codes of) inter-dependent silent installations

    Hi,

    It's been several years since I last dabbled with SUF and I'm rusty with action scripts, LUA, and so on. I wonder therefore if someone could offer me some guidance so that I don't end up reading a manual and attempting trial & error for hours on end and getting nowhere!

    I'm sure my requirement must have been encountered by someone else before now. My installer, as well as my own files, is dependent on three other items, namely: .Net (minimum 4.0, I was thinking of using 4.5.2), which in turn is required for MySQL Community Edition, and finally everything requires a Java 8 JRE.

    Using a Windows VM that I can snapshot and rollback as and when required, I've downloaded the three offline installers and some instructions. I've tried each of the installers and proved they worked by running them from the command line in silent mode. I've then rolled back the VM so it is clean again.

    So far, so good. I'm now ready to replicate these actions in my SUF script. However, my concern is this: when running from the standard Windows command line, I notice that the command prompt returns pretty much immediately, but the installation of the relevant third-party product goes on in the background (as an example, the .Net installation log tells me that it took about 3 minutes to complete). Because of the need to have these third-party installers run synchronously (i.e. check the return code from one before the next starts), I'm not sure how I should instruct SUF to handle this chaining.

    Apologies if this is a dumb question, but any advice would be appreciated.

    Thanks

  • #2
    Here is my suggestion:
    • Start with the .NET Framework 4.5.2. I have provided a dependency module for this technology, which you can find here. There are also downloads of previous versions, so make sure you click the one you need. Even if you prefer running the detection and installation scripts directly as part of your own setup routine, you can extract the functions from the dependency and insert them into the On Pre Install script. Doing so would certainly spare you some time.

      If you inspect the installation script of the dependency module, you will see that I pass a series of command line arguments to perform the installation silently or passively, and finally I check for the exit code. Based on that code, I know if the installation was successful or not.

    • The next step would be the installation of the MySQL server. I don't have a dependency module for that, but this is how I would begin:
      First, check if a MySQL server is already installed on the target system. If there is, overwriting it might break another product previously installed, so perhaps you should only deploy your new server if the existing one is too old and unsupported. One method would be checking if a service name with MySQL in it already exists on the target computer.

      Should you need to deploy the MySQL server, then perform an unattended installation in the same manner as shown in the .NET Framework script, but using the command line arguments specifically for MySQL. You can find these arguments here, of course.

      As the installer for MySQL is provided as a MSI package, you may want to use MSI.RunMsiexec() for installing it.

      Finally, check the exit code. Most likely, a successful installation returns zero, while anything else might mean that something went wrong.

    • The last product you mentioned was Java. I have published a simple script here, which could help you to check if Java is already installed on the target computer. If the Java binary can be found, you can use File.GetVersionInfo() on it and extract the version, comparing it with your requirement. Should the version be too old, install Java JRE, otherwise skip this part.

      Should you need to install the JRE, then follow the instructions provided by Oracle. As always, make sure that you wait for File.Run() to finish (WaitForReturn = true), and check the exit code.


    Ulrich
    Last edited by Ulrich; 02-25-2015, 08:06 AM.

    Comment


    • #3
      Enumerating available COM ports

      Thank you so much, Ulrich.

      One other thing -- is there a handy means of enumerating the available COM serial ports in the host system (so that SUF can display them as an options list in an extra screen, and I can programmatically write the user's selection to a properties file) ?

      Cheers


      Originally posted by Ulrich View Post
      Here is my suggestion:
      • Start with the .NET Framework 4.5.2. I have provided a dependency module for this technology, which you can find here. There are also downloads of previous versions, so make sure you click the one you need. Even if you prefer running the detection and installation scripts directly as part of your own setup routine, you can extract the functions from the dependency and insert them into the On Pre Install script. Doing so would certainly spare you some time.

        If you inspect the installation script of the dependency module, you will see that I pass a series of command line arguments to perform the installation silently or passively, and finally I check for the exit code. Based on that code, I know if the installation was successful or not.

      • The next step would be the installation of the MySQL server. I don't have a dependency module for that, but this is how I would begin:
        First, check if a MySQL server is already installed on the target system. If there is, overwriting it might break another product previously installed, so perhaps you should only deploy your new server if the existing one is too old and unsupported. One method would be checking if a service name with MySQL in it already exists on the target computer.

        Should you need to deploy the MySQL server, then perform an unattended installation in the same manner as shown in the .NET Framework script, but using the command line arguments specifically for MySQL. You can find these arguments here, of course.

        As the installer for MySQL is provided as a MSI package, you may want to use MSI.RunMsiexec() for installing it.

        Finally, check the exit code. Most likely, a successful installation returns zero, while anything else might mean that something went wrong.

      • The last product you mentioned was Java. I have published a simple script here, which could help you to check if Java is already installed on the target computer. If the Java binary can be found, you can use File.GetVersionInfo() on it and extract the version, comparing it with your requirement. Should the version be too old, install Java JRE, otherwise skip this part.

        Should you need to install the JRE, then follow the instructions provided by Oracle. As always, make sure that you wait for File.Run() to finish (WaitForReturn = true), and check the exit code.


      Ulrich

      Comment


      • #4
        Originally posted by roofrack View Post
        One other thing -- is there a handy means of enumerating the available COM serial ports in the host system (so that SUF can display them as an options list in an extra screen, and I can programmatically write the user's selection to a properties file) ?
        You could inspect the registry and enumerate the devices under SERIALCOMM:

        Code:
        [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM]
        "\\Device\\Serial2"="COM2"
        "\\Device\\Serial3"="COM1"
        Ulrich

        Comment

        Working...
        X