[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: preinst: get new pkg version to check for downgrade



Hi!

On Thu, 2014-12-25 at 01:04:08 +0200, Andrey Utkin wrote:
> 2014-12-25 0:59 GMT+02:00 Guillem Jover <guillem@debian.org>:
> > On Wed, 2014-12-24 at 19:43:47 +0200, Andrey Utkin wrote:
> >> When preinst is called with $1 = "upgrade", $2 is set with old
> >> version. How should I get programmatically the new version (the one
> >> being currently installed), to compare with "dpkg --compare-versions".
> >
> > The new version is always implicitly known at package build time, so
> > if you really need to have a varying version you can replace it then.
> > But usually you compare against a known version that introduced
> > something and then you have logic like:
> >
> > case "$1" in
> > upgrade)
> >   if dpkg --compare-versions "$2" lt KNOWN-VERSION; then
> >     : # do some actions, or deny or accept the downgrade
> >   fi
> >   ;;
> > esac
> 
> Uh, ok. That is a solution. I just thought it is possible to retrieve
> this new version somehow, without preprocessing a preinst script from
> a template.

Well as mentioned above you (almost?) never need to know the new
version, only the old one. What would you need to do only on all
downgrades, that you would not do also on all upgrades?

I guess I'm not seeing the use here.

Thanks,
Guillem


Reply to: