How to check if a component is already installed?


1 comment

  • Avatar

    It is currently not possible.

    As a workaround, you can use actions such as <iniFileSet> to store status of installed components:

    <iniFileSet> <file>${installdir}/component-status.txt</file> <key>component1</key> <section>components</section> <value>${project.component(component1).selected}</value> </iniFileSet>

    Then, it is possible to read the values by doing:

    <setInstallerVariable> <name>previous_component1_selected</name> <value>0</value> </setInstallerVariable> <iniFileGet> <file>${installdir}/component-status.txt</file> <key>component1</key> <section>components</section> <variable>previous_component1_selected</variable> <ruleList> <fileTest> <condition>exists</condition> <path>${installdir}/component-status.txt</path> </fileTest> </ruleList> </iniFileGet>

    This will set the value to 0 and then read it from INI file if it exists.

    The actions should be put in <postShowPageActionList> for installdir component (to check it after user has specified installation directory), as well as <preInstallationActionList> (in case of unattended installation mode).

    Comment actions Permalink

Please sign in to leave a comment.