1 comment

  • Avatar

    Mono may be installed in multiple ways and even bundled as part of the application. If Mono is installed as part of application deployment, this simply requires adding the files and creating appropriate scripts that run Mono binaries relative to installation path.

    If using the built-in package system, below is an almost complete example of how to check if Mono is installed on dpkg (Ubuntu / Debian) and RPM (CentOS, RHEL and SLES) based systems:

    <runProgram> <program>dpkg-query</program> <programArguments>-W libmono2.02.0-cil</programArguments> <ruleList> <programTest condition="is_in_path" name="dpkg-query" /> </ruleList> </runProgram> <if> <actionList> <setInstallerVariable name="mono_installed" value="1" /> </actionList> <conditionRuleList> <compareValues logic="equals" value1="1" value2="${program_exit_code}" /> </conditionRuleList> <elseActionList> <setInstallerVariable name="mono_installed" value="0" /> </elseActionList> <ruleList> <programTest condition="is_in_path" name="dpkg-query" /> </ruleList> </if>

    Similarly for RPM it would be mono-core. And check for first one would be:

    <runProgram> <program>rpm</program> <programArguments>-q mono-core</programArguments> <ruleList> <programTest condition="is_in_path" name="rpm"/> </ruleList> </runProgram> <if> <actionList> <setInstallerVariable name="mono_installed" value="1"/> </actionList> <conditionRuleList> <compareValues logic="equals" value1="1" value2="${program_exit_code}"/> </conditionRuleList> <elseActionList> <setInstallerVariable name="mono_installed" value="0"/> </elseActionList> <ruleList> <programTest condition="is_in_path" name="rpm"/> </ruleList> </if>

    It is then possible to use an <isFalse> rule to check ${mono_installed} and if not, try to run yum or apt-get command appropriately to install it.

    For example for Debian/Ubuntu it would be:

    <runProgram> <program>apt-get</program> <programArguments>-y install mono-runtime</programArguments> <ruleList> <isFalse> <value>${mono_installed}</value> </isFalse> <programTest> <condition>is_in_path</condition> <name>apt-get</name> </programTest> </ruleList> </runProgram>

Please sign in to leave a comment.