How do you set up a logic tree in a installer?

Comments

1 comment

  • Avatar
    juanjo

    The below schematic code explains how to do it on Windows:

    <actionGroup>
       <actionList>
          <!-- Check if db is installed with some custom logic.
          For example checking if some dir exists -->
          <if>
            <conditionRuleList>
              <fileExists path="${installdir}/db"/>
            </conditionRuleList>
            <actionList>
               <!-- If an installed db was detected ... -->
               <!-- Check the current version with some specific actions
               and store it into installed_version -->
    
               <!-- Specific actions to check the version go here
               ...
               ...
               -->
               <actionGroup>
                  <actionList>
                      <!-- if old version installed ... -->
                      <runProgram program="db.exe" programArguments="..."/> 
                      <runProgram program="dbdump.exe" programArguments="..."/> 
                      <runProgram program="db.exe" programArguments="..."/> 
                      <runProgram program="createdb.bat" programArguments="..."/> 
                      <runProgram program="psql.exe" programArguments="..."/> 
                      <runProgram program="dbimport.exe" programArguments="..."/> 
                  </actionList>
                  <ruleList>
                    <compareVersions>
                       <version1>${current_packed_version}</version1>
                       <logic>greater</logic>
                       <version2>${installed_version}</version2>
                    </compareVersions>
                  </ruleList>
               </actionGroup>
            </actionList>
            <elseActionList>
              <!-- If not installation was detected ... -->
              <runProgram program="db.exe" programArguments="..."/> 
              <runProgram program="createdb.bat" programArguments="..."/> 
              <runProgram program="psql.exe" programArguments="..."/> 
            </elseActionList>
          </if>
       </actionList>
       <ruleList>
          <platformTest type="windows"/>
       </ruleList>
    </actionGroup>
    

    On OS X you just need to change the <type> in the <platformTest> rule to osx and modify the commands executed for each situation.

Please sign in to leave a comment.