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

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



2014-12-25 0:59 GMT+02:00 Guillem Jover <guillem@debian.org>:
> Hi!
>
> 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.

-- 
Andrey Utkin


Reply to: