How can I tell the installation type when it's running ?

Answered

Comments

1 comment

  • Avatar
    wojciechka

    One option is to set an installer's hidden parameter at build time. For example setting up a hidden parameter to store the value:

    <project>
      <parameterList>
        <stringParameter name="buildFlavor" value="regular" ask="0"/>
      </parameterList>
    </project>
    

    And then specify it to be cdrom or regular at build time when invoking the CLI:

    $ builder build project.xml cdrom --setvars buildFlavor=cdrom
    $ builder build project.xml windows --setvars buildFlavor=regular
    

    Then the buildFlavor variable is accessible at runtime as well and the check is as simple as:

    <compareText>
        <logic>equals</logic>
        <text>${buildFlavor}</text>
        <value>cdrom</value>
    </compareText>
    

    This approach is described in more details in Creating Custom Builds section of InstallBuilder user guide.

    Another option is to compare installer filename. For CDROM mode it will be setup-windows.exe or in general setup-*.???. So the following check can be used:

    <regExMatch>
        <logic>matches</logic>
        <pattern>{[/\\]setup-[^/\\]+\....$}</pattern>
        <text>${installer_pathname}</text>
    </regExMatch>
    

    This checks that last element of ${installer_pathname} variable matches the pattern.

Please sign in to leave a comment.