[wpkg-users] package is run one more time after removal

Rainer Meier r.meier at wpkg.org
Tue Jun 2 23:10:00 CEST 2009


Hi Simon,

simplesi wrote:
> In my package files, I NEVER have an uninstall script - I simply use WPKG to
> install and update software.

That's fine with WPKG. In this case during removal simply nothing will be
removed at all (no command executed).

However the issue you face with your packages might come from the fact that you
did not specify appropriate checks for the packages. From your description I
have to assume that you do not specify any checks. As a result the WPKG-internal
isInstalled() check will return false for the package. That means that WPKG will
re-install all these packages having no checks during synchronization.
To prevent this you might specify the "execute=once" attribute to the package.
"Once"-Packages are just installed once and then WPKG does not use the checks to
verify if they are installed - WPKG just trusts that they still are.

So in your case WPKG would first check the packages installed and do upgrades of
the ones where upgrades are available (you said you're using WPKG for updates
too). Due to the execute=once flag WPKG would not re-install the packages with
no checks and just trust they are still installed.
The removal procedure would not execute any commands (none specified) and then
WPKG simply assumes the package was removed successfully (isInstalled() returns
false). So exactly what you want to do unless I understood your use-case wrongly.


> Could WPKG be modified that if a package has no uninstall script then WPKG
> does not try to do anything except report the information if console
> messages are enabled.

It's already doing this. If there are no uninstall commands WPKG will not do
anything and then use the checks if the package is removed correctly. If you do
not specify any checks this removes the package from local wpkg.xml without
applying any change to the system.

The behavior you're facing comes due to the installPackage() method inside WPKG.
As I wrote above it will re-run the install commands in case you do not specify
any checks (because WPKG has to assume the package is not installed). To prevent
this specify execute=once at the package XML node.

There would still be one case where there could be an upgrade before the removal
commands are run. In case you did an update to the package and then remove it
from a profile. In this case also machines which get the package removed will
first get the upgrade commands run (which should be fine because you're using
WPKG for upgrading anyway and the upgrade should also work for profiles where
the package is still in use) and then the package is removed (in your case
nothing is run because there are no remove commands).


> e.g if there is no uninstall line in the package - then WPKG does not run
> the install/upgrade commands - it just does nothing.

As written above. WPKG is already doing exactly this.
What can go wrong:
- In case you have checks defined then WPKG will not remove the package from
wpkg.xml unless properly uninstalled (checks indicate that the software is not
installed any more). This is very essential to most WPKG users - especially in
corporate environment where you need to make sure that a software to be removed
is really removed (might be license/cost issues).
- If you do not specify any check, then WPKG will re-run the install commands on
each synchronization because it cannot detect if the package is (still) applied
correctly. To tell WPKG not to check each time use the execute=once flag. This
tells WPKG to do a one-shot installation of the package.



> This would let people have the advanced functionality needed to deal with
> complicated uninstall scripts that don't work properly the first time but
> would make WPKG operate in the old simpler way for simple packages. :)

As explained above I think WPKG already supports this use case. So please have a
look at the execute=once flag and try if it fits your needs.

br,
Rainer



More information about the wpkg-users mailing list