[pve-devel] [PATCH manager 10/15] postinst: simplify code for transitional updates

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Mar 6 12:11:05 CET 2018


On Wed, Jan 24, 2018 at 02:12:35PM +0100, Thomas Lamprecht wrote:
> The first case won't happen anymore on a recent PVE.
> The 'version is empty or <unknown>' check may drop the '<unknown>'
> part, it gets handled by the 'dpkg --compare-versions' bits just
> fine, if it happens at all for the 'configure' case
> 
> Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
> ---
>  debian/postinst | 21 +++++----------------
>  1 file changed, 5 insertions(+), 16 deletions(-)
> 
> diff --git a/debian/postinst b/debian/postinst
> index cdec8a20..5e3dd689 100755
> --- a/debian/postinst
> +++ b/debian/postinst
> @@ -120,28 +120,17 @@ EOF
>  
>      #a2ensite pve.conf >/dev/null 2>&1
>  
> -    # There are three sub-cases:
> -    if test "${2+set}" != set; then
> -      # We're being installed by an ancient dpkg which doesn't remember
> -      # which version was most recently configured, or even whether
> -      # there is a most recently configured version.
> -      :
> -
> -    elif test -z "$2" -o "$2" = "<unknown>"; then
> -      # The package has not ever been configured on this system, or was
> -      # purged since it was last configured.
> -      :
> -
> +    if test -z "$2"; then
> +      : # no old version, nothing to do

I think the if can be dropped as well?

>      else

and this made an if instead ;)

> -      # Version $2 is the most recently configured version of this
> -      # package.
> +      # "$2" is the currenlty installing package version

s/currenlty/currently

but that is wrong. (for postinst configure) "$2" is actually the most
recently configured version, which usually is the version we are
upgrading FROM, not the one we are upgrading TO. postinst abort-upgrade
of the old package version would get called with the new version as
"$2", but we don't handle/use that here (and hopefully don't run into it
very often either ;))

>        if dpkg --compare-versions "$2" '<=' '5.0-23'; then
>          # 5.0-23 temporarily reverted the removal of the startcom CA in
>          # ca-certificates; we've since switched to let's encrypt
>          update-ca-certificates >/dev/null 2>&1
>        fi
> -
> -    fi ;;
> +    fi
> +    ;;
>  
>    abort-upgrade|abort-remove|abort-deconfigure)
>      ;;
> -- 
> 2.14.2
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel




More information about the pve-devel mailing list