[wpkg-users] [Bug 183] Downgrade should fall back to Upgrade when no downgrade rules exist

Pendl Stefan stefan.pendl at haidlmair.at
Tue May 4 14:38:24 CEST 2010


Hi all,

Just one thing that might still behave in a controllable way:

<install cmd="..." />

<upgrade cmd="..."/>
<upgrade inherit="install"/>

This way one only needs define the common tasks once and can place them at the appropriate position before, after or in between the up-/downgrade command sequence.

About Java, I have managed to reduce the complexity of most of my packages by using the variable definition capability of WPKG and the command prompt.

Example:

>>
    <package
        id="JRE6"
        name="Java Runtime Environment 6"
        revision="%JRE_VER%"
        reboot="false"
        priority="30">

        <!--<depends package-id="JRE5remove" />-->

        <variable name="JRE_PREV_VER" value="19" />
        <variable name="JRE_VER" value="20" />

        <check type="uninstall" condition="exists" path="Java.TM. 6 Update [0-9]+" />
        <check type="logical" condition="or">
            <check type="file" condition="versiongreaterorequal" path="%ProgramFiles%\Java\jre6\bin\java.exe" value="6.0.%JRE_VER%0" />
            <check type="file" condition="versiongreaterorequal" path="%ProgramFiles(x86)%\Java\jre6\bin\java.exe" value="6.0.%JRE_VER%0" />
        </check>

        <!-- stop quick start service -->
        <install cmd="%ComSpec% /c net stop JavaQuickStarterService">
            <exit code="2" />
        </install>
        <!-- remove 32-bit version -->
        <install cmd="%ComSpec% /c for /L %V in (0,1,9) do msiexec /passive /x {3248F0A8-6813-11D6-A77B-00B0D01600%V0}">
            <exit code="1605" />
        </install>
        <install cmd="%ComSpec% /c for /L %V in (10,1,%JRE_PREV_VER%) do msiexec /passive /x {26A24AE4-039D-4CA4-87B4-2F832160%VFF}">
            <exit code="1605" />
        </install>
        <!-- remove 64-bit version -->
        <install cmd="%ComSpec% /c for /L %V in (10,1,%JRE_PREV_VER%) do msiexec /passive /x {26A24AE4-039D-4CA4-87B4-2F864160%VFF}">
            <exit code="1605" />
        </install>
        <!-- install latest version -->
        <install cmd='"%SOFTWARE%\Sun Java\jre-6u%JRE_VER%-windows-i586.exe" /s /v "/passive /log %TMP%\JRE6_x86.log ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 REBOOT=Suppress"' />
        <install cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == AMD64 "%SOFTWARE%\Sun Java\jre-6u%JRE_VER%-windows-x64.exe" /s /v "/passive /log %TMP%\JRE6_AMD64.log ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 REBOOT=Suppress"' />

        <!-- stop quick start service -->
        <upgrade cmd="%ComSpec% /c net stop JavaQuickStarterService">
            <exit code="2" />
        </upgrade>
        <!-- remove 32-bit version -->
        <upgrade cmd="%ComSpec% /c for /L %V in (0,1,9) do msiexec /passive /x {3248F0A8-6813-11D6-A77B-00B0D01600%V0}">
            <exit code="1605" />
        </upgrade>
        <upgrade cmd="%ComSpec% /c for /L %V in (10,1,%JRE_PREV_VER%) do msiexec /passive /x {26A24AE4-039D-4CA4-87B4-2F832160%VFF}">
            <exit code="1605" />
        </upgrade>
        <!-- remove 64-bit version -->
        <upgrade cmd="%ComSpec% /c for /L %V in (10,1,%JRE_PREV_VER%) do msiexec /passive /x {26A24AE4-039D-4CA4-87B4-2F864160%VFF}">
            <exit code="1605" />
        </upgrade>
        <!-- install latest version -->
        <upgrade cmd='"%SOFTWARE%\Sun Java\jre-6u%JRE_VER%-windows-i586.exe" /s /v "/passive /log %TMP%\JRE6_x86.log ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 REBOOT=Suppress"' />
        <upgrade cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == AMD64 "%SOFTWARE%\Sun Java\jre-6u%JRE_VER%-windows-x64.exe" /s /v "/passive /log %TMP%\JRE6_AMD64.log ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1 REBOOT=Suppress"' />

        <!-- stop quick start service -->
        <remove cmd="%ComSpec% /c net stop JavaQuickStarterService">
            <exit code="2" />
        </remove>
        <!-- remove 32-bit version -->
        <remove cmd="msiexec /passive /x {26A24AE4-039D-4CA4-87B4-2F832160%JRE_VER%FF}">
            <exit code="1605"/>
        </remove>
        <!-- remove 64-bit version -->
        <remove cmd="msiexec /passive /x {26A24AE4-039D-4CA4-87B4-2F864160%JRE_VER%FF}">
            <exit code="1605"/>
        </remove>
    </package>
<<

Adding the inherit attribute would reduce the upgrade to one single line, which would be nice to have too.

---
Stefan



More information about the wpkg-users mailing list