Question

How can I run a program only if certain conditions are met?

How can I run a program only if certain conditions are met?

Answer:

The following example shows how a particular script will be executed only if the installation type is 'server', it is running on Linux and a certain file is not already present in the system. The value for the installation type was set during the installation process using a user-defined parameter, as explained earlier in this document.

<runProgram>
    <ruleEvaluationLogic>and</ruleEvaluationLogic>
        <ruleList>
            <compareText>
                <text>${installtype}</text>
                <logic>equals</logic>
                <value>server</value>
            </compareText>
            <compareText>
                <text>${platform_name}</text>
                <logic>equals</logic>
                <value>linux</value>
            </compareText>
            <fileTest>
                <path>/etc/init.d/myservice</path>
                <condition>not_exists</condition>
            </fileTest>
        </ruleList>
     <program>${installdir}/bin/install_service.sh</program>
</runProgram>