[wpkg-users] Forgot command, exit status 0?

Rainer Meier r.meier at wpkg.org
Thu Mar 12 08:59:18 CET 2009


Hi Marco

Marco Gaiarin wrote:
> Exactly. My recipe is:
> 
>   <package
>         id="tb345rt"
>         name="Asymetric ToolBook Runtime (3, 4, 5)"
>         revision="501"
>         reboot="false"
>         priority="50">
> 
>         <check type="logical" condition="and">
>                 <check type="file" condition="versiongreaterorequal" path='%WINDIR%\ASYM\RUNTIME\MTB30RUN.EXE' value='3.0.1.0' />
>                 <check type="file" condition="versiongreaterorequal" path='%WINDIR%\ASYM\RUNTIME\MTB40RUN.EXE' value='4.0.0.0' />
>                 <check type="file" condition="versiongreaterorequal" path='%WINDIR%\ASYM\RUNTIME\TB50RUN.EXE' value='5.0.0.0' />
>         </check>
> 
>         <install cmd='cmd /c if not exist "%WINDIR%\ASYM\RUNTIME" md "%WINDIR%\ASYM\RUNTIME"' />
>         <install cmd='%WPKGROOT%\tools\unzip -oqq "%SOFTWARE%\WPKG\tb345rt.zip" -d "%WINDIR%\ASYM\RUNTIME"' />
>         <install cmd='%WPKGROOT%\tools\modpath /add "%WINDIR%\ASYM\RUNTIME\"' />
>         <upgrade cmd='%WPKGROOT%\tools\unzip -oqq "%SOFTWARE%\WPKG\tb345rt.zip" -d "%WINDIR%\ASYM\RUNTIME"' />
>         <remove cmd='%WPKGROOT%\tools\modpath /del "%WINDIR%\ASYM\RUNTIME"' />
>         <remove cmd='cmd /c rd /q /s "%WINDIR%\ASYM\RUNTIME"' />
>   </package>
> 
> and clearly after the unzip check conditions are true, even if WPKG
> execution stop.
> 
> 
> Indeed i think that errors like that have to be catched by wpkg and not
> generate a 'fault' or immediate stop, eg return an exit code different
> from 0 instead of stop the execution.

Well, I clearly see some problems in your package definition here.

First of all I suggest you to execute the correct binaries. It seems you
tend to omit the .exe suffix which clearly belongs to the file as well.
Quite sure a file "%WPKGROOT%\tools\unzip" does not exist. Instead
Windows executes "%WPKGROOT%\tools\unzip.exe". So I suggest you to add
the suffix too to make clear which binary you execute (Windows might
also decide to execute "%WPKGROOT%\tools\unzip.cmd",
"%WPKGROOT%\tools\unzip.bat" or any other executable with this name.

However this does not seem to be the main problem in your package.

WPKG will execute the first commands:
<install cmd='cmd /c if not exist "%WINDIR%\ASYM\RUNTIME" md
"%WINDIR%\ASYM\RUNTIME"' />

and

<install cmd='%WPKGROOT%\tools\unzip -oqq "%SOFTWARE%\WPKG\tb345rt.zip"
-d "%WINDIR%\ASYM\RUNTIME"' />

After this two commands most likely ALL your check conditions reveal
"true". So you indicate to WPKG that the installation has been overall
successful because all checks are true.
WPKG will yield an error during installation of "tb345rt" package at
first try since the last command (%WPKGROOT%\tools\modpath.exe) might
fail at first attempt.
But on next WPKG execution WPKG will first execute the checks to verify
if the package has been installed already. Your checks will make WPKG
think that the package is installed already since all your checks return
true (unzip completed successfully).

To prevent this you need to add another check which verifies that the
changes done by "modpath" are done as well. If you omit such a check,
then WPKG cannot know if the package is already installed completely or
something is missing. So just be more specific with your checks.

This is intended behavior of WPKG in order to determine if an
application is already installed. Checks have to be specific enough to
allow verification of install status on a PC which is in any state.
For example your "modpath" command could add a registry entry, then add
a check if this entry is actually there. If not, then WPKG needs to
re-run the install commands.
This allows WPKG to verify and fix up installations if necessary and
prevents WPKG to re-run installations on packages when there is no need
to do it.
For example if you run WPKG on a machine for the first time and WPKG is
supposed to install a software which is already there, then WPKG just
adds this application to the local package database without executing
any installation. If you want to do special modifications/extensions
then you're supposed to add checks for this modifications. Also this
gives you the advantage to be sure that your configuration is really
applied to the system. A user might have modified your pre-configuration
and you can add checks which are executed on each WPKG run to verify
that your settings are still in place.


So assuming that your unzip operation worked and you check for file
version only, then for WPKG the package is installed as soon as the
unzip operation completes.

There is also no intend or need to change this behavior. Just fix up
your checks.


br,
Rainer



More information about the wpkg-users mailing list