How can I find if I'm currently in uninstallation mode?

Comments

1 comment

  • Avatar
    wojciechka

    For detecting if an action is in installer or uninstaller, you can simply set a variable in <initializationActionList> and then just do a check. For example:

    <initializationActionList>
      <setInstallerVariable>
        <name>is_running_installer</name>
        <value>1</value>
      </setInstallerVariable>
    </initializationActionList>
    

    Then you can simply check it by doing:

    <isTrue>
      <value>${is_running_installer}</value>
    </isTrue>
    

    For checking if an action is run in uninstaller, the rule should just be <ifFalse>.

    Regarding if the uninstaller is going to uninstall entire application, the <preUninstallationActionList> and <postUninstallationActionList> for <project> is only run when uninstalling application, so actions that should clean up the application should be run from <project> ones.

    Also, <preUninstallationActionList> for <project> is run before ones for components (and are the first actions run in uninstaller), you can simply set a variable and check it in other actions:

    <preUninstallationActionList>
      <setInstallerVariable>
        <name>is_uninstalling_application</name>
        <value>1</value>
      </setInstallerVariable>
    </preUninstallationActionList>
    

Please sign in to leave a comment.