on Windows work this:

<foreach>
   <variables>name variable</variables>
   <values>Version oldVersion Location oldInstalldir</values>
   <actionList>
      <registryGet>
         <key>HKEY_LOCAL_MACHINE\Software\${project.windowsSoftwareRegistryPrefix}</key>
         <name>${name}</name>
         <variable>${variable}</variable>
      </registryGet>
   </actionList>
</foreach>

but what can I do on Linux?

asked 08 Jun '12, 08:17

Martin%20Pecuch's gravatar image

Martin Pecuch
11223
accept rate: 0%


You can store the values in a pre-defined file - such as /etc/${project.vendor}-${project.shortName}.ini.

And then after installation store it by doing:

<postInstallationActionList>
  <iniFileSet>
    <file>/etc/${project.vendor}-${project.shortName}.ini</file>
    <key>installdir</key>
    <section>details</section>
    <value>${installdir}</value>
  </iniFileSet>
  <iniFileSet>
    <file>/etc/${project.vendor}-${project.shortName}.ini</file>
    <key>version</key>
    <section>details</section>
    <value>${project.version}</value>
  </iniFileSet>
</postInstallationActionList>

And reading it can be done by doing:

<preInstallationActionList>
  <iniFileGet>
    <file>/etc/${project.vendor}-${project.shortName}.ini</file>
    <key>installdir</key>
    <section>details</section>
    <variable>oldInstallDir</variable>
  </iniFileGet>
  <iniFileGet>
    <file>/etc/${project.vendor}-${project.shortName}.ini</file>
    <key>version</key>
    <section>details</section>
    <variable>oldVersion</variable>
  </iniFileGet>
</preInstallationActionList>

Finally deleting the file can be done as:

<postUninstallationActionList>
  <deleteFile>
    <path>/etc/${project.vendor}-${project.shortName}.ini</path>
  </deleteFile>
</postUninstallationActionList>

This approach can be used on all Unix systems including Mac OS X.

link

answered 08 Jun '12, 08:36

wojciechka's gravatar image

wojciechka ♦♦
7.8k61122
accept rate: 26%

Thanks! My final solution is:

   <preInstallationActionList>
        <foreach>
            <values>version oldVersion installdir oldInstalldir</values>
            <variables>name variable</variables>
            <actionList>
                <setInstallerVariable name="${variable}" value=""/>
                <iniFileGet>
                    <file>/etc/${project.vendor}-${project.shortName}.ini</file>
                    <key>${name}</key>
                    <section>details</section>
                    <variable>${variable}</variable>
                    <ruleList>
                        <fileTest condition="exists" path="/etc/${project.vendor}-${project.shortName}.ini"/>
                    </ruleList>
                </iniFileGet>
            </actionList>
            <ruleList>
                <platformTest negate="1" type="windows"/>
            </ruleList>
        </foreach>
    </preInstallationActionList>

<postInstallationActionList>
    <foreach>
        <values>version ${project.version} installdir ${installdir}</values>
        <variables>name variable</variables>
        <actionList>
            <iniFileSet>
                <file>/etc/${project.vendor}-${project.shortName}.ini</file>
                <key>${name}</key>
                <section>details</section>
                <value>${variable}</value>
            </iniFileSet>
        </actionList>
        <ruleList>
            <platformTest negate="1" type="windows"/>
        </ruleList>
    </foreach>
    <addFilesToUninstaller files="/etc/${project.vendor}-${project.shortName}.ini"/>
</postInstallationActionList>
link

answered 11 Jun '12, 04:36

Martin%20Pecuch's gravatar image

Martin Pecuch
11223
accept rate: 0%

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:

×73
×27
×6

Asked: 08 Jun '12, 08:17

Seen: 1,170 times

Last updated: 11 Jun '12, 04:36