If regular installations are used for applying support packs, how can I specify dependencies among such installers? Should I just check for ${installdir}/uninstall-spXYZ file presence or there's another more elegant technique?

asked 22 Nov '11, 12:16

GigaG's gravatar image

GigaG
419911
accept rate: 0%


Simplest option is to check for uninstallers' presence. It is also possible to use INI or XML files to store which service packs are installed. You can set appropriate values after installation and uninstallation of service pack:

<project>
  <!-- ... -->
  <readyToInstallActionList>
    <!-- check if prerequisites are installed; throw an error if not -->
    <iniFileGet>
      <file>${installdir}/servicepacks.ini</file>
      <key>spABC</key>
      <section>ServicePack</section>
      <variable>is_dependency1_met</variable>
    </iniFileGet>
    <iniFileGet>
      <file>${installdir}/servicepacks.ini</file>
      <key>spDEF</key>
      <section>ServicePack</section>
      <variable>is_dependency2_met</variable>
    </iniFileGet>
    <throwError>
      <ruleEvaluationLogic>or</ruleEvaluationLogic>
      <text>This service pack requires ABC and DEF service packs installed</text>
      <ruleList>
        <isFalse>
          <value>${is_dependency1_met}</value>
        </isFalse>
        <isFalse>
          <value>${is_dependency2_met}</value>
        </isFalse>
      </ruleList>
    </throwError>
  </readyToInstallActionList>

  <!-- store that service pack XYZ is now installed -->
  <postInstallationActionList>
    <iniFileSet>
      <file>${installdir}/servicepacks.ini</file>
      <key>spXYZ</key>
      <section>ServicePack</section>
      <value>1</value>
    </iniFileSet>
  </postInstallationActionList>

  <!-- store that service pack XYZ is no longer installed -->
  <postUninstallationActionList>
    <iniFileSet>
      <file>${installdir}/servicepacks.ini</file>
      <key>spXYZ</key>
      <section>ServicePack</section>
      <value>0</value>
    </iniFileSet>
  </postUninstallationActionList>
</project>

You can also use the INI/XML file to store which was the last service pack installed and prevent user from uninstalling service pack in order that does not match the order in which they were installed:

<project>
  <!-- ... -->
  <!-- store information that spXYZ was the most recently installed servicepack -->
  <postInstallationActionList>
    <iniFileSet>
      <file>${installdir}/servicepacks.ini</file>
      <key>MostRecent</key>
      <section>Status</section>
      <value>spXYZ</value>
    </iniFileSet>
  </postInstallationActionList>
  <!-- verify that user has not installed any additional service packs in the meantime -->
  <preUninstallationActionList>
    <iniFileGet>
      <file>${installdir}/servicepacks.ini</file>
      <key>MostRecent</key>
      <section>Status</section>
      <variable>mostrecent_servicepack</variable>
    </iniFileGet>
    <throwError>
      <text>Service pack ${mostrecent_servicepack} should be installed first.</text>
      <ruleList>
        <compareText>
          <logic>does_not_equal</logic>
          <text>${mostrecent_servicepack}</text>
          <value>spXYZ</value>
        </compareText>
      </ruleList>
    </throwError>
  </preUninstallationActionList>
  <!-- revert MostRecent servicepack to previously set servicepack -->
  <postUninstallationActionList>
    <iniFileSet>
      <file>${installdir}/servicepacks.ini</file>
      <key>MostRecent</key>
      <section>Status</section>
      <value>${previous_servicepack}</value>
    </iniFileSet>

  <parameterList>
    <!-- ... -->

    <!-- not shown to user, stores previous servicepack that was set before this one was installed -->
    <stringParameter>
      <name>previous_servicepack</name>
      <ask>0</ask>
    </stringParameter>
  </parameterList>
</project>

You can also use rules such as <compareVersions> to verify whether currently installed service pack is newer than service pack user is about to install. This would prevent users from installing a service pack that has been superseded by another service pack.

link

answered 23 Nov '11, 03:21

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×155
×8

Asked: 22 Nov '11, 12:16

Seen: 1,313 times

Last updated: 23 Nov '11, 03:21