Announcement

Collapse
No announcement yet.

Reboot based on dependency installer

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

  • Reboot based on dependency installer

    I am trying to create my own dependency module for use in my other product installers. I've created an installer that has a bunch of shared components and that works fine. I've made a dependency module that runs that installer when necessary and launches it in silent mode. I know that a Setup Factory installer can return a bunch of possible process return codes, but there doesn't seem to be one that indicates that that installer requires a reboot. Is there a way I can manually set the return code so I can detect it in my main installer and prevent the dependency installer from just forcing a reboot by itself?

    I was looking at the VB6 dependency module as an example and it looks for the File.Run function to return a value of 3010 to indicate a reboot is needed. How can I emulate that sort of functionality?

    Thanks

  • #2
    You can set the exit code of your installer with Application.Exit(). Is that what you are asking? If you just want to tell your main script about a reboot request triggered in a dependency module, use a global or session variable...

    Ulrich

    Comment


    • #3
      That is what I was asking, but maybe there is a better way.

      I built the installer for my shared stuff and it works fine. I can use it by itself when needed and I also wanted to make a dependency module out of it so I could call it from my app installers. When I use it that way, I run it in silent mode. That also works fine. The only problem is that the shared stuff installer has the default On Shutdown script which automatically calls System.Reboot when the installer has been run in silent mode. I don't want that to happen in this case. I just want to notify the parent installer that a reboot is needed. Are you saying that if _NeedsReboot gets set in the child installer, that the parent installer will see that change? I just assumed I had to use the exit code because I saw that being done in some of the provided dependency modules.

      I was planning to take the code from g_HandleSystemReboot and copy it to On Shutdown and make this change:

      if(_NeedsReboot) then
      if(_SilentInstall) then
      -- Always reboot on silent install, if needed
      -- System.Reboot();
      Application.Exit(SomeValue);

      and then deal with the rebooting in the parent installer when that return code is detected.

      Comment


      • #4
        Originally posted by ScottWirt View Post
        Are you saying that if _NeedsReboot gets set in the child installer, that the parent installer will see that change? I just assumed I had to use the exit code because I saw that being done in some of the provided dependency modules.
        No, if you are calling an external program (a new process), you must use the exit code to notify the parent process about the result. You probably want something like this in your On Shutdown script:

        Code:
        if _NeedsReboot then
            if _SilentInstall then
                -- Postpone the reboot during a silent install
                Application.Exit(SomeValue);
            else
                -- Always reboot on interactive install, if needed
                System.Reboot();
            end
        end
        Ulrich

        Comment


        • #5
          Perfect, that's exactly what I was planning. Thanks!

          Comment

          Working...
          X